eXt
- 4
- 0
Hi, how do I test if a point is inside a triangle? The point is assumed to be in the triangle's plane.
eXt said:What I'm trying to accomplish is to find if a point is within a geometric room consisting of several triangles. I am going to use Jordans curve theorem to find if it is so what I do is the following:
1) Cast a ray from the point (in an arbitrary direction) agains each plane the triangles are in.
2) If the ray intersects with the plane I calculate the point in the plane.
3) Now I need to figure out if this point is within the triangle or just in the plane.
4) And last, count each time the ray intersects with a triangle.
So, what I know about each triangle is it's 3 coordinates.
I've read about the following method but I'm not sure if its good or not:
Calculate a vector from the point to each corner of the triangle, if the sum of the angles between this vectors equals 360 degrees the point is inside.