Seymour Papert invented ``Turtle graphics'' as a system for
translating a sequence of symbols into the motions of an automaton
(the ``turtle'') on a graphics display (see [Pap80]; the
original idea was to provide a programmable object that children could
learn to think geometrically with). This turned out to be an ideal
system for giving a geometrical interpretation to the dynamics of
L-systems. The basic system is as follows. We fix a ``step length''
d to be the distance covered by the turtle in one step. We also set
to be a given angle, usually
for some integer
n. Following FRACTINT's conventions, we make the following
definitions.
As a first example of the use of these symbols, we introduce the Koch curve L-system:
Without specific productions mentioned for some symbols (in this case
+ and -), we assume they are constants in the sense that
the implied production rule is
. Generation 0 is just a
straight line; we will assume the heading at the start is along the
positive horizontal axis. We take the angle
to be
(in FRACTINT terminology, this convention is
represented by the instruction angle=6. Geometrically, this
production means replace a straight line segment F by the following
arrangement of four line segments.
Figure 10: The production for the Koch curve
In this figure, the actions taken in traversing the path are marked by the corresponding symbol in F+F-F+F. If we scale by a factor of three so that the starting and ending points of the curve remain the same, we may describe this production by saying that the middle third of the original line segment was replaced by the top of the equilateral triangle spanned by that middle third.
Some generations of the Koch curve are displayed below.
Figure 11: Koch curve generations
The limit is a fractal curve of the type that caused some anxiety
among the mathematicians (Weierstrass and others) of the nineteenth
century who were at work building the rigorous foundations of the
calculus. This curve is an example of a one-to-one continuous mapping
of the unit interval into the two-dimensional plane which does not
have a well-defined tangent line anywhere. In fact, the curve
``seems'' to be turning at an angle of
or
at
all points.
The Koch L-system grows quite rapidly in terms of the number of line
segments plotted. Since each line segment is replaced by four more
at the next generation, the n-th generation has
segments.
For instance, generation 8 plotted above has 65536 segments.
Now would be an opportune time to play with the L-systems routines in FRACTINT. Choose the fractal type to be ``lsystem.'' FRACTINT will then display a set of L-system definitions, retrieved from some file, usually fractint.l. In this file may be found:
The name of this L system, ``KochCurve,'' is followed by a comment
(beginning with ;) indicating the creator of this L-system,
a statement indicating that the angle is
, the
axiom, and the production rules. After typing the ``order'' or
generation number, and pressing Enter, FRACTINT displays the
resulting shape. You can press the letter z to easily
change the order, and t to change the fractal type.
You may load another file of L-systems by pressing the function key F6 on a PC. This makes it possible for you to create your own L-system definitions and try them out in FRACTINT. For now, select the L-system called ``Dragon,'' given below:
This is the FRACTINT L-system that realizes the Dragon Curve of the
preceding section. The angle increment is
.
This L-system has two extra symbols X,Y that have no
geometric meaning, that is, they are ignored when it is time to draw
the desired curve. They are used to ensure the correct evolution of
the drawing commands. Each line segment drawn by an F is tagged with
an X or a Y symbol. So an FX segment is replaced on the next
generation by two segments of each type with a left
turn in
between (specified by the ++), while an FY segment is
replaced by a right turn. The
turns at the ends ensure that
all the turns between FY and FX are correctly oriented. This is a
very elegant encoding of the process we described before, and it
requires some checking to see that it really works. The first
few generations are as follows:
| Gen. 0 | FX |
| Gen. 1 | -FX++FY- |
| Gen. 2 | -FX++FY-+++FX-FY+- |
| Gen. 3 | --FX++FY-+++FX-FY+-+++-FX++FY--+FX-FY++- |
Even though the number of +,-'s between segments increases,
the net turn is always
. It's an interesting exercise to design
an L-system that modifies the Dragon system so that the corners
are truncated slightly so that we can more easily see the path of
the curve. We will see something of this nature a little later.