Rotating Calipers
Advance antipodal support lines around a convex polygon to find its diameter without checking every pair.
Core idea
On a convex polygon, an antipodal support point moves monotonically as each hull edge advances. This rotating pair visits all diameter candidates without restarting a scan.
Read the visualization
One pointer selects the current hull edge and the other rotates while triangle area increases. Candidate endpoint distances update the best diameter pair.
Load the convex polygon and place the first antipodal support pair.
Complexity and tradeoffs
Time: O(n) after the hull. Space: O(1). Monotone orientation changes ensure each pointer makes at most one full circuit.
Where it fits
Rotating calipers finds convex diameter, width, bounding rectangles, and distances between convex polygons after a hull has already been built.