L-System fractals programmed in C using OpenGL.
sudo apt-get install freeglut3-dev
- cd bin
- ./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
- Symbol Meanings
- Angle configurations
Each section is detailed as follows:
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
The section can has five types of symbol meanings
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.
Angle configurations section
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)