A Voronoi diagram partitions a plane into regions, one per "seed" point, so that every location in a region is closer to its own seed than to any other. The cell boundaries are exactly the set of points equidistant from two neighbouring seeds. Lloyd's relaxation is a simple iterative algorithm: compute the Voronoi diagram, move each seed to the centroid (centre of mass) of its own cell, and repeat. Over successive iterations the cells become more uniform in size and shape, converging toward a centroidal Voronoi tessellation — the honeycomb-like pattern this algorithm is famous for.
Lloyd's algorithm (Stuart Lloyd, 1957, originally for signal quantization) is the same idea behind k-means clustering, mesh generation for finite-element simulation, and the stippling techniques artists use to place dots evenly across an image.
A field of draggable seed points tessellates a 3D slab into colored Voronoi cells; running Lloyd's relaxation repeatedly moves each seed to its own cell's centroid, smoothing the pattern into an even, honeycomb-like tessellation.
A Voronoi cell is the set of points closer to one seed than to any other; its boundary is where two seeds are equidistant. Lloyd's algorithm iteratively relocates each seed to its cell's centroid, converging toward a centroidal Voronoi tessellation.
Set the seed count, then drag any glowing pillar to reshape the diagram by hand. Press "Relax 1 step" or "Auto-relax" to watch the cells even out, and toggle centroid markers and cell edges to inspect the geometry.
Lloyd's relaxation, invented in 1957 for signal quantization, is the same core idea behind k-means clustering, finite-element mesh generation, and evenly-spaced stippling patterns in generative art.