Voronoi Diagram

別名: Dirichlet tessellation、Thiessen polygons

初出 1908 · Georgy Voronoy — Georgy Voronoy (1908); related Dirichlet tessellation, 1850. · 年表 ↗

第三者・冠名 名称 — Voronoy 本人ではなく後世の数学者が与えたエポニム(Stigler の法則の典型)。同じ分割は Dirichlet がより早く研究し(1850、「Dirichlet 分割」)、多くの名で再発見された。 「Voronoi」は Voronoy の 1908 年の扱いにちなむ。命名者・命名年は本調査では未確定。

ひとことで 平面上の点集合に対し、各点に最も近い領域を割り当てて分割する図。セル状の模様・有機的なタイリングに使われる。

Voronoi Diagram · Open in new tab ↗ · Motion begins only when you press Run.

コード

上のデモの実際のスケッチ(サンドボックスで再現可能)。これで全部です。

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

function setup() {
  randomSeed(SEED);
  const s = Math.min(windowWidth, windowHeight);
  createCanvas(s, s);
  noStroke();

  // Brute-force per-pixel Voronoi for clarity (O(N·W·H)).
  // Use a small canvas + scale up to keep it fast.
  const W = 240;
  const cnv = createGraphics(W, W);
  cnv.pixelDensity(1);

  const N = 28;
  const sites = Array.from({ length: N }, () => ({
    x: random(W), y: random(W),
    c: [random(40, 230), random(40, 230), random(40, 230)],
  }));

  cnv.loadPixels();
  for (let y = 0; y < W; y++) {
    for (let x = 0; x < W; x++) {
      let best = 0, bestD = Infinity;
      for (let i = 0; i < N; i++) {
        const dx = x - sites[i].x;
        const dy = y - sites[i].y;
        const d = dx*dx + dy*dy;
        if (d < bestD) { bestD = d; best = i; }
      }
      const idx = 4 * (y * W + x);
      const c = sites[best].c;
      cnv.pixels[idx]   = c[0];
      cnv.pixels[idx+1] = c[1];
      cnv.pixels[idx+2] = c[2];
      cnv.pixels[idx+3] = 255;
    }
  }
  cnv.updatePixels();

  noSmooth();
  image(cnv, 0, 0, width, height);

  // Overlay site markers.
  fill(0); noStroke();
  const r = width / W;
  for (const p of sites) circle(p.x * r, p.y * r, width * 0.008);
}

デモのソースを開く ↗

仕組み

あるサイトのボロノイ領域とは、他のどのサイトよりもそのサイトに近い点の集合。境界は隣接サイトの垂直二等分線上にあり、3 つ以上のサイトから等距離の点が頂点になる。計算法は、各ピクセルで最近傍サイトを探す総当たり、Fortune のスイープライン法(O(n log n))、Delaunay 三角形分割の双対(隣接三角形の外心を結ぶ)など。距離に重みを付ければ重み付きボロノイになる。

パラメータ

系譜

関連
Delaunay Triangulation、Poisson Disk Sampling、Circle Packing、Polygon Mosaic

よく組み合わされるアルゴリズム

このアルゴリズムを使う作品 (9)

Autology
steganon
Cytographia
golan-levin
Ego Death
electralina
Gen 3
dca
Human Unreadable
operator
Lacunae
james-dalessandro
Low Tide
artem-verkhovskiy-x-andy-shaw
Material Violence
jeres
Metropolis
mpkoz

最終更新 2026-07-16