5

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).

Community
  • 1
  • 1
sebpiq
  • 7,540
  • 9
  • 52
  • 69
  • possible duplicate of [Intersections of 3D polygons in python](http://stackoverflow.com/questions/2549708/intersections-of-3d-polygons-in-python) – plaes Feb 18 '12 at 08:37
  • @plaes: Except that [Intersections of 3D polygons in python] doesn't have any good answer. They suggest using pvtrace, which traces some rays : I remind you that I'm using `MultiPolygons` and `LineString` : it will be very unefficient to iterate through all polygons, all segments of line and calculate polygon INTER segment for each of those. – sebpiq Feb 18 '12 at 08:44
  • plus, just go to pvtrace's site, and look for the doc, and then tell me if you'd like to use it ... – sebpiq Feb 18 '12 at 08:45
  • Well, tell me first what should the result of intersection between 3D object and a line be? – plaes Feb 18 '12 at 08:57
  • 1
    A collection of 3D points and 3D lines. Is this a test ? – sebpiq Feb 18 '12 at 09:03
  • Yeah, though closing issue was my mistake (just trying to help keeping things clean). – plaes Feb 20 '12 at 06:55

1 Answers1

3

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.

Community
  • 1
  • 1
Andrew Walker
  • 40,984
  • 8
  • 62
  • 84