L‑systems in 3D ▾
Shading
Petal / leaf shape
System
The turtle goes 3D ▸

In 2D the turtle only had a heading and could turn left/right. In 3D it carries a full orthonormal frame — three perpendicular unit vectors that travel with it:

H L U
H heading (where it draws), L left, U up. They stay perpendicular no matter how the turtle tumbles.

Three pairs of symbols now rotate the frame about each axis: + - yaw (about U), & ^ pitch (about L), \ / roll (about H). [ and ] save and restore the whole frame, so a branch can veer off in any direction and snap back.

Add P (petal) and L (leaf) and the same tiny grammar grows lilies, ferns and bursts.

Rewriting, step by step ▸

Generations 0–3 of the current system. Highlighted spans in gen 1 show where a rule fired.

3D turtle legend ▸
Fdraw a segment forward (also G) fmove forward without drawing + −yaw left / right (about U) & ^pitch down / up (about L) \ /roll left / right (about H) |turn around (yaw 180°) [ ]push / pop the full turtle state Pparametric petal at the tip Lleaf at the tip

Any other letter (X, A, Y…) draws nothing — it only drives the rewriting.

Drag to orbit · pinch / scroll to zoom · double‑tap to reset