Please try out this LSystems program written in Java. You must be using a Java compatible web browser to access it.
The source code for this applet can be downloaded
Lindenmayer systems (L-systems) provide an easy way for creating very complicated images such as fractals and trees through the specification of a few production rules. Given a starting string, angle factor, scale, depth of derivation and the production rules to apply, the application iteratively applies production rules in parallel to the symbols in the starting string.
This demo is based on the program and sample L-systems presented in Przemyslaw Prusinkiewicz and Jim Hanan, Lindenmeyer Systems,
Fractals, and Plants, Lecture Notes in Biomathematics 79, Springer-Verlag, Berlin 1989,1992
How to Use This L-systems Application
In order to run an L-systems derivation the user must first specify the attributes of the derivation to be run. These attributes are:
- the axiom (starting string)
- the depth, which is the depth of derivation to be applied (the number of parallel applications of the production rules to be performed)
- the angle, which specifies the angle of rotation when rotating right or left. This value is not given in degrees, but rather as the number of rotations in 360 degrees (e.g. to specify single rotations of 20 degrees, provide an angle of 360/20=18)
- the ignored characters, which are the characters to be ignored when comparing left and right context for a predecessor in a production rule. Usually these would consist of the characters specifying turtle movement (except for ' [',']') and controls for color and line width
- the scale factor, which is the size of the finished drawing in the screen where 1 is the smallest and 100 is the largest
- the start color, which is the number of the color to begin with. Look at the provided color bar to choose an appropriate color number.
- the line type, allowing for straight lines, Hermite curved lines and BSplines
- the production rules, which are the rules to be applied in parallel during each L-systems iteration. Production rules are of the form:
left context < predecessor > right context --> successor
where left and right context can be omitted by specifying the '*' character
which stands for the null string
All of these entries are specified by entering the values in the provided text entry boxes, except for the production rules. Production rules are shown in a list box and can be added by entering a new production rule in the rules edit box (below the list box) and pressing the Add button. In addition, rules contained in the list box can be updated or deleted by selecting the list box entry, causing the rule to appear in the rules edit box. This rule can then be adjusted and updated in the list box by pressing the Update button, or removed from the list box by pressing the Delete button. Pressing the Clear button allows for an entirely new L-system specification to be entered, clearing all of the current parameters.
Within the production rules the following turtle movements and options can be specified:
- +...this is a clockwise (right) rotation
- -...this is a counter clockwise (left) rotation
- |...this tells the turtle to go in the reverse direction
- F...this tells the turtle to go forward one step, drawing a line
- f...this tells the turtle to go forward one step, not drawing a line
- [...tells the turtle to branch off, saving its current position for later movement
- ]...tells the turtle to restore the position it had prior to the branch
- #...increases line width by one
- !...decreases line width by one (minimum width of one)
- ;...increases the color number by one
- :...decreases the color number by one
Some example L-systems are provided in a list box on the left of the control panel.
They can be selected by clicking on the desired item in the list box.
Once the L-system has been specified, as mentioned above, press the Apply button to create the drawing.