简体   繁体   中英

How do you know if you are 'inside' a set of triangles?

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

测地线网格球

...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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM