Fractal Tree Generator

Grow recursive binary trees: set the branch angles, length ratios, depth, randomness, droop and wind, and measure the fractal dimension.

Presets

Playback

Shape

The two branching rules and the recursion depth.

Realism

Random jitter, droop towards the ground and wind.

Leaves and season

Layers

Model checks

The science

How a fractal tree is built

A trunk of length L0 splits into two branches. The left branch is rotated by +θL and shortened by a factor rL, the right one by −θR and rR; each branch then repeats the same rule. After depth d there are

Nsegments = 2d+1 − 1    Ntips = 2d

and, for a symmetric tree with ratio r, the total branch length is a geometric series:

Ltotal = L0 ∑k=0..d (2r)k = L0 ((2r)d+1 − 1) / (2r − 1)

If 2r > 1 the length grows without bound as the depth increases; if 2r < 1 it converges to L0/(1 − 2r).

Fractal dimension

When the branches do not overlap, the set of tips is self-similar with two copies scaled by r, so its similarity dimension solves 2 rD = 1:

D = ln 2 / ln(1/r)

(for r = 0.5, D = 1; for r = 1/√2 = 0.7071, D = 2, the tree fills an area). The page also measures the box-counting dimension: cover the tip set with squares of side ε and fit the slope of log N(ε) against log(1/ε). Check 3 compares both.

Realism knobs

Randomness jitters each angle and length with a seeded random generator (same seed, same tree). Droop adds a tropism term that bends each branch towards the vertical (negative = towards the ground). Wind sways each branch with a sine whose amplitude grows with depth, so thin twigs move more than the trunk.

Honest simplifications

Real trees do not follow a fixed rule: growth depends on light, water, damage and genes, and branching is rarely perfectly binary. This is a geometric model of self-similarity, not a growth simulation, and the leaves are drawn as simple discs.

What to try
  • Load Symmetric binary and drag the length ratio from 0.5 to 0.72: the dimension readout rises from 1 towards 2 and the tree fills in.
  • Pick Pythagoras tree (45 degrees, ratio 0.707): D = 2.
  • Increase randomness and press New random seed to grow a different oak from the same rule.
  • Turn the wind up and watch the thin twigs move more than the trunk.
  • Switch the season to autumn or winter and change leaf size.
Segments and tips versus depth (measured)
Branch length and thickness versus depth
Box-counting: log N versus log(1/size)
Total length versus depth: measured and series