Skip to content
Part IA Lent Term

The Convex Hull Problem

Definition

The convex hull of a set of points PP in the plane is the smallest convex polygon that contains all points of PP. Equivalently:

  • It is the intersection of all convex sets containing PP.
  • It is the shape a rubber band would take if stretched around all the points and then released.

Convex hull of a point set

Properties

  1. All hull vertices are points of PP (extreme points).
  2. Any interior point of PP is not on the hull.
  3. The hull has at least 3 vertices (assuming at least 3 non-collinear points).
  4. The hull has at most nn vertices (all points on the boundary, e.g. points on a circle).
  5. The furthest-apart pair of points in PP are both on the hull.

Input and Output

Input: A set of n>2n > 2 points pi=(xi,yi)p_i = (x_i, y_i) where 1in1 \le i \le n. At least 3 points are not collinear (so the hull has non-zero area).

Output: An ordered list of points forming the convex hull (usually in counter-clockwise order).

Two common output formats:

  1. List of hull vertices in CCW order.
  2. List of hull edges forming the boundary.

Lower Bound: Ω(nlogn)\Omega(n \log n)

The convex hull problem requires Ω(nlogn)\Omega(n \log n) time in the comparison model.

Proof by reduction from sorting: Given nn distinct numbers a1,a2,,ana_1, a_2, \ldots, a_n to sort, map them to points on a parabola: pi=(ai,ai2)p_i = (a_i, a_i^2). All these points lie on the convex parabola y=x2y = x^2, so they are all on the convex hull. Computing the convex hull of these nn points and then reading the xx-coordinates in hull order (either left to right or right to left depending on output order) yields the sorted sequence.

Since sorting takes Ω(nlogn)\Omega(n \log n) comparisons, convex hull must also take Ω(nlogn)\Omega(n \log n).

Output Sensitivity

The number of hull vertices is denoted by hh (where 3hn3 \le h \le n). Algorithms that run in time proportional to hh are called output-sensitive.

AlgorithmTimeOutput-sensitive?
Graham’s ScanΘ(nlogn)\Theta(n \log n)No
Jarvis’s MarchΘ(nh)\Theta(nh)Yes
Prune and SearchO(nlogh)O(n \log h)Yes (asymptotically optimal)

If hh is small (e.g. h=O(1)h = O(1) or h=O(logn)h = O(\log n)), Jarvis march outperforms Graham scan. If h=Θ(n)h = \Theta(n), Graham scan is better.

Applications

  • Collision detection in physics simulations and games (hull provides a conservative bounding region).
  • Shape analysis in computer vision.
  • GIS and mapping: computing the outer boundary of a set of geographic points.
  • Pattern recognition: feature extraction from point sets.
  • Voronoi diagrams: the convex hull is the outer boundary of the unbounded Voronoi cells.

Five Algorithms for Convex Hull

ApproachAlgorithmTime
Rotational sweepGraham’s ScanO(nlogn)O(n \log n)
Rotational sweepJarvis’s MarchO(nh)O(nh)
IncrementalAdd points one by oneO(nlogn)O(n \log n)
Divide and ConquerMerge two hullsO(nlogn)O(n \log n)
Prune and SearchChan’s algorithm styleO(nlogh)O(n \log h)

The Tripos syllabus focuses on Graham’s Scan and Jarvis’s March.

Summary

PropertyDetail
DefinitionSmallest convex polygon containing all points
Hull verticeshh, where 3hn3 \le h \le n
Lower boundΩ(nlogn)\Omega(n \log n) by reduction from sorting
Graham scanΘ(nlogn)\Theta(n \log n), non-output-sensitive
Jarvis marchΘ(nh)\Theta(nh), output-sensitive
Key factExtreme points of any direction are on the hull
Cross productUsed for all turn-direction checks, no trig