Circle Packing

単一の起源作品はない。円充填は古典幾何学(古代のアポロニウスのギャスケット、 1643年のデカルトの円定理)であり、生成芸術における形(重なりのない円を成長・棄却で 詰め、しばしば画像で重み付けする)は、年代を特定できる「最初」ではなく、コーディング・ コミュニティに散在するパターンである。

コミュニティ・通称 名称 — 命名・エポニムではなく記述的なカテゴリ名。用語の単一の命名者は確認されていない。

ひとことで 重なりなく円をランダムに詰める。サイズ可変・最近接探索 + 棄却法で実装されることが多い。

Circle Packing · Open in new tab ↗ · Motion begins only when you press Run.

コード

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

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

function setup() {
  randomSeed(SEED);
  const s = Math.min(windowWidth, windowHeight);
  createCanvas(s, s);
  background('#f0ede4');
  noFill();
  strokeWeight(1.5);

  // Random-rejection circle packing.
  // For each attempt: sample a radius from a heavy-tail distribution,
  // sample a center, accept if it overlaps none of the previously placed.
  const placed = [];
  const MAX_PLACED = 320;
  const MAX_ATTEMPTS = 40000;
  const palette = ['#1a1a1a', '#c1502e', '#1f4068', '#e2a829', '#3a7d44'];

  let attempts = 0;
  while (placed.length < MAX_PLACED && attempts < MAX_ATTEMPTS) {
    attempts++;
    // bias toward smaller radii
    const u = random();
    const r = lerp(s * 0.004, s * 0.08, u * u * u);
    const x = random(r, width - r);
    const y = random(r, height - r);

    let ok = true;
    for (let i = 0; i < placed.length; i++) {
      const c = placed[i];
      const dx = x - c.x, dy = y - c.y;
      if (dx*dx + dy*dy < (r + c.r) * (r + c.r)) { ok = false; break; }
    }
    if (!ok) continue;

    stroke(palette[(placed.length) % palette.length]);
    circle(x, y, r * 2);
    placed.push({ x, y, r });
  }
}

デモのソースを開く ↗

仕組み

よくある「成長」法:(1) ランダム位置に候補円を置き(既存円と重なる/領域外なら棄却)、(2) 採用した円を毎フレーム少しずつ拡大し、他の円か境界に接した瞬間に停止、(3) 残った隙間へ候補を追加し続け、領域が埋まるか試行回数を使い切るまで繰り返す。空間グリッドや最近接構造で重なり判定を高速化。画像の明度で円サイズを重み付けすれば点描/肖像になり、位置緩和で密な詰め込み(アポロニウス的)も作れる。

パラメータ

系譜

先行例
Jared Tarbell
関連
Poisson Disk Sampling、Voronoi Diagram

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

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

Breathe You
raregonzo
Coalition
generative-artworks
Daisies
natthakit-susanthitanon-nsmag
Figments
amber-vittoria
Octo Garden
rich-lord
Organized Disruption
joshua-davis
Paramecircle
alexander-reben
Pizza 1o1
kala
Proscenium
remnynt
Scatter Process[or]
kelly-milligan
Structures
hevey
Thereidoscope
daim-aggott-honsch

最終更新 2026-07-16