3D polygon intersections in python

Are there any open source tools or libraries (ideally in python) available to make many intersections with 3D geometry read from an ESRI shapefile? Most tests will be simple line segments against polygons.

I studied OGR 1.7.1 / GEOS 3.2.0, and while it is loading the data correctly, the resulting intersections are incorrect, and most of the other tools available seem to be based on this work.

While CGAL would be an alternative, a license is not suitable. The general Boost geometry library looks fantastic, but the api is huge and doesn't seem to support wkt or wkb readers out of the box.

+3
source share
1 answer

A little late in response, but my python pvtrace optical ray tracer does just that. It will work as follows:

1) Define a polygon with a list of points and make a Polygon object

points = [[0,0,0],[0,0.1,0],[0.1,0.1,-0.03],[0.1,0,-0.03]] polygon = Polygon(points) 

2) Get the intersection with the Ray object

 ray = Ray(position=(0,0,0), direction=(0,0,1)) print polygon.intersection(ray) 
+4
source

Source: https://habr.com/ru/post/1397168/


All Articles