Expand description
Turtle interpretation: walk an L-system string into line segments, with a
branch stack for [/]. A build-time step (runs inside Scene::configure,
off the hot path) that produces the base geometry a generator scene caches
and then only transforms per frame.
Commands (the common turtle vocabulary):
F,G— step forward, drawing a segmentf— step forward without drawing+— turn left by the configured angle-— turn right by the configured angle[— push position + heading]— pop position + heading- anything else — no-op (grammar variables such as
Xthat only expand)
Functions§
- normalize_
fit - Center
segsand uniformly scale them to fit within[-target, target]on the larger axis, so any figure (whatever its raw extent per depth) frames itself in the view. A degenerate (zero-extent) set is left untouched. - walk
- Walk
sintoout(cleared first) as base geometry — positions only; the scene fills colour/width per frame.angleis in radians. Segments beyondmax_segmentsare dropped and counted (the ADR-0007 cap is never silent): the returnedusizeis how many draw steps were dropped. - walk_
with_ depths walk, plus the generation depth of every emitted segment written intodepths(cleared first) — the branch-nesting level the turtle drew it at (ADR-0059’slsystemcolour axis). Depth0is the trunk; each unclosed[is one more generation, so a segment’s depth is how many branch pushes are still open above it.