Depth: 6 / 12
Growth Multiplier: 0.8
Branch Angle: 35°

Tree Growing

This is an interactive simulation of a recursive tree growing procedure, inspired by a passage in Richard Dawkins' The Blind Watchmaker (1986):

Textbooks of computer science often illustrate the power of what they call 'recursive' programming with a simple tree-growing procedure. The computer starts by drawing a single vertical line. Then the line branches into two. Then each of the branches splits into two sub-branches. Then each of the sub-branches splits into sub-sub-branches, and so on.

How It Works

The algorithm begins with a single vertical trunk drawn from the base of the canvas. At the tip of the trunk, two branches split off at equal angles in opposite directions. Each branch is shorter than its parent by a fixed ratio (the growth multiplier). The same splitting rule is then applied recursively to every new branch tip, continuing until the specified depth is reached.

This is recursion in its purest form: the same rule applied over and over at every level of the structure. The entire tree is defined by just three parameters:

  1. Depth. The number of levels of branching. A depth of 1 produces a single trunk with two branches. A depth of 16 produces over 65,000 branch tips.
  2. Growth Multiplier. The ratio of each branch's length to its parent. A value of 0.8 means each branch is 80% as long as the one it grew from. Lower values produce compact, bushy trees. Higher values produce sprawling ones.
  3. Branch Angle. The angle between a branch and its parent. Small angles produce tall, narrow trees. Large angles produce wide, spreading canopies. At 90 degrees, the branches extend horizontally.

Why It's Interesting

Simple recursive rules can produce structures with surprising organic complexity. Adjusting the three sliders above reveals a wide range of forms, from sparse, skeletal shapes to dense fractal canopies, all generated by the same rule applied at different scales.

This connects to a deeper idea in Dawkins' book: that the elaborate forms found in nature don't require elaborate blueprints. A small set of parameters, combined with a recursive growth process, can produce an enormous variety of shapes. Dawkins used a similar approach with his "biomorphs," showing that selection acting on simple developmental rules could generate lifelike forms.

Fractal Geometry

The trees produced by this algorithm are examples of self-similar fractals. Zoom in on any branch and you'll find the same structure repeated at a smaller scale. This property, where the part resembles the whole, is characteristic of many natural forms: ferns, river networks, lightning bolts, and blood vessels.

Benoit Mandelbrot formalized this idea in The Fractal Geometry of Nature (1982), arguing that classical geometry fails to describe the irregular, branching shapes found in the real world. Recursive tree algorithms like this one are among the simplest demonstrations of fractal structure.

L-Systems and Beyond

In 1968, the botanist Aristid Lindenmayer introduced L-systems, a formal grammar for modeling plant growth. L-systems generalize the branching rule used here by encoding growth instructions as strings of symbols that are rewritten according to production rules. With L-systems, you can model asymmetric branching, varying angles, leaf placement, and other botanical details.

The tree growing algorithm above is essentially the simplest possible L-system: a single production rule that replaces each branch tip with two new branches. Even this minimal system, with just three tunable parameters, produces a rich space of forms.

Originally published April 6, 2014