Differential Growth Basics

I'm playing with the concept of differential growth, a technique used to simulate the growth of organic forms. The idea is to create a bunch of nodes, or "cells" which are bound by rules of attraction amongst themselves:

To ensure cells are never too isolated, we can create new cells to fill the gaps. This is a simple implementation of the concept, but it can be used to create complex, beautiful, organic forms.

Here's the basic logic:

An example

In this sketch, we place cells in the form of a circle, and we let them grow following the rules of differential growth.

Placing our cells

We want to start with our cells placed as a circle by leveraging using polar coordinates:

Here's the code to place our cells in a circle:

function createCircularPath(p5, cx, cy, radius) {
  const path = []
  const cellCount = 40
  const angleStep = p5.TWO_PI / cellCount
  for (let angle = 0; angle <= p5.TWO_PI; angle += angleStep) {
    const x = cx + p5.cos(angle) * radius
    const y = cy + p5.sin(angle) * radius
    path.push(p5.createVector(x, y))
  }
  return path
}

In action

When we run our differential growth simulation, we can see the cells moving based on our rules, which creates this organic behaviour