Question

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!

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top