Graphics Programming

Ray Tracer development and some more. By Pawel Bokota.

Exploring L-systems

leave a comment »

Some time ago I came across an interesting idea about using a variant of a formal grammar, an L-system, to draw fractals and plants. For those familiar with formal grammars an L-system grammar is defined as such:

G = (V, S, \omega, P)


V is a set of variables
S is a set of constants
\omega is the start axiom
P is a set of production rules

How does an L-system grammar differ from a formal grammar you ask? The difference lies in the way the production rules are applied. A formal grammar generates a language by applying its production rules one at a time. Whereas an L-system grammar generates an L-system by applying as many rules as it can per iteration. Wikipedia has much more on L-systems and formal grammars if you are interested.

What’s amazing about L-systems is that they’re simple concepts but they’re used to model complex natural phenomena such as the growth of plants. We can visually see what L-systems are capable of if we combine them with computer graphics. To accomplish this we give certain symbols of an L-system extra meaning. For example, if an L-System grammar contains a variable F and constants +, - , we can say that the F also means to draw forward, and the +, - also mean to draw left and right by some angle.

The screenshots below are my implementation of L-systems (developed with Java using Swing for GUI).

This one is called a dragon curve
Dragon Curve

An older screenshot of my program generating a plant:


Written by Pawel

August 25, 2009 at 6:14 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: