Graphics Reference
In-Depth Information
Table 12.2
Turtle Graphic Interpretation of Brackets
Symbol
Turtle Graphic Interpretation
[
Push the current state of the turtle onto the stack
]
Pop the top of the state stack and make it the current state
S
⇒
FAF
A
⇒
[
FBF]
A
⇒
F
B
⇒
[
FBF]
B
⇒
F
FIGURE 12.13
Nondeterministic, context-free production rules.
context for the predecessor symbol. They are nondeterministic because there are multiple rules with
identical left-hand sides; one is chosen at random from the set whenever the left-hand side is to be
replaced. In this set of rules,
S
is the start symbol, and
A
and
B
represent locations of possible branching;
A
branches to the left and
B
to the right. The production stops when all symbols have changed into ones
that have a turtle graphic interpretation.
Figure 12.14
shows some possible terminal strings and the corresponding graphics produced by the
turtle interpretation. An added feature of this turtle interpretation of the bracketed L-system is the reduc-
tion of the size of the drawing step by one-half for each branching level, where
branching level
is defined
by the current number of states on the stack. L-systems can be expanded to include attribute symbols that
explicitly control line length, line width, color, and so on [
16
] and that are considered part of the state.
FFF
F[FFF]F
F[
F[
FFF]F]F
FIGURE 12.14
Some possible terminal strings.
Search WWH ::
Custom Search