Implementation of L-systems in AutoLISP
For detailed explanation of L-systems see http://algorithmicbotany.org/.
A very-very much simplified description of L-systems is:
- Characters can be interpreted as graphic commands, for example using
turtle graphics (like the Logo language):
- F : draw a line forward (in the direction of the head of the turtle)
- + : turn the turtle head counter-clockwise by 90 degree
- - : turn the turtle head clockwise by 90 degree
- In the L-system there is an "axiom" (an initial shape) and a
rewriting rule is used to determine the shape. For example:
- The axiom:
F-F-F-F
- The rewriting rule:
F -> F-F+F+FF-F-F+F
- The different shapes at different levels of recursion:
Implementation in AutoLISP
- Dialog window to input the axiom, the rewriting rules, the number of
times to perform rewriting and the starting position:
A generated shape with tubes:
Plants:
Copyright © 2007,
Péter Iványi