Intersections of 3D polygons in python

别说谁变了你拦得住时间么 提交于 2019-12-22 09:28:12

问题


Are there any open source tools or libraries (ideally in python) that are available for performing lots of intersections with 3D geometry read from an ESRI shapefile? Most of the tests will be simple line segments vs polygons.

I've looked into OGR 1.7.1 / GEOS 3.2.0, and whilst it loads the data correctly, the resulting intersections aren't correct, and most of the other tools available seem to build on this work.

Whilst CGAL would have been an alternative, it's license isn't suitable. The Boost generic geometry library looks fantastic, but the api is huge, and doesn't seem to support wkt or wkb readers out of the box.


回答1:


A bit late on answer but my python optical ray tracing programme pvtrace does exactly this. It would work like this:

1) Define polygon with a 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 point(s) with a Ray object

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


来源:https://stackoverflow.com/questions/2549708/intersections-of-3d-polygons-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!