If you have a set of 'regular' connected triangles such as this:

geodesic mesh sphere

...and you know the vertices / normals of every triangle, what is an efficient method to test whether or not another point is 'inside' or 'contained within' the set of triangles?

Thanks!

有帮助吗?

解决方案

From the given point, cast a straight line. Test intersection of the line with every triangle and count all intersections found on the same side of the point. If this count is odd, you are inside.

To make computation easy, use x=x0, y=y0 for the line and project everything on the XY plane. Use How to determine if a point is in a 2D triangle? and finally check the z value of the intersection.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top