LSystems_OpenGL

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

README.md

LSystems_OpenGL

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
_begin_grammar
(grammar information)
_end_grammar

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

A:p

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

Symbol meanings section
_begin_symbol_meanings
(symbol meanings)
_end_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:

draw
F

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

draw
A
draw
B

Angle configurations section
_begin_config
(configuration information)
_end_config

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.

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

change_angle
(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