Figure 1: Example of a flower L-System (23 iterations)

Starting the program

You can start the program by calling from the root directory of the program in a console:

  [bioschematics]~$./src/bioschematics scm/file.cfg

where file.cfg is a configuration file (you can find examples in the cfg directory). If no file is given, the program will use the file start.cfg .

It is possible to install the program in /usr/local or anywhere else. In this case, you need to define a variable BS_HOME giving the directory where the program will find the cfg/, scm/ and properties/ directories.

Once the program lauch, you can control the 3D model using the mouse or the keyboard. Pressing 'h' on the keyboard will bring up a help window. Pressing the left mouse button will bring up a menu where you can change the mode, load plugins, and export pictures.

Controlling the window


Modes define the behavior of the arrow keys. Modes can be switched by typing the letter m. Two modes are available: Turn mode and Move mode.

Figure 2: The same object as Fig. 1 but drawn
after 8 iterations only.

In the three modes, Page Up and Page Down keys zoom in and out.

In either mode, moving the mouse horizontally with the left button pressed turns round the object around the y axis. Moving the mouse vertically with the right button pressed zoom in or out.


Lights are controlled by the function keys. 3 lights are available in the window and can be switched on or off by typing the corresponding function key (F1 for Light 1, F2 for light 2...) At the beginning of the program, only Light 1 is switched on.
Light 1 is a white ambiant light . Light 2 and 3 are yellowish directionnal lights.

Other keys

Pressing the q key exits the program.
Pressing the h key pops up a help screen.
Pressing the a key will animate the L-System object from iteration 1 to the current one.

Definition of an L-System object

Note: I strongly encourage the reader to read Prusinkiewicz & Lindenmeyer book The algorithmic beauty of plants to understand the principles of L-system grammar. The Links section gives also a few sites where definitions and tutorials can be found.

Configuration file

The configuration file is a Scheme file calling every function needed to draw an L-System object.

(load "../properties/borrago.scm")

(set-gl-parameters 10 10)
(set-color-material 0.2 1.0 0.5)
(read-radius 0.05)
(schematize (gls 7 '((& 90)(X 0.2))))

These are the instruction needed to draw the above screenshot.
The first instruction is the definition of the property function characteristic of the object to draw. It can be written in the configuration file or in a separate file that can be called by several configuration files. Some examples of property files are given in the property directory.
The other functions are specific to the drawing (e.g. specific GL parameters, initial colors and cylinder radius).
The last function call the L-System interpreter. 7 is the number of iterations and ((& 90)(X 0.2)) is the seed.

Property function

The property function is called list-of-props and contains every properties of the object to draw.

(define x 0)
(define angle 20)
(define list-of-props

     ((X x))
     ((F x) ((set-color-material 1 0.5 0.5) (+ 20) (form-bud 0.4 1) ((set-color-material 1 0.5 0.5) (- 20) (form-bud 0.4 1)) (^ angle) (X x))
     ((^ angle))
      ((^ (* angle 2)))
     ((form-bud y z))
     ((form-bud (* y 1.1) (* z 1.1)))
     ((F x))
     ((F (* x 1.5) ))

For example, this code is the property file needed to draw the image above. It first defines a variable x that will be used to grow the F segment.