获取由 3d 多边形包围的点 [英] Get points enclosed by a 3d polygon
问题描述
我有一个位于 3D 平面上的多边形.我想得到这个多边形包围的所有点.有人可以帮我吗?我可以通过用平面替换扫描线并获得平面与多边形的交点来制作 3D 扫描线算法,但我想要一个更快的解决方案.提前致谢.
I have a polygon that lies on a 3D plane. i want to get all points enclosed by this polygon.can anyone help me ? i can make a 3D scan line algorithm by replacing the scan lines by planes and get the intersection of planes with my polygon but i want a faster solution. Thanks in advance.
推荐答案
是的,它是一个凸 3p 多边形,但它的所有点都在同一平面上"
"yes it's a convex 3p polygon ,but it all its points lie in the same plane"
在那种情况下 - 只需将多边形和所有测试点转换为平面的二维局部坐标并使用二维算法:
In that case - just convert the polygon and all the test points into 2D local coordinates of the plane and use a 2D algorithm:
2D 光线拍摄:您仍然可以使用与我的 3d 建议类似的算法 - 拍摄源自您的测试点的 2D 光线并计算您击中多边形边界的次数.
2D ray shooting: You can still use similar algorithm to my 3d suggestion - shoot 2D rays originating from your test point and count how many times you hit the border of your polygon.
线性不等式:如果你的多边形是凸的,你可以遵循suszterpatt的方法,你的多边形定义为半平面的交集ax+by<d
Linear inequalities: If your polygon is convex, you can follow suszterpatt's approach, with your polygon defined as an intersection of halfplanes ax+by<d
进一步阅读:
- http://en.wikipedia.org/wiki/Point_in_polygon
- http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
- http://paulbourke.net/geometry/insidepoly/
这篇关于获取由 3d 多边形包围的点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!