Differential Growth

別名: differential line growth、differential mesh growth

単一の作品ではなく実践の窓。差分成長アルゴリズムは、2010年代半ばのコーディング・ コミュニティを通じて生成芸術と計算デザインに入ってきた——葉やサンゴの縁、脳のしわ といった生物的な縁の成長シミュレーションに取り組む Nervous System や Anders Hoff (inconvergent)などと結びつく。不均一に座屈する成長という基礎的モデルはより古く、 発生生物学に由来する。

コミュニティ・通称 名称 — 成長シミュレーションの記述的用語。Anders Hoff(inconvergent) らが生成アートで普及させた。人名エポニムではない。

ひとことで ノード列でできた曲線が周囲の空間が許す以上に伸長し、座屈して折り畳まれる成長シミュレーション。脳のしわや葉・サンゴの縁、地衣類のような有機的形態が生まれる。

Differential growth — a closed path buckling as nodes are inserted · Open in new tab ↗ · Motion begins only when you press Run.

コード

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

differential-growth/index.html
// Differential growth: a closed polyline elongates faster than its space can
// hold, so it buckles. Each step: nodes attract neighbours (cohesion), repel
// nearby nodes (separation), align toward the local midline (smoothing), and
// new nodes are inserted wherever an edge grows too long — surplus length is
// what forces the folding.
const SEED = Math.floor(Math.random() * 1e9);
const PALETTES = [
  ['#f4f1eb', '#1d3557', '#e63946'],
  ['#0d1b2a', '#e0e1dd', '#778da9'],
  ['#fdf0d5', '#003049', '#c1121f'],
  ['#1a181b', '#f6f4f3', '#6a4bb8'],
];
let nodes = [], pal, MAXD = 9, MIND = 4, REP = 22, repF = 0.9, attF = 0.36, alnF = 0.24, MAXN = 2600;

function setup() {
  randomSeed(SEED); noiseSeed(SEED);
  const s = Math.min(windowWidth, windowHeight);
  createCanvas(s, s);
  pal = PALETTES[Math.floor(random(PALETTES.length))];
  const cx = width / 2, cy = height / 2, r = s * 0.06;
  for (let i = 0; i < 28; i++) {
    const a = (i / 28) * TWO_PI;
    nodes.push({ x: cx + Math.cos(a) * r, y: cy + Math.sin(a) * r });
  }
  background(pal[0]);
}

function neighbours(i) {
  const n = nodes.length;
  return [nodes[(i - 1 + n) % n], nodes[(i + 1) % n]];
}

function step() {
  const n = nodes.length;
  const fx = new Float32Array(n), fy = new Float32Array(n);
  for (let i = 0; i < n; i++) {
    const [a, b] = neighbours(i), p = nodes[i];
    // attraction to neighbours (keep the chain continuous)
    fx[i] += ((a.x + b.x) / 2 - p.x) * attF;
    fy[i] += ((a.y + b.y) / 2 - p.y) * attF;
    // alignment toward the straight midline (smooth curvature)
    fx[i] += ((a.x + b.x) / 2 - p.x) * alnF;
    fy[i] += ((a.y + b.y) / 2 - p.y) * alnF;
    // repulsion from any nearby node (prevent self-overlap)
    for (let j = 0; j < n; j++) {
      if (j === i) continue;
      const dx = p.x - nodes[j].x, dy = p.y - nodes[j].y;
      const d2 = dx * dx + dy * dy;
      if (d2 > 0 && d2 < REP * REP) {
        const d = Math.sqrt(d2), w = (1 - d / REP) * repF;
        fx[i] += (dx / d) * w; fy[i] += (dy / d) * w;
      }
    }
  }
  for (let i = 0; i < n; i++) { nodes[i].x += fx[i]; nodes[i].y += fy[i]; }
  // growth: split edges that have stretched beyond MAXD
  if (nodes.length < MAXN) {
    for (let i = nodes.length - 1; i >= 0; i--) {
      const a = nodes[i], b = nodes[(i + 1) % nodes.length];
      if (Math.hypot(a.x - b.x, a.y - b.y) > MAXD) {
        nodes.splice(i + 1, 0, { x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 });
      }
    }
  }
}

function draw() {
  for (let k = 0; k < 3; k++) step();
  background(pal[0] + 'cc');
  noFill();
  stroke(pal[1]); strokeWeight(1.4);
  beginShape();
  for (const p of nodes) curveVertex(p.x, p.y);
  for (let i = 0; i < 3; i++) curveVertex(nodes[i].x, nodes[i].y);
  endShape();
  if (nodes.length >= MAXN) noLoop();
}

デモのソースを開く ↗

仕組み

ノードに「近傍への引力」「近接ノードからの斥力」「直線化(平滑化)」の力を加え、辺が長くなった箇所に新ノードを挿入して成長させる。詰め込めない余剰長が座屈を生む。

パラメータ

系譜

関連
Reaction-Diffusion、Boids / Flocking

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

Floraform
jessica-rosenkrantz

最終更新 2026-07-16