Environmental Engineering Reference
In-Depth Information
the so-called Greenlab model (Guo et al. 2006) (which is the result of an independent
line of FSPMs originally not employing rewriting systems) can be expressed in the
form of a grammar.
11.2 Turtle Geometry
If we want to formalize rules for structural development of organisms, like those for
shoot formation and branching of plants, we have to define a code. Its task will be
to translate organic entities like leaves, internodes, flowers etc. into formal objects or
symbols which can be referred to in precise rules and which can also readily
be processed by a computer. Several codes of this sort have been designed. The
most frequently used one is called “turtle geometry”, a name referring to a virtual
device for construction or drawing, called the “turtle” (Abelson and diSessa 1982). The
concept of “turtle” was incorporated into the LOGO programming language by
Seymour Papert in the late 1960s (see Harvey 1997 about LOGO). The formal symbols
which will finally encode our geometrical structures are interpreted as commands
directed one after the other to this turtle. The turtle has a memory containing informa-
tion about the length s of the next geometrical entity to be constructed, its thickness d ,
its colour c , the turtle's current position, its current direction of movement, and more.
Among the available commands are the following ones:
M0
move forward by s length units (without drawing)
F0
move forward and draw simultaneously a line of s length units
M( a )
move forward by a units (without drawing); the explicitly specified
number a overrides the turtle's s
F( a )
move forward and draw simultaneously a line of a length units
L( a )
overwrite s by the value a
D( a )
overwrite d by the value a
P( a )
overwrite c by the value a (interpreted as a colour index)
RU( a )
rotate clockwise by the angle a (around the “up” axis, which is
perpendicular to the plane where the turtle is moving)
In the commands M0 and F0, the zero says that there is no explicit argument;
instead, the “state variable” s of the turtle is used. Strings consisting of these
commands can be used to specify structures made of consecutive lines (or cylinders
in three dimensions) with varying length, thickness and visibility. Each of these
strings describes a fixed geometrical structure.
Loops can be used to abbreviate iterated parts of a command sequence:
for (int i:(1:n)) ( X ) generates n replicates of the string X (here, int i defines a
counting variable for the repetitions). For example, the turtle programme:
L(100) for (int i:(1:60))
(for (int j:(1:i)) (F0) RU(90))
generates a rectangular spiral (cf. Kurth 2007).
Search WWH ::




Custom Search