An L-system is a rewriting system where some rules are describing how symbols are replaced by string of symbols.

The system is starting with an initial string which is expanded by application of the rewriting rules.

When the symbols are encoding some movements (translation or rotation) then we can generate pictures.

For instance, let’s consider the rules:

  • A -> B-A-B
  • B -> A+B+A

and the initial string is “A”.

If “A” and “B” are representing a translation by one unit, “+” is representing a rotation by 60 degrees and “-“ is representing a rotation by -60 degrees, then we get the folllowing strings and pictures.

1st iteration

The generated string is B-A-B (the first rule was applied to the starting string “A”)

img

2nd iteration

The generated string is A+B+A-B-A-B-A+B+A

img

3rd iteration

The generated string is B-A-B+A+B+A+B-A-B-A+B+A-B-A-B-A+B+A-B-A-B+A+B+A+B-A-B

img

4th iteration

The generated string is A+B+A-B-A-B-A+B+A+B-A-B+A+B+A+B-A-B+A+B+A-B-A-B-A+B+A-B-A-B+A+B+A+B-A-B-A+B+A-B-A-B-A+B+A-B-A-B+A+B+A+B-A-B-A+B+A-B-A-B-A+B+A+B-A-B+A+B+A+B-A-B+A+B+A-B-A-B-A+B+A

img

5th iteration

The generated string is B-A-B+A+B+A+B-A-B-A+B+A-B-A-B-A+B+A-B-A-B+A+B+A+B-A-B+A+B+A-B-A-B-A+B+A+B-A-B+A+B+A+B-A-B+A+B+A-B-A-B-A+B+A+B-A-B+A+B+A+B-A-B-A+B+A-B-A-B-A+B+A-B-A-B+A+B+A+B-A-B-A+B+A-B-A-B-A+B+A+B-A-B+A+B+A+B-A-B+A+B+A-B-A-B-A+B+A-B-A-B+A+B+A+B-A-B-A+B+A-B-A-B-A+B+A-B-A-B+A+B+A+B-A-B-A+B+A-B-A-B-A+B+A+B-A-B+A+B+A+B-A-B+A+B+A-B-A-B-A+B+A-B-A-B+A+B+A+B-A-B-A+B+A-B-A-B-A+B+A-B-A-B+A+B+A+B-A-B+A+B+A-B-A-B-A+B+A+B-A-B+A+B+A+B-A-B+A+B+A-B-A-B-A+B+A+B-A-B+A+B+A+B-A-B-A+B+A-B-A-B-A+B+A-B-A-B+A+B+A+B-A-B

img

Stacking of the iterations

Now, I’d like to represent in 3D those iterations. I can just stack the pictures and create a mesh:

img

It is not very beautiful but it can be smoothed and some thickness added to the walls. The new result is:

img

Finally, it can be 3D printed:

img