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/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 三角形分割の双対(隣接三角形の外心を結ぶ)など。距離に重みを付ければ重み付きボロノイになる。
パラメータ
siteCount: number — Number of seed points; each site defines one cell.distanceMetric: string — Distance function assigning points to the nearest site (Euclidean, Manhattan, Chebyshev).relaxation: number — Lloyd-relaxation iterations that even out cell sizes by moving each site to its cell centroid.
系譜
よく組み合わされるアルゴリズム
- Fragment Shader (GLSL) · 5 作品
- Perlin / Simplex Noise · 5 作品
- Flow Field / Vector Field · 4 作品
- Bezier / Catmull-Rom Splines · 4 作品
- HSL / Hue Cycle · 3 作品
- Marching Squares / Contours · 2 作品
- Delaunay Triangulation · 2 作品
- Quadtree / Recursive Quad Split · 2 作品
- Raymarching with SDFs · 2 作品
- Plotter-style Hatching · 2 作品
- Particle System · 2 作品
- Boids / Flocking · 1 作品
このアルゴリズムを使う作品 (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