As this
web page will tell you, "Many living things grow in such a way as to produce fractal
patterns. Examples include the passageways in the lungs or the branches of a tree. In
these cases the self-similarity on different scales arises because growth involves
repetition of the same simple process (e.g. branching). These simple, repetitive
processes can often be neatly summarized as sets of simple rules.
"L-systems are sets of rules and symbols (also
known as 'formal grammars') that model growth processes. The name 'L-system' is short for
'Lindenmayer System', after Aristid Lindenmayer, who was one of the first people to use
syntactic methods to model growth."
My program accepts a formal grammar in a file which it is passed as a command-line
parameter. This file is of the following format:
8 2 // ITERATIONS RULES
*X // Axiom
X [R*Y][U*Y] // Rule 1
Y [D*X][L*X] // Rule 2, etc.
The program then modifies the initial string according to the grammar given with the
number of iterations specified. It follows the resulting instruction string to
generate a 3-dimensional image in a window, which can then be viewed from any angle and
location using the following keys:
Key |
Function |
Key |
Function |
H |
Move left |
K |
Move right |
U |
Move forward |
J |
Move backward |
O |
Move up |
L |
Move down |
A |
Rotate -Y |
D |
Rotate +Y |
S |
Rotate -Z |
W |
Rotate +Z |
R |
Rotate +X |
F |
Rotate -X |
View the code for this project here.

|