L-system Tree

software development

For my 3D Computer Graphics course in 2010, I had to create a procedural model as an assignment. We decided to make a tree using L-systems. After a few daws of coding, the result of this assignment is a program which can draw procedural trees using OpenGL. Although OpenGL is nowadays an oldfashioned 3D drawing technique, the result looks quite pretty.

Download L-system Tree v1

  • Three rules that are executed, with probabilities 1.0, 0.5 and 0.5 for execution each iteration. As input only the first character is used. You can use the following characters:

    F
    Draws a branch of length L (this length depends on scale and iteration index)
    -
    Determine elevation with zenith - θ
    +
    Determine elevation with zenith + θ
    (
    Increment drawing direction of azimuth φ
    )
    Decrement drawing direction of azimuth φ
    [
    Opens a subtree (iteration function will be recursively invoked
    ]
    Closes a subtree
  • Seed is the initial string. The seed is used als input for the rules in the first iteration. Only the first entered character will be used.

  • The parameters are to change the shape of the tree. When using different min and max values, the program uses a uniform chosen value between these two values.

  • The Generate button makes a new three using the inserted rules and parameters. Draw leaves shows utterly beautiful triangular leaves at the branches that were created in the last iteration

  • The Play and Stop buttons start/stop the tree from rotating.

  • The Reset button resets all input fields to the initial state and clears the screen. Quit closes the windows and exits the program.

L-system tree drawing screen

images/lsystemtree/options.png