Lecture from: 22.05.2025 | Video: Homelab

In this lecture, we focus on computing the convex hull of a finite set of points in the plane. We explore definitions, geometric properties, key algorithms (including Jarvis’ March and Local Repair), and complexity bounds.

What is a Convex Set?

A subset is called convex if, for any two points , the entire line segment between them is also contained in . Formally:

This means the set “contains all its straight lines” - there are no “indentations.”

What is a Convex Hull?

Given a set of points , the convex hull of , denoted , is the smallest convex set containing all points in . Formally:

That is, the convex hull is the intersection of all convex sets containing . For a finite set , the convex hull always exists and is unique.

Representation of the Convex Hull

In , the convex hull of a finite set is a convex polygon whose vertices are a subset of . This polygon is described by the sequence:

traversed counterclockwise. The order is essential - it defines the edges of the polygon.

We assume general position: no three points are collinear and no two points share an x-coordinate.

Determining Convex Hull Edges

A directed edge is a boundary edge (Randkante) if all other points in lie to the left of the directed line from to .

Formally, for three points , define:

Then:

  • lies left of
  • ⇔ points are collinear
  • The area of triangle is

Algorithms

Naive Algorithm:

We could test every pair and check if all other points lie on one side (using tests). There are pairs, each tested in ⇒ total time .

Jarvis March (a.k.a. Gift Wrapping)

An output-sensitive algorithm - runtime depends on the number of convex hull vertices .

JarvisWrap

Runtime

  • Each of the convex hull vertices is found in total.
  • Best case:
  • Worst case:

Local Repair: Towards an Optimal Algorithm

Idea: Start with a polygonal chain that contains all points and is easy to fix. Use local convexity checks to iteratively remove non-convex corners.

Step 1: Start Polygon

Sort the points by increasing x-coordinate . Form the polygon:

This polygon contains all points.

Step 2: Local Convexity Check

For any triple , remove if it lies to the left of the line from to . This is a non-convex corner.

Repeat until all corners are convex ⇒ the resulting polygon is the convex hull.

Efficient Implementation: LocalRepair

This version achieves time total.

LocalRepair

Assume input is sorted by x-coordinate. Use two passes:

  1. Lower Hull (left to right)
  2. Upper Hull (right to left)

Maintain a stack of vertices and check for convexity at each step.

Correctness and Runtime

  • Each vertex is pushed and popped at most once ⇒ operations.
  • Sorting takes , so total time is .
  • This is optimal for comparison-based models.

Lower Bound via Reduction from Sorting

To show a lower bound, consider the following reduction:

Let and define . These lie on the parabola .

Then the convex hull is simply the lower and upper envelope of the parabola.

Sorting ‘s can be recovered from the convex hull ⇒ any convex hull algorithm must take in the worst case.

Handling Degeneracies and Precision

Real implementations must deal with:

  • Duplicate points
  • Collinear points
  • Floating point rounding errors (especially in orientation tests)

Solutions include:

  • Lexicographic sorting to choose canonical starting points.
  • Comparing orientation using robust predicates or exact arithmetic libraries.

Summary

AlgorithmRuntimeOutput-Sensitive?Comments
NaiveNoEducational baseline
Jarvis MarchYesGood for small hulls, easy to program
Local RepairNoOptimal, robust, and practical