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.