• Home
  • Bread
    • Amsterdam
    • Bangalore
    • Berlin
    • Bologna
    • Bozeman
    • Budapest
    • Chicago
    • Côte d'Azur
    • Goa
    • Lima
    • Lisbon
    • Lofoten Islands
    • London
    • Los Angeles
    • Málaga
    • Mexico City
    • Modena
    • Montreal
    • Mumbai
    • New Mexico
    • New York City
    • Porto
    • Reykjavík
    • Rome
    • San Francisco
    • Santiago de Chile
    • Singapore
    • Turin
    • Valencia
    • Zagreb
  • About
Menu

disquiet

Decadence is the total loss of unconsciousness, which is the very basis of life. Could it think, the heart would stop beating.
  • Home
  • Bread
  • Places
    • Amsterdam
    • Bangalore
    • Berlin
    • Bologna
    • Bozeman
    • Budapest
    • Chicago
    • Côte d'Azur
    • Goa
    • Lima
    • Lisbon
    • Lofoten Islands
    • London
    • Los Angeles
    • Málaga
    • Mexico City
    • Modena
    • Montreal
    • Mumbai
    • New Mexico
    • New York City
    • Porto
    • Reykjavík
    • Rome
    • San Francisco
    • Santiago de Chile
    • Singapore
    • Turin
    • Valencia
    • Zagreb
  • About
fractal-plants-bottom-three.png

Fractal Plants

November 26, 2019
 
A fractal plant generated using axiom F, production rule F → FF-[-F+F+F]+[+F-F-F], for 6 iterations, with a turn angle of 22.5°,

A fractal plant generated using axiom F, production rule F → FF-[-F+F+F]+[+F-F-F], for 6 iterations, with a turn angle of 22.5°,

The other day I was looking at implementations to the Hilbert Curve, and came across this concise and elegant recursive solution. I also came across the L-system, or Lindenmayer system. Lindenmayer, a biologist and botanist, developed the L-system to model the growth processes of plant development.

Wikipedia’s explanation of L-systems is succinct and clear:

An L-system consists of an alphabet of symbols that can be used to make strings, a collection of production rules that expand each symbol into some larger string of symbols, an initial "axiom" string from which to begin construction, and a mechanism for translating the generated strings into geometric structures.

A simple way to understand the L-system is to use Lindenmayer’s original L-system for modeling algae growth.

variables : A B
constants : none
axiom : 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

The L-system is both simple and incredibly flexible. The L-system is a parallel rewriting system that isn’t opinionated about what the symbols mean or do. But what if we gave these symbols meaning? For example, we can use the L-system in graphics by mapping individual symbols in the model to drawing commands.

Consider the Hilbert Curve:

variables : A B
constants : none
axiom : A
rules : (A → LBFRAFARFBR), (B → RAFLBFBLFAR)

which produces:

n = 0 : A
n = 1 : LBFRAFARFBL
n = 2 : LRAFLBFBLFARFRLBFRAFARFBLFLBFRAFARFBLRFRAFLBFBLFARL
n = 3 : LRLBFRAFARFBLFLRAFLBFBLFARFRAFLBFBLFARLFLBFRAFARFBLRFRLRAFLBFBLFARFRLBFRAFARFBLFLBFRAFARFBLRFRAFLBFBLFARLFLRAFLBFBLFARFRLBFRAFARFBLFLBFRAFARFBLRFRAFLBFBLFARLRFRLBFRAFARFBLFLRAFLBFBLFARFRAFLBFBLFARLFLBFRAFARFBLRL

Now what if we mapped some of the symbols in the Hilbert L-system to drawing functions?

F → move forward
L → turn left 90°
R → turn right 90°

For various iterations (n=1 through n=4), we end up with the following patterns:

Hilbert curves for n=1 through n=4 iterations

Hilbert curves for n=1 through n=4 iterations

 
 
fractal-plants-all.png
 

We can use this same process to generate various plant structures! None of the fractal plants presented here are novel. In fact, the production rules for these plants are well documented in Lindenmayer’s classic Algorithmic Beauty of Plants. The collage above is more or less the same as in page 25 of the same book, except that I generated my plants with higher iterations, and randomized the color for each stroke between two shades of green. I generated these using a rudimentary TypeScript implementation of L-system that I wrote and Canvas.

I don’t know how these plants should be named, so I’m just using the entire description of each one’s axiom, production rules, turn angle and iterations.

 
 

n=8, δ = 25.7°, F, F → F[+F]F[-F]F

fractal-plant-5.png
 
 

n = 8, δ = 20°, F, F → F[+F]F[-F][F]

fractal-plant-4.png
 
 

n = 6, δ = 22.5°, F, F → FF-[-F+F+F]+[+F-F-F]

fractal-plant.png
 
 

n = 11, δ = 20°,X, X → F[+X]F[-X]+X, F → FF

fractal-plant-6.png
 
 

n = 11, δ = 25.7° , X, F, X → F[+X][-X]FX, F → FF

fractal-plant-2.png
 
 

n = 9, δ = 22.5°, X, F, X → F-[[X]+X]+F[+FX]-X, F → FF

fractal-plant-3.png
 
More Posts With Code
fractal-plants-bottom-three.png
Nov 26, 2019
Fractal Plants
Nov 26, 2019
Nov 26, 2019
i-colored-pastel.png
Oct 31, 2019
I at the Center
Oct 31, 2019
Oct 31, 2019
Tags plants, fractals, code, tech, typescript, l-system, lindenmayer
← The Year in Crumbs: Good Sourdough in 2019I at the Center →

Latest Posts

Featured
Oct 5, 2025
Lofoten in Film, May 2025
Oct 5, 2025
Oct 5, 2025
Jan 1, 2025
The Year in Crumbs: Good Sourdough in 2024
Jan 1, 2025
Jan 1, 2025
Nov 19, 2024
Dining in Lima, Peru: Central (No. 1, The World's 50 Best 2023)
Nov 19, 2024
Nov 19, 2024
Oct 19, 2024
Dining in Málaga, Spain: Kaleja ⭐
Oct 19, 2024
Oct 19, 2024
Oct 15, 2024
Fujicolor Pro 400H: Bozeman, Catskills and Santiago de Chile
Oct 15, 2024
Oct 15, 2024
Oct 6, 2024
Lima in July
Oct 6, 2024
Oct 6, 2024
Aug 10, 2024
Málaga, Summer 2024
Aug 10, 2024
Aug 10, 2024
Jul 14, 2024
Kodak Pro Image 100, Spring and Summer 2024
Jul 14, 2024
Jul 14, 2024
Apr 20, 2024
Côte d'Azur on Film
Apr 20, 2024
Apr 20, 2024
Apr 6, 2024
Côte d'Azur in March
Apr 6, 2024
Apr 6, 2024

All text and photos © 2017 – 2021 Premshree Pillai, unless otherwise mentioned.

~ fin ~