VorVoronoi Diagram

Mathematical & Geometric · Scale 3

Voronoi Diagram

Scatter seeds on a canvas and give each one the part that is nearer to it than to any other seed. The cells that result are a Voronoi diagram.

What it is

A Voronoi diagram starts from a set of points, called seeds. Each seed takes the part of the canvas that is nearer to it than to any other seed. The canvas ends up divided into cells, one for each seed.

The seeds decide the picture. On these plates they sit on a sunflower spiral: the first at the centre, each next one turned by the golden angle (about 137.5 degrees) and set a little further out, which spreads them evenly. That rule has a cell of its own. See the Phyllotaxis cell →

The plates

Four plates, and one number changes between them: the number of seeds. The labels are round numbers. The plates keep only the seeds that land on the canvas: 121, 396, 995 and 2,380. Each cell is toned by its seed's distance from the letters, and the borders between cells are drawn as thin lines.

Safari stop · Nearest seed wins · Number of seeds
  • 120

  • 400

  • 1,000

  • 2,400

Turn the dial on the safari →

One more plate, from the stop where two families are crossed. Here 571 seeds own their cells as before, and each cell takes one flat tone from the height of a field of smooth random hills at its centre.

Safari stop · Two families, crossed
  • sunflower + hills

Turn the dial on the safari →

The plates are drawn by mosaic, a small Python library of our own, built on numpy, scipy, shapely and contourpy. No image model is involved, and each plate is a flat-colour SVG under 45 KB. The word Ciao is the safari's constant: it sits in the same place on every plate.

What we did and found

We first drew the cells with scipy's Voronoi. In a test with 64 seeds it returned 13 of the cells as unbounded, meaning they run off to infinity and have no closed outline. It has no mode that clips them to the canvas, and dropping them lost 25% of the canvas area.

It also gave two seeds at the same point a single cell, with no warning.

We now use shapely's version, clipped to the canvas, and our code refuses coincident seeds.

We also tried Lloyd relaxation, which moves each seed to the centre of its cell and repeats. In one trial the smallest cell went from 0.25 of the mean to 0.79 of the mean.

What is open

Lloyd relaxation is measured and unused: no plate here has it. The seeds on these plates come only from a sunflower spiral.

mosaic is not yet part of Platypus, our visuals engine. That is why this cell is marked as working and not as shipped: the page is our notebook on the element.

Composes with

Other cells in the table — most still to be walked into in coming sessions.