A point-in-triangle predicate receives three 2D vertices and a candidate point, then decides whether the candidate lies inside the triangle. A practical solution uses cross-product signs to turn geometric orientation into simple Boolean tests. section 9.3.3
The cross-product method works by:
- Embedding each 2D point in the 3D x-y plane by adding a zero z-coordinate. section 9.3.3
- Computing the cross product for the candidate relative to each triangle side; only the z-coordinate remains, representing signed area. section 9.3.3
Boolean implementation
A compact implementation compares each candidate-to-vertex vector with the corresponding side vector and combines the three sign checks with and. The alternative listing expands each comparison into the equivalent cross-product expression.
