Differential Growth

also: differential line growth, differential mesh growth

A practice window rather than a single work. The differential-growth algorithm entered generative art and computational design through the mid-2010s coding community — associated with studios and coders working on growth simulations of biological margins (leaf and coral edges, brain folds) such as Nervous System and Anders Hoff (inconvergent). The underlying model of uneven, buckling growth is older, drawn from developmental biology.

community / folk Name — A descriptive term for the growth simulation, popularized in generative art by Anders Hoff (inconvergent) and others; no personal eponym.

In one line A growth simulation in which a connected path of nodes elongates faster than its surrounding space can accommodate, forcing it to buckle and fold. The result mimics natural forms produced by uneven growth — brain folds, leaf and coral margins, lichen, and convoluted membranes.

Differential growth — a closed path buckling as nodes are inserted · 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.

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();
}

Open the demo source ↗

How it works

Represent the form as a path of nodes joined by edges (often a closed loop). Each step, sum a few simple forces per node: - Attraction: pull each node toward the midpoint of its two neighbours so the chain stays continuous. - Repulsion: push each node away from any other node within a repulsion radius, preventing the path from overlapping itself. - Alignment: nudge each node toward the straight line between its neighbours, smoothing local curvature. Then grow: wherever an edge has stretched beyond a maximum length, insert a new node at its midpoint. This injected surplus length is what the repulsion cannot pack into the available space, so the path is forced to fold. The ratio of repulsion radius to edge length is the dominant aesthetic control — tight crumpling versus broad, brain-like undulation. Without asymmetry in where nodes are added, the system relaxes to a uniform ring; biased or random insertion is what makes the growth organic.

Parameters

Lineage

Related
Reaction-Diffusion, Boids / Flocking

Works using this algorithm (1)

Floraform
jessica-rosenkrantz

Last updated 2026-07-16