Orientation predicates and exact arithmetic
Make geometric decisions from certified signs, with an explicit input model.
On this page
The question for today
What you’ll understand
- Interpret a planar orientation determinant with a declared sign convention.
- Distinguish an exact predicate from an exact coordinate construction.
- Explain a certified floating-point filter and its exact fallback.
A geometric algorithm repeatedly makes discrete decisions: turn left or right, cross an edge or stay inside, include a site or discard it. One wrong sign can corrupt the combinatorial structure even if every displayed coordinate looks plausible. We use Cartesian coordinates with the vertical axis pointing upward and define positive orientation as counterclockwise. Robustness means making decisions consistent with the represented input, including exact zeros. It does not recover coordinates lost before the algorithm received them or infer an uncertain physical geometry from measurements.
One determinant encodes a turn
For three ordered planar points, subtract the first point from the other two and take the determinant of the resulting vectors. Positive means the third point lies to the left of the directed first-to-second line; negative means right; zero means collinear, including repeated-point cases. Half the determinant is signed triangle area. Reversing two arguments reverses the sign. A point on the supporting line is not necessarily on the closed segment: containment additionally requires coordinate bounds or an equivalent between-endpoints test.
Integer or rational coordinates allow exact sign decisions using sufficiently large arithmetic. A unit-cost real-arithmetic analysis often treats this test as constant time, but an implementation must account for integer bit lengths, overflow, and the cost of arbitrary precision. Even when every input coordinate is exactly representable as a floating-point number, the products and subtraction forming a determinant may not be exact. Cancellation makes this especially dangerous near collinearity, as the worked example demonstrates without any initial input-rounding error.
Certify the fast answer before trusting it
A filtered predicate first computes a fast approximation together with a rigorous error bound derived for its evaluation scheme. If the approximation's magnitude exceeds that bound, the exact sign is certified. Otherwise the implementation recomputes with stronger arithmetic, such as expansion arithmetic or exact rationals. An interval filter can likewise accept only when its enclosing interval excludes zero. A guessed absolute tolerance is not such a certificate: scaling the coordinates changes determinant magnitudes without changing the combinatorial answer.
Adaptive arithmetic spends additional work on uncertain cases rather than making every test equally expensive. Its guarantees depend on the actual arithmetic environment: rounding mode, supported exponent range, handling of underflow and overflow, and compiler transformations must satisfy the implementation's assumptions. Shewchuk's algorithms establish exact signs for the supplied binary inputs under their specified conditions. A certified zero is retained as a real degeneracy, then handled according to the algorithm's tie policy; it is not silently changed into a convenient nonzero sign.
Predicates and constructions have different obligations
A predicate returns a discrete answer such as orientation or incidence. A construction creates new coordinates, for example a segment intersection. Exact predicates applied to rounded constructed points answer questions about those rounded points, which can differ from questions about the intended exact intersections. Consequently exact-predicate kernels and exact-construction kernels offer different promises. Select the representation and kernel around the operations the full algorithm needs, rather than assuming that one robust orientation routine makes every subsequent coordinate calculation exact.
Degenerate inputs also need a coherent combinatorial specification. Duplicate points may be merged while retaining their identifiers; collinear hull points may be excluded or explicitly listed; shared intersection endpoints may be reported once. Symbolic perturbation can impose a consistent hypothetical general position, but its output must be interpreted relative to that perturbed problem or mapped back carefully. Independently nudging coordinates or changing signs with an arbitrary tolerance can produce contradictory decisions and destroy an otherwise valid algorithmic invariant.
Work it through
An exact unit determinant lost by ordinary multiplication
Set and take , , . Determine their orientation and area. Compare the exact determinant with ordinary binary64 multiplication and subtraction using round-to-nearest, ties-to-even.
All four nonzero integer coordinates are exactly representable in binary64. Exact arithmetic gives , so the turn is counterclockwise.
The first product is exactly . The second exact product is , halfway between adjacent representable numbers just below ; ties-to-even rounds it to .
Subtracting the rounded products therefore gives zero, despite the exact determinant being one. An uncertified zero would misclassify the triple. Exact arithmetic or a valid fallback preserves the correct positive sign.
The exact triangle area is . This error comes from intermediate arithmetic, not inaccurate input coordinates, and an absolute zero tolerance cannot repair the lost sign.
The living notebook
Explore the model
Interactive lab · vectors
Read an orientation from a vector component
Pause/Reset and set BOTH controls to angle degrees, magnitude . With and fixed, the displayed vector endpoint is , giving orientation . For a fresh comparison Pause/Reset and set BOTH to angle degrees, magnitude : orientation becomes . Changes pause and retain the clock; Reset clears it.
- x component
- 1.393
- y component
- 0.975
- Magnitude
- 1.7
Playback traces a fixed vector and its projections. Angle and magnitude set the geometry; the moving marker does not change them. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forThe vertical component supplies this special orientation determinant. The instrument uses ordinary numerical trigonometry and is not a certified arithmetic or rounding-error simulator.
Pause & reason
Check your understanding
Your turn
Try it yourself
For , , evaluate the orientations of and . Is on the closed segment ? State the signed area for the triple .
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Subtract a from both other points, and separate collinearity from between-endpoints containment.
Compare with the solution
The vector , while , so orientation is and signed area is . For , the determinant is zero. However, lies beyond , not between the endpoints. Thus it is on the supporting line but outside the closed segment. Reversing the first two arguments would change to .
Keep the idea
Take it with you
- An orientation convention must specify argument order and coordinate handedness.
- A certified filter proves a sign or delegates to stronger arithmetic.
- Exact input predicates do not automatically make constructed coordinates exact.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.