The orientation question
Given three points in order, do they make a left turn, a right turn, or stay collinear? This single primitive underlies hulls, intersections, and polygon tests.
Using the cross product
Form two vectors from the first point to the second and from the first point to the third. The two dimensional cross product of these vectors is a signed scalar.
- A positive sign means a counterclockwise, or left, turn.
- A negative sign means a clockwise, or right, turn.
- A zero sign means the three points are collinear.
Why a sign is enough
The cross product equals the signed area of the parallelogram the two vectors span. Area on one side of the line is positive, the other side negative, and a flat triangle has zero area. So the sign alone answers the turn without computing any angle.
Robustness notes
With integer coordinates this test is exact, which is why competitive solutions prefer integers. With floating point you must compare against a small tolerance to avoid misclassifying near collinear points.
Key idea
The signed cross product of two vectors from a shared point classifies three points as a left turn, right turn, or collinear, giving an exact integer primitive for nearly every plane algorithm.