Basic Principles

Suppose that we have the triplet (x,y,a), where the first two components (x,y) represent the current position in Cartesian coordinate, and a is angle, representing the current direction in which we are facing. Given the step size d and the angle augment b, the we can respond to the commands represented by the following symbols:

F

   

Move forward a step of length d. The state of our position are changes to (x',y',a), where x'= x + d cos(a) and y'= y + d sin(a). A line segment between points (x,y) and (x',y') is drawn.

+

   

Turn left by angle b. The next state of the position is (x, y, a+b).

-

   

Turn left by angle b. The next state of the position is (x, y, a-b).

The key idea of L-system is rewriting recursively, which means we replace the variable symbols by applying a set of replacement rules simultaneously. So, L-System consists of four components:

variables:

   

is a set of symbols containing elements that can be replaced;

constants:

   

a set of symbols containing elements that remain fixed;

axiom:

   

is a string of symbols from variables defining the initial state of the system, also referred as start or initiator;

production rules:

   

it defines the way variables can be replaced with combinations of constants and other variables. A production consists of two strings - the predecessor and the successor.

Here is an example from WIKI:

variables :

F

constants :

+ -

start :

F

rules :

(F = F+F-F-F+F)

F means “draw forward? + means “turn left 90°”, and - means “turn right 90°”.

n = 0: F

n0

n = 1: F+F-F-F+F

n1

n = 2: F+F-F-F+F+F+F-F-F+F-F+F-F-F+F-F+F-F-F+F+F+F-F-F+F

n2

n = 3: F+F-F-F+F+F+F-F-F+F-F+F-F-F+F-F+F-F-F+F+F+F-F-F+F+ F+F-F-F+F+F+F-F-F+F-F+F-F-F+F-F+F-F-F+F+F+F-F-F+F- F+F-F-F+F+F+F-F-F+F-F+F-F-F+F-F+F-F-F+F+F+F-F-F+F- F+F-F-F+F+F+F-F-F+F-F+F-F-F+F-F+F-F-F+F+F+F-F-F+F+ F+F-F-F+F+F+F-F-F+F-F+F-F-F+F-F+F-F-F+F+F+F-F-F+F

n3

Interfaces

This is the panel for L-System variables:

l-sys_pan

You can specify all the values of ELS's components, in the corresponding text boxes. Please note that the axiom and rules box can receive up to 16 and 36 letters respectively, order and angles box can only receive integer, you are not encouraged to input a number larger than 15 for order, that may couse the program crash.

If you would like to add random offset to angle or length, you can tick the check buttons, and then the edit control will be enbled, only the integer from 1 to 100 will be accepted, for example:

suppose the value of angle is 90 degree, and 50 (%) for the range of angle’s random offset, then the random offset’s range will be [- 90?.5, 90?.5], namely [-45,45] degree,the same principle applied to the length.

This is the panle for color, you can click the 'edit' button to open the color selector, and then pick a color for one line. Only if you click 'OK' button, the setting will be kept.

color_pan

This is the basic line panel and line editer:

line_pan

line_editer

You can press the left button of mouse and meanwhile move the mouse to change the starting piont's control point, and right button for end point's control point.

After you set up all the necessary information of ELS, you can click 'Apply' button in the main panel to generate the graphics:

button

This is the panel for animation editing:

anim_editer

By default, there are only 40 frames, if you need more, you can enter the amount you want, and then click the ‘Add?button.

When you select a frame in this control, if there is not a key frame, the scroll bars will be disable, you can insert/remove a frame by double clicking the left button of mouse or cliking the right button, and operating on tha pop menu. The selected frame position will be labeled by green cross lines, and the small brown point indicates that there is a key frame inserted.

The small window on the bottom is just a sample, just for giving a sense about the number you selected. The lines showed here are fixed to straight lines.

After you set up the parameters for animation, you can click 'Animate' button to generate the animation. Besides, you also can change the speed of the animation by switching the frame rate:

Specifications

alphabet:

'A','B','C','D','E','F'

 

these letters mean go forward by one step and draw a line.

'G'

 

it means it means go forward by one step without drawing.

'['

 

means store the current state.

']'

 

means assign the current state to the most recently stored state. '[' and ']' must be used as a pair, except that you are aware about what you are doing.

'+'

 

means trun left, namely increasing the current angle by plusing AngleL.

'-'

 

means turn right, namely decreasing the current angle by plusing AngleR.

'W','X','Y','Z'

 

these letters will not cause any change to the current state, they can only be replaced.

'~'

 

means flip the line, the reflection axis is the direction of the line's starting point. Please note that this symbol will switch the global state, that means all the following commands will be interpreted in this way until ‘~?appears again.

Note: The initial angle of ELS is 0, means the initial direction is facing positive y-axis (up the screen).

You are strongly recommended to start by looking at the examples in the library included with the program, if you've never heard of L-System before.