L-Systems are described in the following book:
seed F + + F + + F # Initial sequence of symbols rule F -> F - F + + F - F # Symbol rewrite rule delta 60 # Angle of rotation in degrees theta 60 # Initial angel in degrees leng 400 # Length of line element iter 3 # Number of iterations ratio 3 # Scaling of length/iteration x 0 # Initial horizontal position y -235 # Initial vertical position
ignore X # X will be ignored seed X rule F -> F F rule X -> F [+ X] F [+ X] - X delta 22.5 theta 90 leng 230 iter 6 ratio 2 x 0 y -230 red 0.0 # color component between 0 and 1 green 0.6 # blue 0.2 #
move f # f produces invisible line seed F + F + F + F rule F -> F+f-FF+F+FF+Ff+FF-f+FF-F-FF-Ff-FFF rule f -> f f f f f f delta 90 theta 90 leng 236 iter 2 ratio 6 x 128 y -128
Any letter may be used as a non-terminal. For any used letter, there has to be a a corresponding rule. The program is case sensitive for letters used in rules and seed.
Use of color is optional.
Use of ratio is optional (default = 1). The value of leng is divided by ratioiter. For many (but not all) figures, ratio can be defined such that, when the value for iter is altered, no other values need to be adjusted.
F(x) -> F(x * 1.41)
F(x < .5) -> F(x * 1.41) F(x >= .5) -> [ + F(x)] - F(x)
F(.8, .2) -> F -> [ - F ] [ + F ] F