← Lessons

quiz vs the machine

Platinum1760

Algorithms

The Rotating Calipers Technique

Spin a pair of parallel lines around a hull to find its widest span.

6 min read · advanced · beat Platinum to climb

Measuring across a hull

Once you have a convex hull, several questions become easy: the farthest pair of points, the width, and the smallest enclosing rectangle. The rotating calipers technique answers them by imagining a pair of parallel support lines, like caliper jaws, hugging the hull from opposite sides.

Rotating in lockstep

The method walks two points around the hull at once:

  • Start with the calipers touching two extreme hull vertices.
  • Rotate the parallel lines together, advancing whichever contact point its supporting edge allows next.
  • At each rotation, the two contact vertices form an antipodal pair, a candidate for the farthest pair.

Because both contacts only ever move forward around the hull, the entire sweep visits each vertex a bounded number of times and finishes in a single linear pass over the hull.

What it unlocks

The diameter of the point set is the largest distance among the antipodal pairs the calipers expose. With a small change the same sweep finds the minimum width strip and the minimum area bounding rectangle, since an optimal rectangle always has a side flush with a hull edge. The shared idea is that the answer touches the boundary, so spinning supports along the boundary cannot miss it.

Key idea

Rotating calipers spin parallel support lines around a convex hull, visiting antipodal pairs once each to find the diameter, width, or bounding rectangle.

Check yourself

Answer to earn rating on the learn ladder.

1. What structure do rotating calipers operate on?

2. What is an antipodal pair?

3. Why does an optimal bounding rectangle help the calipers find it?