Environmental Engineering Reference
In-Depth Information
Fig. 11.1 A branched
structure specified with
the turtle
So far, the turtle can draw only one line after the other. To create the possibility to
produce branching patterns, special commands denoted “[” and “]” are introduced:
When the turtle reads “[”, its current state (including the values of s , d , c etc.) is stored
on a stack. The following string is then processed by the turtle as a branch which ends
when “]” is reached: At this moment, the stored state is taken from the stack and
overwrites the state, which the turtle got by finishing the branch. The turtle then “jumps
back” to its old position and resumes its operation as if the construction of the branch
since “[” had not taken place. Figure 11.1 shows the turtle interpretation of the string
F(50) [RU(60) D(1) F(20)] RU(-30) F(50):
After a vertical segment of length 50, specified by F(50) in the beginning, the
shorter, but thicker branch to the right (with diameter 1 set by the command D(1)) is
constructed. When the closed bracket is processed, the turtle resumes its old position
and follows the commands RU(-30) F(50) to draw the upper-left part of the structure.
The turtle's movement can be extended to the third dimension by two further
rotation commands: RL( a ) and RH( a ). They rotate the turtle around an axis point-
ing (initially) to the left, respectively around its current head direction.
11.3 L-Systems
Lindenmayer systems, also called “L-systems”, are parallel rewriting systems
which are applied to strings , i.e. to sequences of symbols. Mathematically, a
“pure” L-system (without geometrical interpretation) has 3 components: an alpha-
bet
which contains the basic symbols, a start string called “Axiom”, and a finite
set of rules. Each rule has the form:
symbol
S
string of symbols
where all symbols are elements of
¼¼>
. In a deterministic L-system, the left-hand side
of each rule must be different from that of all other rules. An application step of the
S
Search WWH ::




Custom Search