Copyright: FracTree 1.0 Copr. 1993 Michael Schernau


Contents
FracTree 1.0

 Welcome to FracTree 1.0, a string rewriting system with turtle graphics. Here is a list of available topics:

 Introduction

 String rewriting system

 Turtle graphics

 Menu commands

 Examples

 Cursors

 Bibliography

 File format

 SHAREWARE

 Send your best fractal description files (with your name in one of the comment fields) to my internet address

 schernau@nucleus.ps.uci.edu.

 I will include the best ones in the next release of FracTree.


Introduction

 Welcome to FracTree 1.0. This program generates fractal curves and fractal trees. It allows to view these fractals in different states of growth (stages).

 This fractal program is based a string rewriting system . In the rewriting process, each character in the  input string gets replaced by another string. The rules for the replacement are written in a rule book.

 The result of this replacement is another string, which again can be rewritten, yielding more and more complex strings.

 The graphics output is drawn by a turtle . The imaginary turtle interprets the string  character by character as a sequence of commands.  It changes its position or direction according to the character it reads. Lines are drawn when the turtle moves.

 For more information see the index .


String rewriting system

 In the rewriting process, each character in the  input string gets replaced by the corresponding rule. The rule book is a look-up table. It contains a replacement string for each ASCII character. Most strings are just the string equivalent of the corresponding characters, giving trivial rules like "A" gets replaced by "A", etc. Other strings specify non-trivial rules like "F" gets replaced by "F-F++F-F" for the Koch curve.

 The initial string is called the  axiom . For the Koch curve, it is just "F", but it can be more complicated for other fractals. The axiom is the 0th stage of the fractal.  The nth stage is obtained by replacing all charters of the string of the (n-1)th stage according to the rules. This is a recursive process, which generates more and more complicated strings. These strings are then interpreted by a turtle , which draws the fractal.

 Here are the first stages of the Koch curve as an example:

 Stage 0: "F"

 Stage 1: "F-F++F-F"

 Stage 2: "F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F"

 Stage 3: "F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F-F-F++F-F-F-F++F-F++F-F++F-F -F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F-F-F++F-F-F-F++F-F ++F-F++F-F-F-F++F-F"

 To look at this fractal, open the file "KOCH.FRA" and select the stage from the display menu .


