L System
|
Introduction
The notes for this page were derived from pages 10 to 12 of
"The Algorithmic Beauty of Plants" by Przemyslaw Prusinkiewicz and Aristid Lindenmayer.
It is very useful when testing the implementation of a L system
to have examples of axioms and rules that generate known shapes.
|
|
The Sierpinski Gasket
This curve is an
example of applying two rules to produce a shape. The rules are
almost identical in that they each produce three sides of a hexagon, but
rule "G" makes its shape "turning" to the right, while rule "H" makes
it shape while "turning" to the left.
axiom "H" rule G "H>zG>zH" rule H "G<zH<zG" rule "*G" "1" # apply this rule only on the last rewrite rule "*H" "1" # apply this rule only on the last rewrite angle 60 generations 5 |
|
Gosper Space Filling Curves
This curve is an example of a space filling curve. With increasing generations
it fills its interior more and more thoroughly. Again it is based on two rules
that produce "left turning" and "right turning" curves.
axiom "H" rule "G" "G>zH>zzH<zG<zzGG<zH>z" rule "H" "<zG>zHH>zzH>zG<zzG<zH" rule "*G" "1" # apply this rule only on the last rewrite rule "*H" "1" # apply this rule only on the last rewrite angle 60 generations 5 |
|
© 2002- Malcolm Kesson. All rights reserved.