Scatter a handful of points on a page and imagine stretching a rubber band around all of them, then letting it snap tight. The shape it traces — using only the outermost points as corners — is the convex hull. Every other point ends up trapped inside.
Computing that shape sounds like it should require checking every point against every other, but there is a shortcut with a delightfully simple idea: find the point that sticks out the farthest from a line, use it to slice the problem into two smaller pieces, and repeat. That is QuickHull, and its structure is a close cousin of quicksort — pick a pivot, split, recurse.
The reward is an algorithm that, for typical scattered inputs, wraps points in about time, discarding huge chunks of the input at every step without ever looking at them again.
Comments
Loading comments...