1.4. Third example: Creating branched structures - The graph

Both the snowflake curve and the fractal cuboids are composed of a simple sequence of symbols: The turtle reads this sequence from left to right and draws the corresponding objects. Thus, we see a set of three-dimensional objects which are stringed together one after another.

While this is sufficient for very simple structures, it would not be feasible to model more complex structures this way. For example, the side branches of plants and trees cannot be represented easily within a single sequence of symbols: At every branching, a new sequence for the side branch starts, while the bearing branch continues with its own sequence of symbols.

As an example, consider the following two figures: The left one shows a structure consisting of a quite abstract stem (three consecutive elements) and four side branches (each a single element). The stem is representable by the sequence F F F of turtle commands. Each branch is representable by the single turtle command F, and the branching rotations can be encoded by RU commands.

Stem with four branches

Internal graph structure using turtle commands

The figure on the right hand side shows a graph which combines the turtle commands of the stem and its branches into a single structure. The graph has to be understood as follows:

Now relational growth grammars use a textual notation for branches with the help of square brackets: Each branch is included in a pair of square brackets and appended behind its bearing symbol. E.g., the graph in the figure above is written textually as

F [RU(90) F] [RU(-90) F] F [RU(90) F] [RU(-90) F] F

The three F's of the stem can be seen when ignoring the bracketed parts. In order to see that this works, click here and have a look at the source code in the text editor and at the 3D view.

This very simple example of branched structures has no development, it just creates a fixed structure. But there is a second, more interesting example of branching with a simple development: In every step of development, an F segment is split into two F segments, and two side branches are created at the splitting location.