#2 How To Use L Systems For Plant-Like Structures


To use L-Systems to draw plant like structures, we need to use a more complicated alphabet. For the basic trees in my visualization, I use an alphabet of F, +, -, [, ].

In order to draw things using L systems, our string(genome) is utilized as instructions for a drawing turtle to use. You can think of a drawing turtle as a pencil pressed to a piece of paper, ready to take commands for moving. Using this alphabet, the instructions are as follows.

  • “F” means draw a line from your current position FORWARD a predefined length

  • ”+” means rotate CLOCKWISE a predefined amount

  • ”-” means rotate COUNTER-CLOCKWISE a predefined amount

  • ”[” means SAVE your current position, and direction

  • ”]” means LOAD your last saved position, and direction

Some of the trees include an “X” in the alphabet. This is ignored by the turtle and is only used to store and inject extra commands in the following generation

Using this alphabet with an L system, and letting a turtle draw based on these commands, the two systems work together to create the branching plant-like structures seen in the visualization. With very complicated rulesets, you can get very complex structures resembling everything from flowers to trees to seaweed and coral.

Leave a comment

Log in with itch.io to leave a comment.