Previous | Next --- Slide 71 of 79
Back to Lecture Thumbnails

There is a way to solve this with cross products, but I was wondering if it is more efficient to use matrices: assuming the triangle is nondegenerate, we can consider the basis {P1 - P0, P2 - P0} and check if the coordinates of q under this basis are positive and have sum less than 1/2.


Can i represent each edge as a vector and do some vector calculation to check if a block is in a triangle?


How often do we want to do this instead of using Barycentric coordinates?


Would this involve calculating the angle between the vector from Pi to q and the vector from Pi to Pj and checking its sign?


Is this the same method we use to sample points for interpolated color and uv coordinates?


Could we compare the sum of the area of triangles P0P1q, P0P2q, P1P2q against the area of the triangle P0P1P2? These two areas should be the same iff q is inside the triangle P0P1P2, and we can avoid repetitive calculation by saving the area of P0P1P2 inside its data structure.