RABBIT: L-Systems

RABBIT + L-Systems

Navigation

Contents

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:
A = AB
B = BA

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

n=0: A
n=1: AB
n=2: ABBA
n=3: ABBABAAB
n=4: ABBABAABBAABABBA

All these words form the language of the LSystem.
There exist 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.

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 and draw a line
“f” -move forward without drawing a line

“+” -turn left
“-” -turn right
“\” -roll left
“/” -roll right
“^” -pitch up
“&” -pitch down

“|” – turn around

Symbols like ‘A’, ‘B’ or ‘C’ are just placeholders..i.e. they are 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

RABBIT: L-Systems Features

  • form-finding features – explore forms based on plant growth …
  • creating Fractal curves – Koch curves, dragon curve, …
  • creating Space-filling curves – Hilbert curves, FASS curves, …
  • creating Branching Structures – 2D & 3D branching structures

Hilbert_curve

Hilbert_Curve

RABBIT: L-Systems Components

L-SYSTEMS COMPONENTS
COMPONENT INPUT OUTPUT
LSystemComponent A:Axiom – the first word in the L-System
PR: Production rules of the L-Systems
n: number of generations

W: The last word, generated by the L-System
LW: All words, generated by the L-System
LS: The LSystem object
Turtle Component S: String/Word interpreted as a sequence of commands
L: Length of the turtle’s step when moving in space
A: Angle increment of the turtle when rotating in space
O: Initial orientation and position of the turtle
G: Graphics, created by the turtle

RABBIT: L-Systems Tutorials

A set of tutorials ( GH Definitions+explanation notes) is included in the distribution file:

  • Koch curves
  • Dragon curve
  • 2D Branching structures
  • 3D Branching structures

18 Responses

  1. Casy 3:47 pm on March 20th, 2010

    I am sorry, but what is a sintaxis of letters for branching sistem
    What means A, F, B etc ???

  2. Langer 5:52 am on March 24th, 2010

    Is it possible to give different length to Turtle steps?

  3. morphocode 11:07 pm on March 24th, 2010

    Hi guys,

    @Casy the following symbols drive the Turtle. Each of the symbols has the following meaning:
    “F” -move forward and draw a line
    “f” -move forward without drawing a line

    “+” -turn left
    “-” -turn right
    “\” -roll left
    “/” -roll right
    “^” -pitch up
    “&” -pitch down

    “|” – turn around

    Symbols like ‘A’, ‘B’ or ‘C’ are just placeholders..i.e. they are used to nest other symbols. Have a look at the following simple L-System:

    Axiom: A
    Rule: A = FA
    L-System:
    n=0: A
    n=1: FA
    n=2: FFA
    n=3: FFFA
    ….

    instead of ‘A’ you can use ‘B’..it doesn’t matter…The nesting logic is important.

    @Langer
    Rabbit 0.2 supports context-free deterministic L-systems.
    You can specify a default length of the step and change it.

    In order to change the step of the turtle while it is moving one should use a parameter…something like this: F(x)=F(x*2). This is a so called parametric L-System. Maybe the next release of Rabbit will support this type of L-Systems but for now you can modify only the default step length.

    We suggest the “Algorithmic beauty of plants” for more information on these topics.

    Cheers

  4. Cameron 10:27 pm on April 14th, 2010

    Hi there,

    Is there any chance you could share the definition you used to create the orange cubes above? I’ve tried modifying the 3D branching lines L-system to create cubes from the 90 degree lines, but I can’t seem to get it working.

    Thanks!

    - Cameron

  5. morphocode 8:07 am on April 16th, 2010

    Hi Cameron,

    sure we can…we’ll send you a mail asap

    It is just as easy as adding a Box component using the ‘Turtle’ traces(lines) as an input.

    Cheers

  6. Cameron 11:00 am on April 16th, 2010

    That would be fantastic, thanks. I’m sure it’s simple, I just can’t figure out which box type component to use, or how to format the geometry inputs to create individual boxes from the L-System, especially when many of those line geometries don’t form bounding boxes. If you could send the definition file to cameron4887 [at] gmail.com, I would be very appreciative!

    - Cameron

  7. Cameron 12:01 am on April 17th, 2010

    Okay, so what I’ve done is taken your 3-D Branching Structures L-System definition and modified the production rules a little bit. What I’m left with is a 3-D weaving of turtle lines, some connected, some not. I’ve tried adding every type of box component to the end of the definition, but I cannot produce boxes based on the bounding lines created by the L-System. I’ve also tried using the “Endpoint” component on the turtle lines, then using these points to create 3-D boxes, but to no avail. Any ideas? Thanks again!

    - Cameron

  8. Cameron 12:39 am on April 17th, 2010

    So, I have another question. Is there a way to color the boxes I’m trying to create according to their placeholder symbol (ie. A= yellow, B = Blue) so that I can identify which boxes are which in the whole model?

    - Cameron

  9. morphocode 10:43 am on April 19th, 2010

    Hi Cameron,

    On the color issue:
    Some of the L-System parsers provide a special symbol (‘c’ for ex.) that is used to shift the current color by some color value. In this way you can have different colors for different placeholders however Rabbit still does not support that feature…hopefully we’ll add it to the next release.

    P.S. We’ve sent you the definition.

    Best

  10. msgrom 2:21 am on May 12th, 2010

    Hullo,

    Thank you for the plug in. Im really enjoying playing with it. I was wondering if you knew when parametric L-systems would be available in Rabbit. If not is there a way to fiddle so that one could make it work?

    Thanks again,

    Mateo

  11. morphocode 11:14 am on May 14th, 2010

    Hi Mateo,

    we plan to implement parametric L-Systems in the future releases, however we don’t have exact timeline. There’s no way to fiddle because parametric L-Systems require expression evaluation and other functionnality which is missing at the moment.

    We’ll do our best to include that feature asap.

    Best

  12. msgrom 5:41 pm on June 1st, 2010

    Hi,

    Is Rabbit compatible with GH 0.70014?

    thanks

    m

  13. dream_arch 1:57 am on June 2nd, 2010

    hello,
    Morphocode, please post 3d Lsystem ghx file!
    Thanks!

  14. dream_arch 2:03 am on June 2nd, 2010

    Sorry, haven’t seen in the dustribution folder at the first time. Thank you.

  15. morphocode 6:14 pm on June 5th, 2010

    @msgroom
    Rabbit 0.2 is _not_ compatible with GH 0.7. Rabbit was released before GH 0.7 which introduces some major changes in the API.
    We plan to release a compatible version soon.

    Best

  16. guillermo 6:59 pm on August 25th, 2010

    oh that’s really good, i’ll wait for these new version before change to grasshopper 0.7

    thank’s

  17. morphocode 4:40 pm on August 31st, 2010

    we already migrated Rabbit for GH 0.7, but there are still a few things to improve/implement before releasing the new version.

    Thanks for your interest!

    Best,
    morphocode

  18. daemonix 4:03 pm on November 13th, 2010

    News about an updatred version?

Leave a Reply