Tutorial #1 — Starting with 2D, some Shapes, and some Colours
Table of Contents
This tutorial will show you how to generate one of the most known — and most simple — Lindenmayer Systems (L-System) fractals, the “von Koch curve”. It will also describe some basic ideas of L-Systems. Besides this, some ways to change the appearance of an L-System fractal are given, containing changes of the colouring scheme and the geometry settings.
The origin of the von Koch curve is described in “The Algorithmic Beauty of Plants” (“ABoP” for short) at page 14. It is a very simple example of so called “rewriting rules”.
2.The first Fractal
So, let's start with our first usage of ALSOG to draw a Lindenmayer System.
After having started ALSOG, you should see the main window with the first “tab” opened. You may now define the L-System.
Figure2.1.Main ALSOG window
We will start with the axiom. The axiom is the seed of our Lindenmayer system. Type an ‘F’ into the field beside “Axiom”. A thin, white line should appear in the window.
Here, you can already see the first interesting thing about Lindenmayer systems: a symbol, ‘F’ in our case, can be interpreted as a graphical command, a line in our case.
Now, we will give ALSOG some rules about how the initial axiom shall be extended. Let's type the following string into the column “Conclusion” of the first line of the table named “Rules”: “F-F++F-F”. Hmm, nothing has happened, that's right. But as soon as you put an ‘F’ into the column named “Middle” (same line), you will see the von Koch-curve! So what have we done?
We have started with the axiom ‘F’. Each line in the table is a rule that tells the Lindenmayer System what shall replace what within the axiom. The list of symbols to replace is stored in “Middle” while the definition of what shall be inserted instead is stored in “Conclusion”. This means that in the first step, the ‘F’ — the complete axiom — was replaced by “F-F++F-F”. This got our new axiom. In the second step, each ‘F’ in the new axiom “F-F++F-F” is replaced by “F-F++F-F” again, making the next axiom be “F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F”. This was done as many times as the value in the field named “Iterations”.
Four times is the default value. You may now try to change the number of iteration by either entering a number into the according field or by pressing the up/down arrows located to the right of this field. You will see how the shape changes with different steps:
Table2.1.Step number and result for the first example
Ok, but what makes our fractal look the way it does? When starting with the axiom, we have already learned that an ‘F’ is interpreted as a straight line. The other symbols we have used, ‘+’ and ‘-’, have a different meaning. They change the direction of the line. In our case, a ‘-’ rotates the direction counter clockwise, a ‘+’ clockwise, both by 60 degrees.
At first, we will replace the flat lines by something else. To properly see the results of our next steps, please change the iteration back to a value of 2. Your fractal will look like this:
Now, let's change to the menu where the shapes may be chosen by pressing this tab's icon: . The following tab will be shown:
Figure3.1.The shape edit tab
Here, you can choose different shapes for the selected item by choosing them from the list. The table below gives you some examples of possible shapes.
Table3.1.Examples for different shapes
Each of the shapes has some additional parameters that control the appearance. In order to examine the results better, you may change the camera position by pressing the one or both mouse buttons after moving your cursor into the view and moving the mouse.
After having changed the view a bit, you may try to play a bit with the different shapes and their parameters.
Now, let's change the colours of our L-System. Here for, we have to switch into the colour tab by pressing . The following tab will appear:
Figure4.1.The colour edit tab
You are now able to switch between different colouring modes. Each symbol in the generated L-System contains some attributes and ALSOG allows using these to colour the L-System in many different ways.
Besides changing the colouring scheme, you may also change the colours themselves. For this, you may double-click on the material preview or the palette preview. When clicking on the material preview, a window will pop up which allows you to edit the colour. You may also switch to the tab named “List” where you can choose from one of the predefined colours.
Figure4.2.The material preview
Figure4.3.The material editor
Clicking on a palette preview will open a window which lets you alter the palette — a list of 256 colours. Here, you can find a list of predefined palettes to choose from within the menu “Actions -> List”.
Figure4.4.The palette preview
Figure4.5.The palette editor
After reading this tutorial, you should be able to generate a large set of 2D-fractals based on Lindenmayer systems. You should have learned how the shape and colours of objects can be changed, and you should have gained a slight insight about Lindenmayer systems.
With this knowledge, you should be able to construct fractals as those shown in the table below.
Table5.1.Examples of fractals that use the presented methods (rotation=90)
If you find a part of this tutorial incomplete or hard to understand, please contact us. Thank you!