advanced32 min studyLesson 921 in Mathematics

Orientation predicates and exact arithmetic

Make geometric decisions from certified signs, with an explicit input model.

On this page

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.

orient⁡(a,b,c)=(bx−ax)(cy−ay)−(by−ay)(cx−ax).\operatorname{orient}(a,b,c)=(b_x-a_x)(c_y-a_y)-(b_y-a_y)(c_x-a_x).
Positive orientation is a counterclockwise turn in an upward-y Cartesian frame.↔ Scroll wide equations horizontally.

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.

∣D^−D∣≤E,∣D^∣>E ⟹ sign⁡(D)=sign⁡(D^).|\widehat D-D|\leq E,\quad |\widehat D|>E\ \Longrightarrow\ \operatorname{sign}(D)=\operatorname{sign}(\widehat D).
A proven error enclosure certifies the sign; unresolved cases require a stronger evaluation.↔ Scroll wide equations horizontally.

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.

An exact unit determinant lost by ordinary multiplication

Set N=227N=2^{27} and take a=(0,0)a=(0,0), b=(N,N−1)b=(N,N-1), c=(N+1,N)c=(N+1,N). Determine their orientation and area. Compare the exact determinant with ordinary binary64 multiplication and subtraction using round-to-nearest, ties-to-even.

  1. All four nonzero integer coordinates are exactly representable in binary64. Exact arithmetic gives D=N2−(N−1)(N+1)=1D=N^2-(N-1)(N+1)=1, so the turn is counterclockwise.

  2. The first product is exactly 2542^{54}. The second exact product is 254−12^{54}-1, halfway between adjacent representable numbers just below 2542^{54}; ties-to-even rounds it to 2542^{54}.

  3. 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 result

The exact triangle area is 1/21/2. This error comes from intermediate arithmetic, not inaccurate input coordinates, and an absolute zero tolerance cannot repair the lost sign.

Explore the model

Interactive lab

Interactive lab · vectors

Read an orientation from a vector component

Pause/Reset and set BOTH controls to angle 3030 degrees, magnitude 22. With a=(0,0)a=(0,0) and b=(1,0)b=(1,0) fixed, the displayed vector endpoint is c=(3,1)c=(\sqrt3,1), giving orientation 11. For a fresh comparison Pause/Reset and set BOTH to angle −30-30 degrees, magnitude 22: orientation becomes −1-1. Changes pause and retain the clock; Reset clears it.

Read an orientation from a vector componentPlayback traces a fixed vector and its projections. Angle and magnitude set the geometry; the moving marker does not change them. Current readings: x component: 1.393; y component: 0.975; Magnitude: 1.7. All parameters are adjustable with the labeled controls below.−7.46−3.7303.737.46−3.5−1.7501.753.5xyvvₓ = 1.39
Vectorx / y projectionsTrace marker
x component
1.393
y component
0.975
Magnitude
1.7
t = 0 s

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.

Check your understanding

When does a filtered floating-point determinant safely determine the exact sign of the represented inputs?

Try it yourself

For a=(−2,1)a=(-2,1), b=(3,2)b=(3,2), evaluate the orientations of c=(1,5)c=(1,5) and d=(8,3)d=(8,3). Is dd on the closed segment abab? State the signed area for the triple a,b,ca,b,c.

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 b−a=(5,1)b-a=(5,1), while c−a=(3,4)c-a=(3,4), so orientation is 5⋅4−1⋅3=175\cdot4-1\cdot3=17 and signed area is 17/217/2. For d−a=(10,2)d-a=(10,2), the determinant is zero. However, d=a+2(b−a)d=a+2(b-a) lies beyond bb, not between the endpoints. Thus it is on the supporting line but outside the closed segment. Reversing the first two arguments would change 1717 to −17-17.

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.