Turtle graphics

 The graphics output is drawn by a turtle. The imaginary turtle interprets a string of characters and changes its position or direction according to the character it reads. The following characters are recognized as turtle commands:

 "F": Move forward one step (of the current size) and draw a line

 "f": Move forward one step without drawing a line

 "+": Turn clockwise by an angle delta

 "-": Turn counterclockwise by an angle delta

 "|": Turn around 180 degrees.

 "[": Save the state of the turtle on the stack; this creates a branch point.

 "]":  Restore the old state of the turtle from the stack. This brings the turtle back to the point where the branch started.

 "*": (star) Increase the step size by 10%.

 "/":  (slash) Decrease the step size by 10%.

 ",":  (comma) Change the step size randomly.

 Note: Other special characters, like (!@#$%^&) will have special meanings in future releases of FracTree.

 All characters not listed above have no meaning to the turtle, but they are useful for  the string rewriting system . In addition to these commands, the behavior of the turtle is determined by two parameters: The step size and the turning angle delta . The step size is automatically adjusted, so that the resulting image fills the screen. The size of the image is determined by setting the step size to one and interpreting the command string without actually drawing the resulting image. During this process, the cursor is changed to the sizing symbol.


Turning angle delta

 Delta is the angle by which the turtle turns. It is equal to 360 degrees divided by the number of directions. Use the command 'directions...' from the  Edit menu to adjust its value.


Cursors

 During time consuming operations, the cursor is changed to indicate the type of operation performed.

  This cursor indicates that the string rewriting system is building up the string for the fractal.

  This cursor indicates that the string is interpreted with the turtle in order to determine its size. The step size for the turtle is automatically adjusted, so that the fractal fills the window. No output is drawn.


Menu commands

 There are 4 menus:

 File menu

 Edit menu

 Display menu

 Help menu


File menu

 The file menu contains the commands to  load or save fractal description files and bitmaps.

 New

 Clears the rules, the axiom, the number of directions, and the comments.

 Open...

 Reads a fractal description file (rules, axiom, etc.) from disk.

 Save

 Saves a fractal description file to disk.

 Save as...

 Asks you for a filename and saves the fractal description file to disk.

 Save bitmap...

 Asks you for a filename and saves the current contents of the window as a bitmap file to disk. Use your favorite fractals as a background picture for Windows!

 Print

 Prints the current fractal. To take advantage of the higher resolution of the printer (Laser, plotter, etc), the fractal is redrawn instead of just copied from the screen. However, this might take a while...

 Exit

 Quits this program.


Edit menu

 The edit menu contains the commands to modify the fractal description file.

 Comments...

 Creates or modifies comments such as "Look at stage 5".

 Directions...

 Changes the number of directions or the turning angle delta of the turtle.

 Axiom...

 Defines the axiom.

 Rules...

 Creates or modifies the rules for the string rewriting system . Click on the list box to edit new rules, click on "Add" to add the new rule to the list, click on a rule to modify it, or click on "Delete" to delete the selected rule.


Display menu

 The display menu draws the fractal in the selected stage.

 Next Stage

 Draws the fractal in the next stage. The keyboard shortcut Crtl-N allows you to step rapidly through the first stages of a fractal.

 Stage 0 - Stage 15

 Draws the fractal in the selected stage.

 Stage...

 Allows you to enter arbitrary stage numbers.

 Caution: Fractals typicly double their requirements for memory and computing time for each stage. Increasing the stage by 10 can need 1024 times more memory!


Help menu

 The help menu allows access to the help facility and shows current parameters of the program.

 Index

 Shows the help index.

 Introduction

 Introduces to the purpose and the operation of this program.

 Help on help

 Explains the help facility.

 Info...

 Shows information about the length of the current string and the size of the string buffers. It also shows the size of the fractal in terms of the initial stepsize.

 Settings...

 Shows the comments, number of directions, the axiom, and the rules. Look at this information whenever your fractal doesn't look like you had in mind.

 About FracTree...

 Shows the about-information.


Bibliography

 The string rewriting system and the turtle graphics are described further in the book "The Science of Fractal Images" by Pleitgen and Saupe (editors), 1988, Springer Verlag, New York. This book gave the basic idea to write this program.


Examples

 The Koch curve. This example explanes the basic commands F, +, and -.

 Bush 1. This example explanes branches.

 Ladder This example explanes the use of non-printing characters.


Koch curve
 The Koch curve

 The Koch curve is a classic example of a fractal. The axiom is "F", the only replacement rule is "F --> F-F++F-F", and the number of directions is 6.

  Stage 0 is the axiom itself. "F" means go forward one step and draw a line. Since the turtle initially heads "east", a single, horizontal line results.

  This is stage 1. Applying the replacement rule to the previous string "F" yields "F-F++F-F". This means go forward one step, turn counterclockwise (-), draw another line (F), turn clockwise twice (++), draw another line (F), turn counterclockwise (-), and draw another line (F). Note that the program automaticly reduced the step size to make the fractal fit into the window.

  This is stage 2. Every "F" in the previous string is replaced by "F-F++F-F". The "+" gets replaced by "+", since there is no rule stating something else. The same goes for the "-". The resulting string  is "F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F".

  This is stage 3. The same rules acting on the previous string yield "F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F-F-F++F-F-F-F++F-F++F-F++F-F -F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F-F-F++F-F-F-F++F-F ++F-F++F-F-F-F++F-F"


 Bush 1

 This example illustrates branchings. The axiom is "---F", the rule is F-->F[+F]F[-F]F, and the number of directions is 14.

  This is stage 0, the axiom. The 3 minus signs in front of the F turn the initial direction of the turtle so that it points upwards.

  The first stage is "---F[+F]F[-F]F". After going forward one step ("F"), the state of the turtle is saved on the stack  ("["). The "+" means turn clockwise one step. The next "F" draws the branch on the right side of the plant. The closed bracket means retore the old status of the turtle from the stack. This brings the turtle back to the point where the branch started. The "F" draws the next portion of the stem, while the "[-F]" creates a branch to the left. The last "F" finally completes the stem.

  The string rewriting system replaces each of the 4 "F"'s in the second stage with "F[+F]F[-F]F". The streight parts of the stem get little branches and the previous branches get subbranches. Each new stage adds more detail to the plant.


 Ladder

 This example shows the use of non-printing characters. The axiom is "-N", the rules are L --> F[-FF[-F]+F]F and N --> LN, and the number of directions is 4.

 The "N" stands for "next". It is not a turtle command, so nothing is drawn. It gets replaced by "LN", where "L" stands for one element of the ladder. Again, nothing is drawn here.

  This is stage 2. The "L" got replaced by "F[-FF[-F]+F]F", which is the first step of the ladder. At the same time, the "N" got replaced by "LN", which provides the "L" for the next ladder step. The "N" will produce the following step.

  Here is stage 3. Note that each stage adds only one new step to the ladder. If the rule were changed to N --> LLN, two new steps would be added each time. However, if the rule were changed to N --> LNN, the number of steps would double each stage. Most fractal grow this way, since the rules modify existing structures.


 File format

 This information is only needed if you want to create fractal description files with a text editor or with another program. Most users can skip this section.

 The fractal description file contains all the information necessary for the fractal. The extension for the file name is always ".fra".

 Comments are preceded with a colon. They are optional, but must be placed before the rest of the file. Up to 2 lines are possible. Additional comments are skiped. The other parameters follow the comments:

 The first line after the comments specifies the number of directions.

 The next line specifies the axiom.

 The following lines describe the rules. There is one line per rule. Every line starts with the character for the rule. It is followed by a space and  the replacing string.

 As an example , here is the description file for Hilberts space filling curve:

  Hilbert.fra:

 ;Hilbert's space filling curve

 4

 X

 X    -YF+XFX+FY-

 Y    +XF-YFY-FX+


SHAREWARE

 This program is distributed as SHAREWARE. This means that you can use it for a trial period of 30 days. After that time you must register your copy. Registration costs just $10, so there's no real reason not to register. I welcome your comments and suggestions for improvements of FracTree 1.0 on the registration form.

 Send a check, or money order, drawn on a US bank, for $10 along with the registration form to

 Michael Schernau

 PO Box 5511

 Irvine, CA 92716, USA

 Registration benefits: Well, you have already the full functional version of FracTree 1.0, and there are no nag-screens. Why register?

 A) It is the law (Copyright!)

 B) You show that the program is actually of value to you, so I will make improvements. After all, if nobody cares, why should I invest my time?

 C) Registered users of FracTree 1.0 can register the next version (if I make one, see point B) for FREE.

 THIS PROGRAM IS DISTRIBUTED AS IS. IT MAY BE FREELY DISTRIBUTED ON BULLETIN BOARDS AS LONG AS ALL FILES ARE INCLUDED. THE AUTHOR RESERVES ALL RIGHTS TO THIS PROGRAM. THE AUTHOR DOES NOT WARRANT THIS PROGRAM'S FITNESS OR SUITABILITY FOR ANY PURPOSE. THE AUTHOR ASSUMES NO LIABILITY FOR ANY DAMAGES RESULTING FROM ITS USE.