After finding barycentric coordinates in triangle - what's the actual check to know if point(x,y) is inside?

182 Views Asked by At

I read about barycentric coordinates and how to find out if a point is inside a triangle or not.

point is P and the barycentric coordinates are u,v and triangle points are ABC:
P = A + u(C−A) + v(B−A)

Calculated values for (u,v):
u = ... (is ... greater 0?)
v = ... (is ... greater 0?)
1 - u - v = ... (is ... greater 0?)

Let's assume I already know the result of (u) and (v) and (1 - u - v).

Now I'm actually unsure how I could setup a check with the given X and Y position of a point to retrieve a TRUE or FALSE about it being inside the triangle or not. Is it just like this or how could I check exactly if X,Y is inside the triangle or not?:

X position is equal to A + u(C−A) + v(B−A) TRUE
Y position is equal to A + u(C−A) + v(B−A) TRUE
u is greater than 0 TRUE
v is greater than 0 TRUE
1 minus u minus v is greater than 0 TRUE

These 5 are all TRUE, then this means TRUE for point is inside triangle?