Created: 2014-05-18 19:03
Updated: 2014-10-30 13:59


L-System fractals programmed in C using OpenGL.

Install OpenGL.
sudo apt-get install freeglut3-dev

To run:

  1. make
  2. cd bin
  3. ./lsystems (path to an l-system configuration file) (number of iterations)
    For example: ./lsystems ../grammars/dragon_curve.lst 18

How to create a .lst file

The file has three sections

  1. Grammar
  2. Symbol Meanings
  3. Angle configurations

Each section is detailed as follows:

Grammar section
(grammar information)

It contains the context free grammar for your L-system fractal. Each gramamr symbol is always a single character. The first non terminal of the first statement is always the start symbol. The production rules are specified as


where A is the non terminal and p is the production.

Symbol meanings section
(symbol meanings)

The section can has five types of symbol meanings

  1. draw
  2. increase_angle
  3. decrease_angle
  4. stack_push
  5. stack_pop

The symbol being specified for an action is written in the next line after the action.
For example, if 'F' is a grammar symbol which means 'draw a line', it can be specified as:


Multiple symbols cannot be accomodated after an action. They have to be written separately.
For example,


Angle configurations section
(configuration information)

This contains angle specifications (initial angle and angle change with every corresponding symbol read) to draw the fractal. Written in the same line-wise way as the previous section.

(initial value for the angle of the line to be drawn, to be specified in degrees)

(value that the angle changes after every increase_angle or decrease_angle symbol is encountered, in degrees)

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more