User Rating 0.0
Total Usage 0 times
Is this tool helpful?

Your feedback helps us improve.

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.

fractal generator L-system mandelbrot set julia set fractal art pattern generator math art turtle graphics recursive patterns

Formulas

L-System string rewriting applies production rules iteratively. Given axiom w and rule set P, the string at generation n is:

S0 = w , Sn+1 = P(Sn)

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:

zn+1 = zn2 + c

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:

μ = n log2(log2(|zn|))

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

FractalTypeDimension DAxiom / FormulaTypical IterationsDiscovery
Koch SnowflakeL-System1.2619log 4log 34 - 6Helge von Koch, 1904
Sierpinski TriangleL-System1.5850log 3log 25 - 8Wacław Sierpiński, 1915
Dragon CurveL-System2.0Space-filling10 - 15Heighway, 1966
Hilbert CurveL-System2.0Space-filling4 - 7David Hilbert, 1891
Fractal PlantL-System1.5Bracketed grammar4 - 7Prusinkiewicz, 1990
Lévy C CurveL-System2.0Space-filling10 - 16Paul Lévy, 1938
Gosper CurveL-System1.1292Hexagonal tiling3 - 5Bill Gosper, 1970s
Sierpinski CarpetL-System1.8928log 8log 33 - 5Sierpiński, 1916
Mandelbrot SetEscape-time2.0 (boundary)zn+1 = zn2 + c100 - 1000Mandelbrot, 1980
Julia SetEscape-timeVariablezn+1 = zn2 + c (fixed c)100 - 500Gaston Julia, 1918
Burning ShipEscape-time2.0 (boundary)zn+1 = (|Re| + i|Im|)2 + c100 - 500Michelitsch, 1992
Barnsley FernIFS1.454 affine transforms50000 - 500000 pointsMichael Barnsley, 1988

Frequently Asked Questions

L-System string length grows exponentially. A Koch curve at depth n produces 4n segments: depth 6 = 4096 segments, depth 10 = 1,048,576. The generator caps iterations per fractal type and uses a Web Worker for string expansion, but Canvas line-drawing is still single-threaded. Reduce iterations or increase step length to compensate.
The escape-time algorithm counts how many iterations n it takes for |zn| to exceed the bailout radius of 2. Smooth coloring uses μ = n log2(log2(|zn|)) to eliminate banding. This μ value maps to an HSL hue cycle. Points that never escape (inside the set) are colored black.
The turning angle δ defines how much the turtle rotates per + or - command. Koch curves require exactly 60°, Sierpinski uses 120°, Dragon curves use 90°. Changing the angle from its canonical value produces entirely different geometries. The presets lock angles to their mathematically correct values, but custom mode allows experimentation.
Both use the same recurrence zn+1 = zn2 + c. In the Mandelbrot set, z0 = 0 and each pixel represents a different c. In a Julia set, c is a single fixed complex number and each pixel represents a different z0. Every point in the Mandelbrot set corresponds to a connected Julia set. Points outside the Mandelbrot set produce disconnected (dust-like) Julia sets.
JavaScript uses 64-bit IEEE 754 floating-point arithmetic, providing approximately 15 - 17 significant decimal digits. Zoom factors beyond roughly 1013 exhaust this precision, causing adjacent pixels to map to the same complex coordinate. Overcoming this requires arbitrary-precision arithmetic (perturbation theory or BigFloat libraries), which is beyond the scope of this browser-based tool.
The canvas renders at the displayed resolution (up to 1200 × 1200 pixels by default). At 300DPI, that yields a print size of approximately 4 × 4 inches. For larger prints, increase iterations and adjust your browser zoom to enlarge the canvas before exporting. L-System fractals, being line-based, scale better than pixel-based escape-time fractals.