Lindenmayer systems
Lindenmayer systems
Lindenmayer systems (L-systems, turtle graphics) are used to generate Fractal curves (Koch, Sierpinski, Levy, Dragon), Space filling curves (Hilbert, Peano-Gosper), Growth patterns in plants, etc. It is an iterative string rewriting method. Starting from the Axioma a new string is formed by replacing the string symbols according to a few given Rules. The final string contains instructions telling the turtle where to go, or how to draw the path. The list contains a number of well known examples. Choose one of them and push the Draw button to draw it in the graphical window. You may construct your own examples and add them to the list.
More information on Lindenmayer systems: Some history | Mathforum | Ridldle | Wikipedia | Mathworld | Algorithmic botany
Lindenmayer systems – Definition – Instructions
A Lindenmayer system is defined by an Axioma, one or more Rules and a list of Instructions which tell the turtle what to do. The Axioma is a string (for example: F X + F – F) which may contain Rules (X) and Instructions (F, +, -). Rules may only contain Instructions. Starting from the Axioma a new string is formed by replacing the string symbols according to the Rules and Instructions. This is repeated n times, where n is called the Order of the system. The final string contains instructions telling the turtle where to go, or how to draw the path. The Axioma and the Rules may contain the following instructions
F | go one step forward and draw a line |
f | go one step forward without drawing a line |
+- | turn right/left by the (fixed) angle |
[ | store the present state on a stack |
] | go to the last state on the stack |
: | go one step up in the color list (9 colors) |
; | go one step down in the color list |