L-Systems were originally developed in 1968 by Hungarian Aristid Lindenmayer (hence the “L” in “L-Systems”). Lindenmayer, a botanist, originally developed the grammar to model plants, for which L-Systems are still employed today. But, since L-Systems simply follow a set of rules, you can change those rules to model almost any system you can imagine. I haven’t seen it done in Flash before so I decided to take a stab at an AS3 Lindenmayer system!

In this system, there are 5 variables and 6 constants:
- F: Move Forward
- f: Move Forward (no draw)
- G: Move Forward
- B: Move Backward
- b: Move Backward (no draw)
- +: Turn Left
- -: Turn Right
- &: Pitch Up
- ^: Pitch Down
- <: Roll Left
- >: Roll Right
Rule Syntax:
axiom : [symbols]
ie: F:F+F (F yields Forward – Turn Left – Forward)
The 3D view implements my Line3D class – creating a line for each branch of the system.Since there is plenty of information on L-Systems, I won’t go into detail on the methods implemented. Check out http://en.wikipedia.org/wiki/Lindenmayer_system for more information. Some things to note:When in 2D mode – crank up the iterations! You can really get some cool designs. When in 3D Mode, keep the iterations low. Since every line is rendered every frame, you can bring Flash to a stop really quickly. Check out the samples by double clicking them. They should be a good place to start writing your own
Let me know if you have any systems that you either discovered or just know and I’ll add them to the samples (with credit)! Happy Ruling!
9 Comments, Comment or Ping
Love those stuff.
I did not know that way of processing rules. Cellular automatons brings some results as the one you show up but rules are defined differently. Thanks for sharing this.
September 5th, 2007
Actually a bunch of people have done L-Systems in Flash.
The first reference that I can find is where myself and another group of people worked on them (were-here.com archives). After that, davis at praystation did some stuff as well.
good work though. you should check out some of the code from the were-here forums … or I can send you some optimized and higher level parsers if you’re interested. the biggest thing with l-systems is performance. DOL systems are even tougher on the processor in flash.
I’ve got that algorithmic beauty of plants soft cover sitting on my shelf waiting to get dusted off.
September 5th, 2007
this is really tight! line3D is sweet! heres my rule set:
length:8
iterations:8
angles: 90
axiom: F
rules: F:F+B-X-B+F
X:G+X+G
September 5th, 2007
My current papervision test app on http://www.reversefold.com also implements the dragon curve (choose Textured / Checker with Dragon), although as a BitmapMaterial and not as lines.
September 5th, 2007
[@Jon] – I stand corrected! I hadn’t seen many in my ventures on the web. DOL is the easiest to implement (and let people modify) – and I’m not too concerned with processor use in generating the system since this was basically just the first step towards my Papervision L-System – and Papervision can’t handle more than about 3,000 lines. Thanks for the info though – I would love to see what you guys have done – particularly if you have any 3D systems!
.
[@xero] – Glad you liked it xero – I’ll add your rule to the list
September 5th, 2007
Hi,
Alex Cove have already implemented L-Systems.
See
http://www.cove.org/default.aspx?id=1&sid=3&mid=2.
But nice work anyway!
David
September 10th, 2007
This flash implementation is very spiffy and fast.
I implemented a HTML canvas version you can read about here: http://hardlikesoftware.com/weblog/2008/01/23/l-systems-in-javascript-using-canvas/
January 23rd, 2008
Is there anyway of running this with a new papervision3d version?
What version did you use?
August 13th, 2009
Hi,
Just wanted to share with you that I made an interactive implementation of L-Systems called Elise, that is based on the ideas outlined in your code. Afterward I have totally rewritten it but it was nice to get a head start
You can download it for free here (Adobe AIR):
http://www.studioludens.com/elise/
Hope you enjoy it!
Alexander
July 21st, 2010
Reply to “L-Systems and Papervision (Beta)”