Working With Shape: L-Systems
Trees
“I think that I shall never see
A poem lovely as a tree.
A tree whose hungry mouth is prest
Against the earth’s sweet flowing breast;
A tree that looks at God all day,
And lifts her leafy arms to pray;
A tree that may in Summer wear
A nest of robins in her hair;
Upon whose bosom snow has lain;
Who intimately lives with rain.
Poems are made by fools like me,
But only God can make a tree."
— Joyce Kilmer, 1915
Introduction
Trees are fractal in nature, meaning that patterns created by the large structures, such as the main branches, repeat themselves in smaller structures, such as smaller branches…. a universal growth pattern first observed by Leonardo da Vinci 500 years ago: a simple yet startling relationship that always holds between the size of a tree’s trunk and sizes of its branches.
Inspiration
An Introduction to L-Systems
From Job Talle’s Website:
Lindenmayer systems were originally conceived by Hungarian biologist Aristid Lindenmayer while studying algae growth. He developed L-systems as a way to describe the growth process of algae and simple plants. The result was a type of language in which the recursive and self similar properties of organism growth can be expressed. Indeed, L-systems can be used to generate natural patterns, but well known mathematical patterns can also be written as an L-system. In this article, I will explain different flavors of L-systems, and I will demonstrate them by rendering 2D Lindenmayer systems and 3D Lindenmayer systems using turtle graphics.
The language is very simple. It consists of symbols (the alphabet) and production rules. The first state of the sentence is called the axiom. The production rules can be applied repeatedly on this axiom to evolve or grow the system. A simple example would be a system with the axiom AA, and the rule A→ABAA→ABA. After the first iteration (the first time the rule is applied), the sentence will be changed to ABAABA. After the second iteration, the sentence will be ABABABAABABABA and so forth. You can see how a self expanding sentence can be analogous to cell division in plants and other biological processes.
L-system Structures thus develop through a process of string rewriting. A string of letters is transformed into a new string of letters using simple rules called productions. The process is repeated indefinitely, each time using the string that was just produced as the source for the next string. Because the strings tend to grow with each rewrite, an L-system can become arbitrarily complex, but always guided by a simple process dictated by a fixed set of simple rules.
In this respect, L-systems are a manifestation of Complexity Phenomena.
(Image Courtesy Christophe Eloy | University of Provence).
Let us see how we can create “Algorithmic Trees”.
Creating Trees using L-systems
p5.js
Fractal Grower
Head off to https://www.cs.unm.edu/~joel/PaperFoldingFractal/paper.html. Download the .jar
file and save it say in your Documents folder. Open and play. Instructions are on the website.
Wait, But Why?
References
Job Talle. Lindenmayer Systems https://jobtalle.com/lindenmayer_systems.html
C. J Jennings. L-systems. https://cgjennings.ca/articles/l-systems/
Przemysław Prusinkiewicz and Aristid Lindenmayer. The Algorithmic Beauty of Plants. Springer-Verlag, 1990.