The Lab · Pythagoras tree, 1942 · Mandelbrot, 1982

Fractal Tree

Draw a trunk. At its tip, draw two shorter branches, turned left and right. Do the same at the tip of every branch. That one rule, repeated, grows a whole tree, and a single angle decides which kind.

Try this

Press Sweep the angle and watch. At small angles the branches crowd upward into a tall fan. Around 30° to 40° you get something like an oak. Near 60°, the twigs curl into rosettes, like a head of broccoli. At exactly 90°, with each branch 71% as long as its parent, the tree locks into a rigid lattice of H shapes. Past 90° it starts folding back on itself.

Now stop the sweep and add some Lean, so the left branches turn more than the right ones: the tree curls over like a fern frond. Turn up Wildness so every branch is nudged a little, and press Grow a different one until you find a tree you like. Then add a little Wind. Found a good one? Copy a share link sends it to a friend, exactly as you see it, or Save a picture.

Where it came from

Around 1500, Leonardo da Vinci noticed a rule in real trees: where a branch splits, the children together are as thick as their parent. This toy follows it, so each of the two children is about 71% (1 ÷ √2) as thick as the branch it grows from.

In 1942, a Dutch math teacher, Albert Bosman, drew a tree out of squares that grow from one another, now called the Pythagoras tree. In 1968, the biologist Aristid Lindenmayer invented a way to write plant growth as simple rewriting rules, now called L-systems, and used it to model how algae and plants branch. And in 1982, Benoit Mandelbrot made the case, in The Fractal Geometry of Nature, that clouds, coastlines and trees are all built from a pattern repeated at smaller and smaller scales. He called such shapes fractals.

The lattice at 90° has a practical life too. It's called the H-tree, and chip designers use it to carry a computer's clock signal to every part of a chip: every tip of the H-tree is the same distance from the trunk, so the signal arrives everywhere at the same moment.

A love letter to recursion

When I was a young programmer, I tried to write code that drew exactly this kind of tree. My first attempts used precalculated arrays and a big pile of nested if statements, one level of branches at a time. They did not work well: every extra level meant more code, and it fell apart fast.

Digging for a better way, I found recursion: a function that draws one branch, then calls itself to draw the two smaller branches at its tip. A few lines of code, and the whole tree grew by itself, as deep as I liked. It was the first time I'd ever used recursion, and it changed how I approached so many projects after that. So this toy is a little love letter to that moment. — Neil

Links