Fractal Magic
This term, I’m working on a project for both my Designing Physical Interfaces class and my OOP (Object Oriented Programming) class. My idea was to create a “virtual gardener” program for a multi-touch display that would allow one to prune, adjust its growth and more. Not just that, but I want the tree to be fractal driven so they are different every time the program is run or the tree is generated. In preparation for this project, I started spending time with L-systems, or Liedermeyer Systems.
An L-system or Lindenmayer system is a formal grammar (a set of rules and symbols) most famously used to model the growth processes of plant development, but also able to model the morphology of a variety of organisms. L-systems can also be used to generate self-similar fractals such as iterated function systems. L-systems were introduced and developed in 1968 by the Hungarian theoretical biologist and botanist from the University of Utrecht, Aristid Lindenmayer (1925–1989).
Example 1: Algae
Lindenmayer’s original L-system for modelling the growth of algae.
variables : A B
constants : none
start : A
rules : (A → AB), (B → A)
which produces:
n = 0 : A
n = 1 : AB
n = 2 : ABA
n = 3 : ABAAB
n = 4 : ABAABABA
n = 5 : ABAABABAABAAB
n = 6 : ABAABABAABAABABAABABA
n = 7 : ABAABABAABAABABAABABAABAABABAABAAB
At first, when I started trying to figure out how to create L systems in flash, I used an array. That array would take the starting variable and plug it into the first division of the array. Then a line of code would go through and apply the two rules to that first division, adding in the new rules as it went. After that, the process would repeat until the desired number of iterations were completed. From there, the code would read out the entire array and draw lines based on what was inserted into each division.
In Flash 8, this didn’t work too well as it couldn’t handle much past 5 or 6 iterations of some of the more complicated rule sets. Flash CS3 could handle up to around 8 or 9, but still this wasn’t optimal. After hunting around online, I found a blog entry by Mitch Allen about turtle graphics created in flash using recusive functions.
Understanding Mitch’s code took me a while, primarily because the logic hurt my brain. However, I pushed through it and figured out how the system worked! From there, I started attempting to implement the L systems on the Wikipedia page.
The first one I successfully completed was the Koch Curve.
variables : F
start : F
rules : (F → F+F−F−F+F)
in this case, the “+” and “-” symbol mean turn left and right, respectively. For this Koch curve, the angle of their curve is 90 degrees.
After the Koch Curve, I attempted to make some of the other ones on the page, but I found myself having trouble. Either the code wasn’t working right (via improper entry) or the rules on the page were wrong. So I went out in search of a different page with more options. Ultimately, I found Robert Dickau’s Two-dimensional L-systems page that contains a large number of different L systems with the rule sets for them. I created a number of the different l systems on this page.
The Triangle Koch Curve (F -> F+F–F+F, 60°):
Dragon Curve (X -> X+YF+, Y -> -FX-Y)
Arrowhead curve (X -> YF+XF+Y, Y -> XF-YF-X, 60°):
With all these fractals under my belt, I feel more prepared to start developing tree l-systems with their more complicated rules and methodologies! I look forward to seeing what kind of creations I can develop with these for this project and for my final project, which I will talk more about later!








July 17th, 2007 at 11:30 pm
but, using these fractals, them trees grow so nice and symmetrical, ya don’t need a gardener!
July 17th, 2007 at 11:36 pm
Ah, but that’s where the fun comes in. Fractals by themselves are interesting and if you add in randomness (aka mutation), it gets more and more character^^ Ultimately, one can create stuff that looks different, but ultimately is the same species of plant. For example, the plants near the bottom of this page: Simulating Plant Growth using L systems.
July 19th, 2007 at 3:40 am
Woooooh hooooh!! My “formerly” hippy mom has been into fractals for about 20 years now. I remember when she first heard about them at a national Mathematicians convention. She started putting fractal images up EVERYWHERE in the house. It’s like her modern day Paisleys.
July 19th, 2007 at 4:48 am
aah yes, I had a friend who study math and he had his whole room wallpapered with fractal mozaic. And in artschool I had this teacher who dragged me into fibonacci numbers and the golden section stuff…amazing but at the end ya should free youreself from it because it’s merely a tool of construction and has nothing to do with creative modelling the world around you.
July 19th, 2007 at 6:18 am
Either way, it is pretty intreging how it takes on a life of it’s very own and can be so beautiful.
(on a side note - Meh Noob and I are going to OTAKON this weekend!! Hit me one time with a Napoleon “Yessssssss!!”)
July 19th, 2007 at 8:07 am
Indeed Nu! While fractals are really nice, one needs to add in some more interesting elements. I’ve been working on some L-system based trees recently and the random mutation makes them rather interesting.
Going to Otakon eh? Be careful of the rabid fangirls or catgirls! Never know what they’ll do. Also, I remember those conventions tend to be a bit of a money sink as things are generally quite expensive.^^ Course, those were the old days. Now everyone does it so perhaps things are cheaper!