Tap or click to drop a new seed. Drag a seed to move it.
About this
Scatter a handful of points — call them seeds — over any flat surface, and ask every other point on that surface the same question: which seed is closest? Colour each point by the answer and the surface splits into cells, one per seed, each cell holding exactly the territory that seed is nearest to. That partition is a Voronoi diagram, named for the mathematician who studied it in 1908, though the idea is older: Descartes sketched something like it for the solar system in 1644, and it shows up on its own wherever growth starts from scattered points and spreads outward at an even rate — crystals forming in a melt, bark splitting as a tree trunk thickens, territory claimed by neighbouring root systems.
Here each cell is filled with the average colour of the photo underneath it, and a thin dark line — leading, in the stained-glass sense — is drawn wherever two cells meet. Add more seeds and the panels shrink and pick up finer detail; pull one seed across the image and watch its neighbours' borders bow out of its way, because a border is always exactly halfway between the two seeds that share it.
Click Relax once and every seed jumps to the centre of mass of the pixels it currently owns, then the diagram is rebuilt from the new positions. That single move is Lloyd's algorithm, and it has a strange effect: scattered, random-looking cells drift, generation by generation, toward a tiling of nearly equal hexagons — the same shape bees arrive at independently, because a hexagon is the most efficient way to divide a plane into equal-area cells with the least total wall. Keep clicking and the average distance each seed moves per step keeps shrinking, because a fully relaxed arrangement is a fixed point: once every seed sits exactly at its own cell's centre, relaxing it again moves it nowhere.