获取由3d多边形包围的点 [英] Get points enclosed by a 3d polygon
问题描述
我有一个位于3D平面上的多边形。我想得到这个polygon.can任何人帮助我包围的所有点?
我可以做一个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"
在这种情况下 - 只需将多边形和所有测试点转换为平面的二维局部坐标,并使用2D算法:
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://zh.wikipedia.org / wiki / Point_in_polygon
- http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
- http://paulbourke.net/geometry/insidepoly/
- 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屋!