Voronoi diagrams and Delaunay triangulation explained
Mark the post offices of a town on a map and colour every street by the nearest one: the coloured regions form a Voronoi diagram. Draw a line between every two post offices whose regions touch and the lines form a Delaunay triangulation. These two structures, each the shadow of the other, are among the most useful in computational geometry. This page explains what they are, why they belong together and how they are computed.
Nearest-site regions
Given a set of sites, the Voronoi cell of a site is every point that is at least as close to it as to any other site. The boundary between two cells lies on the perpendicular bisector of the two sites, so every cell is an intersection of half-planes and therefore a convex polygon, unbounded for the sites on the convex hull. The diagram answers nearest-neighbour questions at a glance: which post office serves a street, which mast a phone talks to, which school is closest. Meteorologists call the cells Thiessen polygons and use them to average rainfall from gauges, and similar patterns appear in giraffe skin, dragonfly wings and dried mud.
The dual: the Delaunay triangulation
Join every two sites whose cells share an edge. When no four sites lie on one circle, the result is a triangulation of the convex hull of the sites, named after Boris Delaunay, who described it in 1934. Each Voronoi vertex is equally far from three sites, so it is the centre of a circle through them that contains no other site: the circumcircle of a Delaunay triangle. Each Voronoi edge lies on a perpendicular bisector and crosses its Delaunay edge at right angles. A triangulation of n sites with h of them on the hull has 2n − 2 − h triangles and 3n − 3 − h edges, so both structures grow only linearly with n.
Empty circles and wide angles
The defining property is the empty circle: the circumcircle of every Delaunay triangle has no site strictly inside it. Equivalently, every edge is locally Delaunay: of two triangles that share an edge, each one's far corner lies outside the other's circumcircle. A beautiful consequence is that among all the ways to triangulate the same points, the Delaunay triangulation maximises the smallest angle. That makes it the starting point for finite element meshes, terrain models built from scattered heights and interpolation, where thin triangles cause large errors. Another view: lift every site (x, y) onto the paraboloid z = x² + y²; the faces of the lower convex hull of the lifted points, projected back down, are the Delaunay triangles.
The in-circle test and exact arithmetic
Two tests carry everything. The orientation test asks whether c lies to the left of the line from a to b, the sign of a 2 × 2 determinant. The in-circle test asks whether d lies inside the circle through a, b and c, taken counterclockwise: the sign of the 3 × 3 determinant whose rows are (ax − dx, ay − dy, (ax − dx)² + (ay − dy)²) and the same for b and c, which is the orientation test one dimension up, on the paraboloid. In floating point both can return the wrong sign for nearly degenerate points, and triangulation programs then crash or produce overlapping triangles. Robust programs use exact or adaptive arithmetic, such as Jonathan Shewchuk's predicates. The app keeps every coordinate a whole number below a few thousand, so both determinants are exact in ordinary double precision, and it treats a point exactly on a circle as outside, so even a perfect grid of cocircular points is triangulated without trouble.
Bowyer–Watson insertion
Adrian Bowyer and David Watson published this incremental algorithm independently in 1981. It begins with a super-triangle that contains all the sites. To insert a point, find the triangle that holds it, for example by walking across the triangulation towards it with orientation tests, then search outwards through the neighbouring triangles for every triangle whose circumcircle contains the point. These bad triangles always form one connected, star-shaped region round the point. Deleting them leaves a polygonal hole, and joining the point to every edge of the hole gives the Delaunay triangulation of the points so far. At the end, the triangles that use a corner of the super-triangle are deleted. The corners must be far enough away not to disturb the real triangles: the app puts them 10¹² grid steps away and evaluates the tests that involve them with big integers.
Edge flips and Fortune's sweep
Charles Lawson's flip algorithm (1977) starts from any triangulation and repeatedly takes an illegal edge, one whose quadrilateral has the fourth point inside a circumcircle, and replaces it with the other diagonal. Each flip raises the smallest angle of the pair, so the process cannot cycle, and it ends with the Delaunay triangulation after at most O(n²) flips. Many incremental programs insert a point the simple way and then flip to restore the property. Steven Fortune's sweep-line algorithm (1986) builds the Voronoi diagram directly in O(n log n) time: a line sweeps across the plane, and the points equally far from the line and from the sites already passed form a beach line of parabolic arcs, whose meeting points trace out the Voronoi edges.
Lloyd relaxation
Moving each site to the centroid of its Voronoi cell and computing the diagram again is Lloyd's algorithm, devised by Stuart Lloyd at Bell Labs in 1957 for quantising signals and published in 1982. It never increases the energy, the integral over every cell of the squared distance to its site, and it converges to a centroidal Voronoi tessellation, in which every site is the centroid of its own cell. Inside the region the cells become nearly regular hexagons, like a honeycomb. Artists use it for stippling, mesh generators use it to spread points evenly, and k-means clustering is the same idea applied to a finite set of data points.
From cholera to cell towers
In 1854 cholera killed more than 600 people around Broad Street in Soho, London. John Snow marked the deaths on a map and showed that they surrounded the Broad Street water pump, and a later version of his map drew the boundary of the area closer, on foot, to that pump than to any other: a Voronoi cell measured along the streets. The pump's handle was removed. Today the same regions decide which mast serves a phone and which fire station answers a call, and robots plan routes along Voronoi edges because they keep as far as possible from obstacles.
Frequently asked questions
Why is the Delaunay triangulation not always unique?
When four or more sites lie on one circle, the empty circle property cannot choose between the diagonals of the quadrilateral they form: both triangulations have empty circumcircles, and the Voronoi diagram has a vertex where four or more cells meet. A perfect square grid is the classic example. Any choice is a valid Delaunay triangulation; the app keeps a triangle when the new point lies exactly on its circle.
What is the super-triangle in Bowyer–Watson?
A large triangle added at the start so that every point to be inserted lies inside an existing triangle. Its three corners are not real sites, and every triangle that uses one of them is removed at the end. If the corners are too close they can steal edges from the convex hull, so robust programs either put them very far away, as the app does, or treat them as points at infinity.
How is the Voronoi diagram drawn from the triangulation?
Compute the circumcentre of every Delaunay triangle: these are the Voronoi vertices. For every Delaunay edge shared by two triangles, join their circumcentres; for an edge on the convex hull, draw a ray from the circumcentre outwards, at right angles to the edge. The app also builds each cell directly by cutting the field with the perpendicular bisectors to the site's Delaunay neighbours, which gives the coloured polygons.
Does Lloyd's algorithm always converge?
The energy falls at every step and cannot go below zero, so it settles, in practice on a centroidal Voronoi tessellation that is a local minimum of the energy, not always the best one. The first few iterations do most of the work: the app shows the energy falling on a chart and stops when no site moves by more than a grid step, or after 60 iterations.
Ready to try it?
Open PictorX in your browser — no install, no credit card required to start.
Open the Voronoi and Delaunay app