b2KIT

L-System Fractal Generator

Define L-system grammars and generate fractal plants, trees, and curves. Edit axiom, rules, and angle with live rendering.

Tested tool guide Tested browser tools Checked August 16, 2026

What L-System Fractal Generator does, with a checked example

Specify an axiom, replacement rules, an iteration count, and a turn angle to render a finite stage of an L-system fractal. Successive rewrites create the instruction word, which is then interpreted as a path containing forward moves, turns, and optional branches. This supports Koch-like curves, trees, and stylized plants. The usual source of confusion is that rewriting and drawing are separate: some symbols control later substitutions without drawing a segment, while the angle changes the rendered geometry without changing the rewritten word.

Worked example

A concrete input and expected output from the current implementation.

Input

Axiom: F
Rule for F: F+F
Iterations: 1
Angle: 90 degrees

Expected output

A path made of two equal-length line segments joined at a right angle.

The single rewrite replaces the initial F with F+F. The two F symbols draw two segments, while + changes the heading by 90 degrees before the second segment.

How the result is produced

1

Parallel rewriting

Beginning with the axiom, each iteration replaces every symbol that has a production with that production's right-hand side. Replacements happen in parallel: symbols introduced during one pass are not expanded until the next pass. Characters without matching rules remain in the word, allowing turn and branch markers to survive. Repeated substitution can make the word grow very quickly.

2

Turtle interpretation

After expansion, the resulting symbols are read as turtle-style drawing instructions. Forward commands add segments; plus and minus change the current heading by the selected angle; brackets save and restore position and heading to form branches. Variables can control later rewrites without drawing anything themselves. The angle therefore changes the geometry, not the rewritten word.

Good uses

  • Compare successive iterations of a known L-system and check whether its production rules create the expected curve.
  • Develop a procedural tree or plant silhouette by adjusting branch brackets, forward symbols, and turn angles.
  • Demonstrate how a short formal grammar can produce an increasingly complex geometric drawing through repeated parallel substitution.

Limits and checks

  • An iteration count is not a segment count. The number of rendered segments depends on how many drawing symbols each rule creates, so one additional iteration can multiply the workload.
  • Screen orientation, initial heading, centering, and automatic fitting do not change the underlying grammar. A rotated or rescaled rendering can represent the same expanded instruction word.
  • Symbol names and case matter. A valid-looking grammar can produce an empty or unexpectedly sparse canvas when its expanded word contains variables but no recognized forward-drawing commands.

Common questions

Why does changing the angle leave the branching pattern structurally similar?

The angle is applied only when turn commands are interpreted for drawing. It does not alter which symbols replace other symbols, how many branches the grammar creates, or the order of those branches. Consequently, the same expanded word can produce narrow, wide, folded, or overlapping versions of the same command structure at different angles.

Can this generator calculate a fractal dimension or prove self-similarity?

No. It renders a finite iteration of the supplied grammar, which is useful for inspecting its visible construction. A drawing that appears self-similar is not by itself a proof, and its fractal dimension cannot generally be read from the image. Dimension calculations require separate analysis of the production, scaling factors, and any overlaps between generated pieces.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools