Delaunay Triangulation

First appeared 1934 · Boris Delaunay — Boris Delaunay (1934). · timeline ↗

third-party / eponym Name — Eponym for Boris Delaunay (1934), applied by later authors — the dual of the Voronoi diagram and the same third-party eponym pattern.

In one line A triangulation of a point set in which no point lies inside the circumcircle of any triangle — maximising the minimum angle to avoid slivers. The dual of the Voronoi diagram; a basis for terrain meshes and polygon art.

Delaunay Triangulation · Open in new tab ↗ · Motion begins only when you press Run.

The code

The actual sketch behind the demo above — sandboxed and reproducible. This is the whole thing.

delaunay/index.html
const SEED = Math.floor(Math.random()*1e9);

// Bowyer-Watson Delaunay triangulation of random points, drawn as a
// wireframe mesh with vertices marked.
function setup() {
  randomSeed(SEED);
  const s = Math.min(windowWidth, windowHeight);
  createCanvas(s, s);
  background('#0a0a0a');

  const N = 90;
  const pts = [];
  for (let i = 0; i < N; i++) pts.push({ x: random(s * 0.04, s * 0.96), y: random(s * 0.04, s * 0.96) });

  const tris = triangulate(pts, s);

  stroke(90, 200, 230, 150);
  strokeWeight(s * 0.0015);
  noFill();
  for (const t of tris) {
    triangle(t[0].x, t[0].y, t[1].x, t[1].y, t[2].x, t[2].y);
  }
  noStroke();
  fill('#7be0ff');
  for (const p of pts) circle(p.x, p.y, s * 0.006);
}

function circumcircle(a, b, c) {
  const ad = a.x*a.x + a.y*a.y, bd = b.x*b.x + b.y*b.y, cd = c.x*c.x + c.y*c.y;
  const D = 2 * (a.x*(b.y-c.y) + b.x*(c.y-a.y) + c.x*(a.y-b.y));
  if (Math.abs(D) < 1e-9) return null;
  const ux = (ad*(b.y-c.y) + bd*(c.y-a.y) + cd*(a.y-b.y)) / D;
  const uy = (ad*(c.x-b.x) + bd*(a.x-c.x) + cd*(b.x-a.x)) / D;
  const dx = a.x - ux, dy = a.y - uy;
  return { x: ux, y: uy, r2: dx*dx + dy*dy };
}

function triangulate(points, s) {
  // super-triangle
  const st = [{ x: -s*5, y: -s*5 }, { x: s*5, y: -s*5 }, { x: s/2, y: s*10 }];
  let tris = [[st[0], st[1], st[2]]];

  for (const p of points) {
    const bad = [];
    for (const t of tris) {
      const cc = circumcircle(t[0], t[1], t[2]);
      if (cc) {
        const dx = p.x - cc.x, dy = p.y - cc.y;
        if (dx*dx + dy*dy < cc.r2) bad.push(t);
      }
    }
    // boundary of the polygonal hole
    const edges = [];
    for (const t of bad) {
      const e = [[t[0], t[1]], [t[1], t[2]], [t[2], t[0]]];
      for (const ed of e) {
        const shared = bad.some((o) => o !== t && hasEdge(o, ed));
        if (!shared) edges.push(ed);
      }
    }
    tris = tris.filter((t) => !bad.includes(t));
    for (const ed of edges) tris.push([ed[0], ed[1], p]);
  }
  // drop triangles touching the super-triangle
  return tris.filter((t) => !t.some((v) => st.includes(v)));
}

function hasEdge(tri, ed) {
  const e = [[tri[0], tri[1]], [tri[1], tri[2]], [tri[2], tri[0]]];
  return e.some(([a, b]) => (a === ed[0] && b === ed[1]) || (a === ed[1] && b === ed[0]));
}

Open the demo source ↗

How it works

The defining "empty circumcircle" property: a triangulation is Delaunay iff no vertex falls inside the circumscribed circle of any triangle. Common methods: 1. Incremental insertion: add points one at a time; when a new point lands inside existing circumcircles, delete those triangles and re-triangulate the resulting hole (Bowyer–Watson). 2. Edge flipping: start from any triangulation and flip any shared edge whose two triangles violate the empty-circle test, until none remain. 3. Divide and conquer / sweepline for O(n log n). Connecting the circumcentres of adjacent triangles yields the dual Voronoi diagram.

Lineage

Related
Voronoi Diagram, 3D Mesh / Geometry

Frequently combined with

Works using this algorithm (8)

Alien DNA
shvembldr
Cytographia
golan-levin
entretiempos
marcelo-soria-rodriguez
Gen 3
dca
glitch crystal monsters
alida-sun
Murano Fantasy
pandelune
Origami Dream
k0ch
Seadragons
marcin-ignac

Last updated 2026-07-16