/L_system/ColorTree.jpg 4_GET

Lindenmayer Systems

The joys of string rewriting

Many years ago I encountered a wonderful book called "The Algorithmic Beauty of Plants" (ABOP). You can get a pdf of it here: A Lindenmayer System draws complex forms using an idea called string rewriting and also the idea of a "turtle".
A turtle is a concept that comes from LOGO; a simple computer language that draws lines that is used to introduce kids to programming.

In logo you write commands that drives a turtle. For instance "F" is a command that makes the turtle move forward one step in whatever direction it's facing while drawing a line. And "+" might change the direction it's heading by an amount. If that turn amount is 90 degrees and "+" means turn to the left and "-" means turn to the right and the step is 100 pixels then a string of characters like F - F - F - F will cause the turtle to draw a square that is 100 pixels on a side.

Now if we replace each instance of F with "F - F + F + F F - F - F + F " we end up with a new string: "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 " which has 64 steps.

We can repeat this process indefinitely ending with very long strings that draw more and more complex shapes. Quadradic Koch
This enables many interesting possiblities. For instance you can fill a square with a very long line.

OK OK - maybe only interesting to some :-)

As you might expect from the title of ABOP that you can use this system to model various sorts of plants.

ABOP is inspiring but is also a very technical book. The strings can include lots more than just go forward or turn. I'm ending up making a kind of mini-intepreter that reads the string that responds to many commands. This is absorbing work that will keep me busy for years.

For me this work isn't all just dry programming that leads to curious shapes. I'm an artist and even when the coding gets hard the system produces images that I use as raw material for pictures. When the system draws lines I can control the length of each step and it's width and color. I have a way of creating color blends with thousands of colors. So while struggling to master branching structures I got this:

For years I've been using Photoshop to make a kind of super-symmetrical image I call a Snowflake that I like very much. Here's a page that is about Snowflakes. It has hundreds of pictures as well as an explanation and even a video of how they are made. So I made a snowflake from the Spinner.

Click on a thumbnail
for a bigger