Computational geometry

Voronoi Diagrams From First Principles

How one nearest-site rule turns distance tests into cells, edges, and local competitors.

First draft. Geometry before algorithms, lifting, and language-model analogies.

Put four clinics on a city map and impose one rule: every address is served by the clinic closest to it. The rule is local. It only talks about one address at a time. Applied everywhere, it forces the whole map to break into territories.

The Local Rule

Start with two clinics, p and q. The addresses tied between them are exactly the points x where the distance to p equals the distance to q.

||x - p|| = ||x - q||

Squaring both sides removes the square roots. After expansion, the x.x terms cancel. What remains is linear in x, so the tie set is a line: the perpendicular bisector of the segment from p to q. One side belongs to p; the other belongs to q.

Interactive Figure 1. Nearest-Site Probe Move the sample point and switch focus sites to see how the nearest-site rule assigns territory.
Interactive Figure 1. Nearest-Site ProbeVoronoi cells for five sites with a movable sample point and a line to the nearest site.pqrst
Focus site

Focus cell: pNearest site: p

Figure 1. Cell Carving Sequence A Voronoi cell is the intersection of every half-plane where its site beats one competitor.
Four panels show the territory of site p shrinking as competitors q, r, s, and t add half-plane cuts until the final Voronoi cell remains.

Cells Are Intersections

Adding a third clinic does not change the rule. It adds another contest. The region for p must lie on the p-side of the bisector between p and q, and also on the p-side of the bisector between p and r. Every new site contributes one more half-plane.

V(p_i) = {x : ||x - p_i|| <= ||x - p_j|| for every j != i}

That expression is the whole cell. A half-plane is convex, and an intersection of convex sets stays convex. A Voronoi cell can be unbounded, but it cannot have a dent. The boundary may run forever for a site on the outside of the point set; it still remains a convex polygonal chain.

Local Neighbors

Stand at a point where three cells meet. If the tied sites are p, q, and r, then the point is equally far from all three sites.

||x - p|| = ||x - q|| = ||x - r||

So there is a circle centered at x passing through p, q, and r. No other site can sit inside that circle. If one did, it would be closer to x than the three tied sites, and the three-way boundary point would disappear.

Connect two sites whenever their Voronoi cells share an edge. The resulting graph is the Delaunay graph. The Voronoi diagram organizes territory; the Delaunay graph records which sites are genuine local competitors.

Interactive Figure 2. Empty Circle and Delaunay Neighbors Switch the focus site or empty circle to see which shared Voronoi borders become Delaunay neighbor edges.
Interactive Figure 2. Empty Circle and Delaunay NeighborsVoronoi cells, Delaunay neighbor edges, and an empty circle through one selected Delaunay triangle.pqrstu
Focus site
Empty circle

Focus site: pNeighbors: q, r, t, uEmpty circle: p-q-rInside circle: 0

Sparse Structure

The definition talks about every pair of sites, but the final diagram keeps only local rivalries. In a generic planar input with n sites and h sites on the convex hull, the Delaunay triangulation has 3n - 3 - h edges and 2n - 2 - h triangles.

Duality transfers those counts back to the Voronoi diagram. Voronoi edges correspond to Delaunay edges, and Voronoi vertices correspond to Delaunay triangles. Since h >= 3, the planar Voronoi diagram has at most 3n - 6 edges and 2n - 5 vertices. The all-pairs rule collapses to a linear-size structure.

Computing the Whole Diagram

A direct cell-by-cell implementation is tempting: intersect the half-planes for one site, then repeat for every site. The mathematics is correct, but the computation is organized around polygons that are not independent. A shared edge or vertex can be rounded differently by neighboring cells, so locally plausible pieces may fail to glue into one diagram.

The standard algorithms keep the shared structure shared. Fortune’s algorithm sweeps a line across the sites and updates a beach line of parabolic arcs. The combinatorics change only at site events, where a new arc appears, and circle events, where a disappearing arc creates a Voronoi vertex.

The Delaunay-side view does the same repair through local adjacency. Insert a new site into the current triangulation, mark nearby edges as suspect, and apply one empty-circle test. Edges that pass are kept; edges that fail are flipped. Once the triangulation is locally Delaunay everywhere, the Voronoi diagram is its dual.

Figure 3. Algorithm Walkthroughs Fortune's sweep line updates the beach line at events; Delaunay insertion repairs only local edges that fail the empty-circle test.
Six panels compare Fortune sweep-line events with Delaunay insertion, suspect-edge testing, and local edge flips.