Imagine gripping a convex polygon between the flat jaws of a physical caliper. If you slowly rotate the caliper all the way around the shape without letting go, you will slide across every extreme point at least once. When the jaws are widest apart, you have just found the diameter — the two vertices that are farthest from each other.
This physical intuition is the heart of rotating calipers, a computational geometry technique published by Michael Shamos in 1978. In its algorithmic form, two parallel "support lines" are initialized touching the topmost and bottommost vertices of a convex hull, and then rotated together in small angular steps. At each step the gap between the lines is measured and the maximum recorded. One full revolution costs only time — a single linear pass over the polygon's n vertices.
Before rotating calipers, computing the diameter of a convex polygon required checking all pairs of vertices. Shamos's insight was that the extremal pair always appears as the lines co-rotate, so no pair needs to be checked twice.
Comments
Loading comments...