Fractal Figures
The fractal figures below are both generated using a String rewriting
system. The Applet uses a seed string, called an axiom and then applies
a number of string modification rules to that axiom to generate successive
generations of the fractal. The resulting strings can then be parsed by
a parser that is similar to a Logo Turtle in that it is capable of only
a few basic moves:
- +
- rotate clockwise (amount specified in attributes)
- -
- rotate counterclockwise
- f
- move forward one unit (scaled automatically to fit)
- F
- draw a line while moving forward one unit
You can look at the source for this Applet by clicking
here.
This first figure is a rendering of the von Koch snowflake curve which
is generated from the axiom "F" using the single rule
"F => F-F++F-F". It draws successive generations with
one second delays between them. You can click on the figure to
restart the fractal from the beginning.
The second figure is a rendering of the space filling Hilbert curve
which has many ways you can generate it. Here, I use a more concise
set of rules which involve using non-drawing characters to control
the string rewrites. The axiom "X" is rewritten by
either "X => -YF+XFX+FY-" or "Y => +XF-YFY-FX+".
This figure draws successive generations with half second delays
between them. You can click on the figure to restart the fractal
from the beginning.