Fractals are shapes that exhibit self-similar structure across multiple scales
Fractals (from Latin fractus, ‘broken’) are patterns or structures that repeat self-similarly at multiple levels of scale. The pattern at one level mirrors the pattern at another level, though not necessarily identically — just structurally similar. Fractal structures are ubiquitous in nature: fern fronds replicate the shape of the whole fern at smaller scales; tree branching patterns repeat at each level; coastlines show similar structure at different scales. In generative art, fractals are produced by recursive code: objects that create smaller copies of themselves, with depth limited by a maximum-levels parameter to avoid infinite loops. Increasing the depth limit rapidly multiplies the total object count (exponentially: numChildren^numLevels).
Examples
Fractal tree: a Branch object creates _numChildren child branches from its endpoint, each doing the same. With _numChildren=3 and _maxLevels=3: 1+3+9=13 branches total. With _maxLevels=5: 1+3+9+27+81=121 branches. Sutcliffe Pentagons: each pentagon contains 6 sub-pentagons.
Assessment
A fractal with 4 children per branch and 5 levels: calculate the total number of branches. Then explain why adding just one more level is computationally expensive.