boxes_1

Intro: L-Systems

An LSystem is a parallel string rewriting system. A string rewriting system consists of an initial string, called the seed, and a set of rules for specifying how the symbols in a string are rewritten as (replaced by) strings. Let’s have a look at a simple LSystem:

seed: A
rules:
Rule #1: A = AB
Rule #2: B = BA

The LSystem starts with the seed ‘A’ and iteratively rewrites that string using the production rules. On each iteration a new string/word is derived.
n is the derivation length = the number of iterations

n=0: A
n=1: AB (A becomes AB according to Rule #1)
n=2: ABBA (A becomes AB according to Rule #1, while B becomes BA according to Rule #2. In result we get ABBA)
n=3: ABBABAAB
n=4: ABBABAABBAABABBA

Each string represents a word. All words form the language of the LSystem.
There are different types of LSystems: deterministic, stochastic, context-free, context-sensitive, parametric, timed-depending on the rules and the way they are applied by the LSystem.
Currently RABBIT supports context-free deterministic L-Systems.

We suggest the following resources:

RABBIT: L-Systems

Intro: Turtle Graphics(Interpretative Part)

Turtle Graphics are often used for L-System interpretation:

The derivation strings of developing L-systems can be interpreted as a linear sequence of instructions (with real-valued parameters in the case of parametric L-systems) to a ‘turtle’, which interprets the instructions as movement and geometry building actions. The historical term turtle interpretation comes from the early days of computer graphics, where a mechanical robot turtle (either real or simulated), capable of simple movement and carrying a pen, would respond to instructions such as ‘move forward’, ‘turn left’, ‘pen up’ and ‘pen down’. Each command modifies the turtle’s current position, orientation and pen position on the drawing surface. The cumulative product of commands creates the drawing.

The following symbols drive the Turtle:

F move forward at distance L(Step Length) and draw a line
f move forward at distance L(Step Length) without drawing a line
+ turn left A(Default Angle) degrees
turn right A(Default Angle) degrees
\ roll left A(Default Angle) degrees
/ roll right A(Default Angle) degrees
^ pitch up A(Default Angle) degrees
& pitch down A(Default Angle) degrees
| turn around 180 degrees
J insert point at this position
multiply current length by dL(Length Scale)
! multiply current thickness by dT(Thickness Scale)
[ start a branch(push turtle state)
] end a branch(pop turtle state)
A/B/C/D.. placeholders, used to nest other symbols

Application of LSystems

Since their original formulation, L-systems have been adapted to modelling a wide range of phenomena including:

  • herbaceous plants
  • neural networks
  • the procedural design of cities
  • generative art
  • generative music

12 thoughts on “Intro to L-systems

  1. n_grain says:

    Thank you so much for these tutorials and resources. I’m learning a lot of useful stuff here and I appreciate the clarity of presentation.

  2. morphocode says:

    Happy to hear you like our tutorials.
    We plan to extend the Edu section of the site with some more video tutorials and online courses. Hopefully, it will be pretty soon, so stay tuned!

    Regards

  3. Clueless Pickle says:

    Same here, thanks for the educational aspect of the site. Just started using Rabbit, would like to get better at it. Looking for more tutorials in the future. Cheers

  4. Franchoice says:

    Hi there,

    Is there a symbol command for Angle scale which can be used in the production rules? There is a port to insert a slider to set the “Angle scale” in the turtle but there aren’t any symbols listed above which allow you to implement changes to the default angle in the production rules.

    Thanks

  5. Alan D H Kim says:

    Thank you for the tutorial.

    By the way, what rolls left A(Default Angle) degrees? I can see / rolls right A(Default Angle) degree though.

    Cheers

  6. Morphocode says:

    Sorry for the late reply!

    The “Roll left” symbol is \
    It seems that we’ve missed that in the tutorial.
    Thanks for pointing that out!

    Regards,
    Morphocode

  7. poorvasapre@outlook.com says:

    Hi
    Can you please elaborate what is A=!””[B]////[B]////B ?
    Is it any equation?How you derive it?
    Can You explain it in detail?

    Thanks

  8. Christian says:

    Hello,
    I’m still very new to grasshopper, could you please explain how I could make a structure similar to the one at the top of the page?
    Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *