Sites
Triangles
In-circle tests
Smallest angle
Points
Playback
View

More information about Voronoi diagrams and Delaunay triangulation

Nearest sites, empty circles

Give every point of a map to the nearest site and the plane falls apart into Voronoi cells: the area each post office serves, the coverage of each cell tower, the pumps of John Snow's cholera map. Join the sites whose cells touch and you get the Delaunay triangulation, whose circumcircles are all empty and whose angles are as wide as possible. Watch the Bowyer–Watson algorithm build it one point at a time, flip a poor triangulation into shape and let Lloyd's relaxation spread the sites evenly. Every point of the plane belongs to the nearest site: those regions are the Voronoi cells, and joining the sites whose cells touch gives the Delaunay triangulation. Press Play to watch Bowyer–Watson build it: a super-triangle holds everything, each new point finds the triangle it falls in, then every triangle whose circumcircle contains it (red circles: bad, green: they stay), the bad triangles are removed to leave a polygonal hole, and the hole is filled with triangles from the new point; at the end the triangles on the super-triangle's corners are removed. Lawson flips starts from a poor triangulation and flips every illegal edge, whose opposite point lies inside a circumcircle, until none is left; the smallest angle grows. Lloyd relaxation moves every site to the centroid of its cell, again and again, and the energy on the chart falls until the cells are centroidal. Click to add a site, drag sites (everything follows), double-click one to delete it. Turn on the empty circle test and drag the circle: the largest empty circle at its centre touches one site inside a cell, two on a Voronoi edge (a Delaunay edge) and three at a Voronoi vertex (the circumcircle of a Delaunay triangle). The information panel shows each in-circle test with its sign. Save image, record a video with a click per insertion or flip, or open the picture in the photo editor with the pencil, where the cells, the edges, the triangles, the circles, the sites and the labels are layers of their own.

Як це працює

  1. Press Play: Bowyer–Watson inserts the sites one at a time; each in-circle test draws its circumcircle, red when the new point is inside and green when it is not, and the information panel shows its sign.
  2. Click to add sites, drag them and everything follows live, double-click one to delete it; or pick an example such as Poisson disc, the cholera pumps or 500 points.
  3. Switch the method to Lawson flips to repair a poor triangulation edge by edge, or to Lloyd relaxation to move every site to the centroid of its cell, with the energy on a chart.
  4. Turn on the empty circle test and drag the circle: it touches one site inside a cell, two on a Voronoi edge and three at a Voronoi vertex.

Voronoi cells and their dual

The Voronoi cell of a site is the set of points closer to it than to any other site. Each cell is a convex polygon cut out by the perpendicular bisectors between the site and its neighbours, and three or more cells meet at a Voronoi vertex, which is equally far from three sites. Draw a segment between every two sites whose cells share an edge and you get the Delaunay triangulation: every Voronoi vertex is the circumcentre of a Delaunay triangle, and every Voronoi edge crosses its Delaunay edge at right angles. Either structure gives the other.

The empty circle and the widest angles

A triangulation is Delaunay when the circumcircle of every triangle contains no other site. Boris Delaunay proved in 1934 that such a triangulation always exists, and it is unique when no four sites lie on one circle. Of all the triangulations of the same points it maximises the smallest angle, so it avoids long thin slivers, which is why meshes for simulations, terrain models and computer graphics are built from it. The in-circle test, the sign of a 3 × 3 determinant, decides whether a point lies inside the circle through three others.

Bowyer–Watson, one point at a time

Adrian Bowyer and David Watson published the same algorithm independently in 1981. Start with a super-triangle large enough to hold every site, then insert the sites one by one: find the triangle the new point falls in, then every triangle whose circumcircle contains the point. These bad triangles form a star-shaped polygon round it; remove them and join the new point to every edge of the hole. When all the sites are in, delete the triangles that touch the super-triangle's corners. With a good way to locate the points, inserting them in random order takes O(n log n) time on average.

Lawson flips and Lloyd relaxation

Charles Lawson showed in 1977 that any triangulation can be turned into the Delaunay one by flipping edges: an edge between two triangles is illegal when the fourth point lies inside a circumcircle, and replacing it with the other diagonal of the quadrilateral raises the smallest of the six angles. Lloyd's algorithm, devised by Stuart Lloyd in 1957 for quantising signals, moves every site to the centroid of its Voronoi cell and repeats; the energy, the mean squared distance from each point to its site, falls at every step, and the sites settle into a centroidal Voronoi tessellation of nearly regular hexagons.

Поширені запитання

What is a Voronoi diagram?

A division of the plane into regions, one per site, where each region holds the points that are closer to that site than to any other. The regions are convex polygons bounded by perpendicular bisectors. They are named after Georgy Voronoi, who studied them in 1908, but Descartes sketched them in 1644, and they are also called Dirichlet tessellations or Thiessen polygons.

How are the Voronoi diagram and the Delaunay triangulation related?

They are duals. Each Delaunay edge joins two sites whose Voronoi cells share an edge, each Delaunay triangle belongs to the Voronoi vertex at its circumcentre, and each Voronoi edge is perpendicular to the Delaunay edge it crosses. The app draws both from one triangulation: the Voronoi edges join the circumcentres of neighbouring triangles.

How does the Bowyer–Watson algorithm work?

It adds the points one by one to a triangulation that starts as one big super-triangle. For each new point it finds the triangles whose circumcircle contains it, removes them and connects the point to every edge of the polygonal hole they leave. After the last point, the triangles that use a corner of the super-triangle are removed. Each insertion keeps the triangulation Delaunay.

Why does the app need exact arithmetic?

The orientation and in-circle tests are signs of determinants. In floating point, rounding can flip the sign when points are nearly in line or nearly on one circle, and a triangulation program can then make overlapping triangles or loop forever. The app gives every site whole-number coordinates small enough for the determinants to be exact, and computes the tests that involve the far-away super-triangle with big integers.

What did John Snow's cholera map show?

During the cholera outbreak in Soho, London, in 1854, John Snow marked each death on a street map and showed that the deaths clustered round the water pump on Broad Street; the region nearest each pump, a Voronoi cell, makes the pattern plain. The pump's handle was removed and the outbreak faded. The app's map is stylised, with made-up cases, not Snow's data.

Can I use the picture?

Yes. Save gives a PNG at the size you choose, Save JSON writes the sites, the triangles, the Voronoi cells and the counts, Record films the construction with its clicks, and the pencil opens the picture in the PictorX photo editor with the background, the Voronoi cells, the Voronoi edges, the Delaunay triangles, the circumcircles, the points and the labels on layers of their own. In the editor itself it is under Apps ▸ Science ▸ Computing ▸ Voronoi & Delaunay. Everything runs in your browser.

Voronoi Diagrams & Delaunay Triangulation: як записати відео?

Натисніть червону кнопку «Запис» на панелі відтворення: вона знімає те, що показує сцена. Натисніть її ще раз, щоб зупинити, і відео збережеться на вашому пристрої. Запис безкоштовний, потрібно лише увійти. Без підписки на відео в куті буде невеликий логотип PictorX. Кнопка поруч із «Запис» відкриває параметри відео: формат (як показано, квадрат, сторіз 9:16 або широкий 16:9), тривалість (доки ви не зупините, або 5, 10, 15 чи 30 секунд для соцмереж) і файл: MP4, WebM або анімований GIF. Для звуку виберіть власні звуки застосунку або одну з трьох музичних доріжок: спокійну, яскраву чи ритмічну.

Готові спробувати?

Відкрийте PictorX у браузері — без встановлення і без кредитної картки.

Перейти до редактора