Fractal Pattern Generator
Generate beautiful fractal patterns: L-Systems, Mandelbrot, Julia sets. Customize iterations, colors, angles. Export as PNG.
About
Fractal geometry describes structures where self-similar patterns repeat at every scale. A coastline measured with a 1km ruler yields a different length than one measured at 1m resolution. This non-integer scaling is captured by the fractal dimension D, where D = log Nlog s for N self-similar pieces at scale factor s. This generator implements two families: L-Systems (Lindenmayer grammars) that produce Koch curves, Sierpinski gaskets, dragon curves, and botanical branching via string rewriting and turtle graphics; and escape-time fractals (Mandelbrot and Julia sets) computed per-pixel in the complex plane. Misconfiguring iteration depth wastes computation or produces featureless blobs. Setting L-System depth above 8 on complex grammars can produce strings exceeding 107 characters. The tool caps parameters to keep rendering under 30 seconds on typical hardware.
Limitations: L-System rendering assumes uniform segment length. Mandelbrot coloring uses cyclic HSL mapping. The tool approximates floating-point arithmetic at 64-bit IEEE 754 precision, so deep zooms beyond 1013× magnification will show pixelation artifacts. For research-grade exploration, arbitrary-precision libraries are required. Pro tip: for botanical fractals, stochastic angle variation (the jitter parameter) prevents the artificial symmetry that makes computer plants look synthetic.
Formulas
L-System string rewriting applies production rules iteratively. Given axiom w and rule set P, the string at generation n is:
String length grows as |Sn| = O(kn) where k is the expansion ratio of the dominant production. Koch curve: k = 4. Turtle graphics interprets the string character by character. F draws forward by step length d, + rotates by angle δ, − rotates by −δ, [ pushes state, ] pops state.
For escape-time fractals, each pixel maps to a point c in the complex plane. The iteration is:
For the Mandelbrot set, z0 = 0 and c varies per pixel. For Julia sets, c is fixed and z0 varies. A point escapes if |zn| > 2 (bailout radius). The escape iteration count determines color via smooth coloring:
Where μ is the smoothed iteration count, n is the discrete escape iteration, and |zn| is the modulus at escape. The fractal dimension of an L-System curve with N self-similar copies at scale 1s is D = log Nlog s.
Reference Data
| Fractal | Type | Dimension D | Axiom / Formula | Typical Iterations | Discovery |
|---|---|---|---|---|---|
| Koch Snowflake | L-System | 1.2619 | log 4log 3 | 4 - 6 | Helge von Koch, 1904 |
| Sierpinski Triangle | L-System | 1.5850 | log 3log 2 | 5 - 8 | Wacław Sierpiński, 1915 |
| Dragon Curve | L-System | 2.0 | Space-filling | 10 - 15 | Heighway, 1966 |
| Hilbert Curve | L-System | 2.0 | Space-filling | 4 - 7 | David Hilbert, 1891 |
| Fractal Plant | L-System | ≈1.5 | Bracketed grammar | 4 - 7 | Prusinkiewicz, 1990 |
| Lévy C Curve | L-System | 2.0 | Space-filling | 10 - 16 | Paul Lévy, 1938 |
| Gosper Curve | L-System | 1.1292 | Hexagonal tiling | 3 - 5 | Bill Gosper, 1970s |
| Sierpinski Carpet | L-System | 1.8928 | log 8log 3 | 3 - 5 | Sierpiński, 1916 |
| Mandelbrot Set | Escape-time | 2.0 (boundary) | zn+1 = zn2 + c | 100 - 1000 | Mandelbrot, 1980 |
| Julia Set | Escape-time | Variable | zn+1 = zn2 + c (fixed c) | 100 - 500 | Gaston Julia, 1918 |
| Burning Ship | Escape-time | 2.0 (boundary) | zn+1 = (|Re| + i|Im|)2 + c | 100 - 500 | Michelitsch, 1992 |
| Barnsley Fern | IFS | ≈1.45 | 4 affine transforms | 50000 - 500000 points | Michael Barnsley, 1988 |