point on triangle

89 Views Asked by At

let we have a domain, for example square that partitioned by some triangles that are not necessarily similar, and we know the coordinates of all vertices and the maximum size of the sides of all triangles, now let we have a point in the square, my problem is that I need to know that this point lying on which triangle? How can I know it?

pleas help me. Thanks

1

There are 1 best solutions below

0
On BEST ANSWER

One way would be to iterate through the triangles. For each, get the barycentric coordinates $(u,v,w)$ of the point with respect to the triangle, and if $u,v,w$ are all $>= 0$ then the point lies in the triangle.

I found this PDF resource helpful when implementing barycentric coordinates in an application recently.