Gallery › Generative and L-systems
Hortus Machinalis
A herbarium plate: three L-system plants grown by turtle, with blossoms stamped along each stem.
How it is made
Three plants are grown from short rewriting rules (L-systems) that a turtle follows to draw stems. Dried blossoms are then stamped along each plant's own path by walking it with pathforall at even spacing, and the labels are set in Palatino, as a plate deserves.
Details
- Category
- Generative and L-systems
- Libraries
- none: this piece is plain PostScript
- Added
- 2026-07-19
- Page size
- 620 × 800 points
Source
View source the whole program in a scrolling window, or read gallery/hortus.ps on GitHub. To draw it yourself, from a checkout of the repository:
pscat --page 620x800 gallery/hortus.ps
Open it in the playground and watch it draw in your browser: this piece reads no other file, so it runs there unchanged.
The first 40 of 173 lines of the source
%!PS-Adobe-3.0
%%Title: Hortus Machinalis
%%BoundingBox: 0 0 620 800
%%EndComments
% A herbarium plate from a garden that never grew: three botanical
% specimens raised from seed and rule — Lindenmayer systems driving a
% turtle, each plant one rewriting grammar deep in its own habit of
% branching. The stems are stroked twice (pressed-sepia under thin
% herbal green), and dried blossoms are stamped along the very path
% of the plant by walking it with pathforall (Stage 19) at even
% arc-length. Labels in Palatino, as a plate deserves. Seeded rand:
% same file, same garden, run to run.
%
% Gallery II (Stage 19) — inlines its turtle and L-system engine from
% lib/artkit.ps per the gallery's self-containment doctrine.
%
% pscat --page 620x800 gallery/hortus.ps
7 srand
% --- the toolkit subset (from lib/artkit.ps) -------------------------
/chance { rand 8192 idiv exch mod } def
/TurtleState 16 dict def
TurtleState begin /tx 0 def /ty 0 def /th 0 def /tstk 64 array def /tsp 0 def end
/thome { TurtleState begin /th exch def /ty exch def /tx exch def /tsp 0 def tx ty moveto end } def
/fd { TurtleState begin /tkd exch def
/tx tx th cos tkd mul add def /ty ty th sin tkd mul add def tx ty lineto end } def
/tl { TurtleState begin th add /th exch def end } def
/tr { TurtleState begin th exch sub /th exch def end } def
/tpush { TurtleState begin tstk tsp [tx ty th] put /tsp tsp 1 add def end } def
/tpop { TurtleState begin /tsp tsp 1 sub def tstk tsp get aload pop
/th exch def /ty exch def /tx exch def tx ty moveto end } def
/lsys {
/lsdepth exch def /lsrules exch def /lscur exch def
lsdepth {
/lsnext 0 def
lscur { /lsc exch def
lsrules lsc known { /lsnext lsnext lsrules lsc get length add def }
{ /lsnext lsnext 1 add def } ifelse } forall