Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

3D geometric topology (e.g. intersection) in Python

I am using GEOS (in Python/Django) to manipulate some 3d elements. All topological operations work perfectly in 2D. So, I created a simple MultiPolygon with 3D polygons (very simple in fact, it is just a collection of vertical planes), and a LineString which is also 3D. Now I simply wanted the intersection of those (which I believe would have been a list of 3D-points) :

>>> l = LineString([0, 0, 0], [1, 1, 1])
>>> p = Polygon([[1, 0, 0], [0, 1, 0], [0, 1, 1000], [1, 0, 1000], [1, 0, 0]])
>>> p.intersects(l)
False

So OK, geos doesn't support topological operations with 3D-data ... Well, there must be lots of libraries out there that can do that for me right ??? So I googled, and I just can't find a single one !!! So if somebody has a pointer, that would be great ...

EDIT

There is a similar question as Intersections of 3D polygons in python, but this doesn't give any satisfying answer (see comment).

like image 391
sebpiq Avatar asked Oct 24 '22 08:10

sebpiq


1 Answers

I still don't believe that there is a single "good choice" of a library to do this in python, but a number of promising projects are in the works, foremost amongst them improved cgal-bindings on google code.

The new licensing conditions of CGAL from version 4 onward (GPL/LGPL) also make some parts of the original question on this topic out of date.

like image 72
Andrew Walker Avatar answered Nov 15 '22 12:11

Andrew Walker