获取3D点是否在棱镜内部

时间:2018-07-18 21:38:47

标签: python shape shapely

我试图确定一个点是否在棱镜(在本例中为立方体)内。我尝试使用Shapely,但似乎只能在2维上使用

from shapely.geometry import Point
from shapely.geometry.polygon import Polygon

point = Point(0.5,0.5,0)
polygon = Polygon([(0,0,0), (0,1,0), (1,1,0), (1,0,0),(0,0,1), (0,1,1), (1,1,1), (1,0,1)])
print(polygon.contains(point))
False

point = Point(0.5,0.5)
polygon = Polygon([(0,0), (0,1), (1,1), (1,0)])
print(polygon.contains(point))
True

是否正确定义了3D点?

0 个答案:

没有答案