Generative Algorithms: Lindenmayer-System (L-System)

An L-system or Lindenmayer system is a parallel rewriting system, namely a variant of 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).
For details and samples, check wikipedia

Koch Curve. Implemented with Grasshopper and RhinoScript.
download koch Curve sample...


Penrose Tiling. Implemented with Grasshopper and RhinoScript.
download Penrose Tiling sample...


Sierpinski Triangle. Implemented with Grasshopper and RhinoScript.
download Sierpinski Triangle sample...


Fractal Plant. Implemented with Grasshopper and RhinoScript.
download Fractal Plant sample...
GH_FractalPlant_LSystem_DynamicAngle.zip


Dragon Curve. Implemented with Grasshopper and RhinoScript.
download Dragon Curve sample...

  • guillermo gago doreste

    ouuu yeah!! i have pass to many hours this cristmas trying to do this. thank's
  • dvdrbls

    thank you!!
  • Leonid Krykhtin

    Cool! I was looking for this. Can you upload some other fractals that would be useful for designers and architects who is keen on creating something nature-like.
  • h8cru

    That seems very interesting! Do you have a Fractal Plant Script which works in 3D and not 2D?
    It would be really wonderful if you or anyone could share such an example...
    Thanks anyway
  • Rajaa Issa

    Hi h8cru,
    I don't have it, but you probably can simply rotate the reference plane and have additional iterations.
  • Rajaa Issa

    Hi Leonid,
    If you have an algorithm for a 3d fractal example, I'll be happy to write the code. Some of them it is only a matter of having multiple iterations using different initial string or location.
  • Leonid Krykhtin

    What do you mean by algorithm? A mathematical expression?
  • Rajaa Issa

    Algorithm is the logical description of a problem or basically a step-by-step description using mathematical or plane english to describe the problem. Here is what wikipedia defines it:
    http://en.wikipedia.org/wiki/Algorithm
  • msgrom

    Hi Rajaa,

    Thanks for the definition. Is it possible to write in parametric L Systems to the core structure you have written here? How would you suggest going about it?

    Thanks again,

    M
  • Rajaa Issa

    Can you elaborate. What parameters you wish to control?
  • msgrom

    Hi Rajaa Thaks for the quick reply.

    This is an exerpt from algorithmic beauty of plants introducing parametric L-Systems (p40):

    1.10 Parametric L-systems
    Although L-systems with turtle interpretation make it possible to Motivation generate
    a variety of interesting objects, from abstract fractals to plant-like
    branching structures, their modeling power is quite limited. A major
    problem can be traced to the reduction of all lines to integer multiples
    of the unit segment. As a result, even such a simple figure as an
    isosceles right-angled triangle cannot be traced exactly, since the ratio
    of its hypotenuse length to the length of a side is expressed by the irrational
    number √2. Rational approximation of line length provides only
    a limited solution, because the unit step must be the smallest common




    1
    1
    √2
    denominator of all line lengths in the modeled structure. Consequently,
    the representation of a simple plant module, such as an internode, may
    require a large number of symbols. The same argument applies to angles.
    Problems become even more pronounced while simulating changes
    to the modeled structure over time, since some growth functions cannot
    be expressed conveniently using L-systems. Generally, it is difficult
    1.10. Parametric L-systems 41
    to capture continuous phenomena, since the obvious technique of discretizing
    continuous values may require a large number of quantization
    levels, yielding L-systems with hundreds of symbols and productions.
    Consequently, model specification becomes difficult, and the mathematical
    beauty of L-systems is lost.
    In order to solve similar problems, Lindenmayer proposed that numerical
    parameters be associated with L-system symbols [83]. He illustrated
    this idea by referring to the continuous development of branching
    structures and diffusion of chemical compounds in a nonbranching filament
    of Anabaena catenula.


    The following is an example of its application:

    starting string: A
    p1: A F(1)[+A][-A]
    P2: F(s) F(s*R)



    which I think is basically trying to say

    F(s) = move forwar a step of length s > 0.


    Thanks again,

    Mateo
  • msgrom

    BTW
    sorry about the weird interruption to the text. copy paste functionality misbehaviour
    m
  • Rajaa Issa

    Hi Mateo,

    I'm not sure I get what you are trying to say. Have you tried the examples above? I isolated few parameters so you can grow the system in size and step length. I also isolated the L-System definition (variables, Constants, Rules, etc.), so you can use the model to create your own system if you wish.
  • robert cervellione

    in 7.0030 version of grasshopper this def throws a critical error that causes the grasshopper canvas to go red. any chance you can update for 7.0030
  • Nicholas Murao

    I was wondering if there's a way to use the fractal plants logic bt instead have the branches be curves instead of orth0gonal lines.
  • Rajaa Issa

    Not sure what you need.  Can you show an image or an example of what you want to get?
  • Nicholas Murao

    Sorry I would like to change my question. Similar to this photo I want the L-system to create a layering effect that begins to create a density. Also is there a way to have the L-System to branch out in multiple directions like in the photo above? Sorry for the loaded question hope it's not too much to ask. Thank You
  • Rajaa Issa

    Hi Nicholas,
    I am sure there is probably a way to write an L-System that produces result similar to the one in the photo.  I just have not written one and my guess it will take some experimenting to get a new variation of an L-System.  Sorry I do not have something offhand to pass.

  • Nicholas Murao

    I've been trying to tell the script to start the branching at a point, but I've been failing miserably. Could you possibly post a script that I could follow? Thank you
  • Nicole Zumpano

    I'm so glad to see that this post is still active!

    I've been experimenting with the fractal plant file, but as a complete Grasshopper n00b I cannot for the life of me figure out how to change the rotation angles for + and -.  I notice that the panels "Rotate 25" etc. aren't connected to anything, and that there aren't any 25s in the code, so where could it be?

    I'm sure it's totally obvious, but if anybody could help I'd be so thankful! ^^ 

  • Rajaa Issa

    Hi Nicole,

    I posted another example under the fractal tree (above) with dynamic angle control hooked to a slider.  That should help.

  • Nicole Zumpano

    Wow, this is so helpful.  Thank you so much!!

  • andres obregon

    Rajaa Thanks for sharing this...

  • yong+tse

    that's cool.....thanks.