Planar orientation test (source code)

= Planar orientation test

For planar points $A,B,P$, the sign of $(B-A)\times(P-A)$, using the <two-dimensional cross product>, determines which side of the directed line from $A$ to $B$ contains $P$. Zero means collinearity. A point is strictly inside a nondegenerate <triangle> exactly when these signs for its three cyclically ordered sides are all strictly positive or all strictly negative.