# Lindenmayer L-System

In 1968 Aristid Lindenmayer developed a descriptive system for fractal modeling of plant leaves and branches. It's usually called an L-system It can be used more generally for many kinds of fractals.

This applet. This page has an applet to illustrate 2-dimensional L-systems. You can manipulate the rules on the system to construct different fractals. The system begins with one rule having two branches. The rule appears on the left while the fractal it describes appears on the right.

The rule appears as three flags, each flag consisting of a line with an attached triangle. You can think of the line as being a flagpole and the triangle being the flag flying on the pole.

The base flag is the larger one on the left. It can't be changed. It's just there as a reference. At the right end of the base flag there are two smaller flags, one pointing up to the right, the other down to the right. Each names one planar transformation for the rule.

The flag pointing to the upper right describes the planar transformation which is the composition of a translation to the right (move the base flag to the right), a contraction (to make the base flag smaller), and a rotation counterclockwise 45° (so that it points up to the right). The other flag pointing to the lower right describes another planar transformation which is the same as the first except that the 45° rotation is taken clockwise.

If you start with a line segment on the flagpole of the base flag, these two transformations move it to line segments on the smaller flagpoles. Next if you take these two line segments and apply the original rule to the two smaller flags, then they'll be moved to four shorter line segments. A third application yields eight even shorter line segments. Altogether, that gives the tree on the right which has 1 + 2  4 + 8 = 15 line segments of various lengths. That's the level three tree.

Controls on the applet. You can change the level of the tree with the buttons for "level up" and "level down". At high levels, the tree appears fractal. You'll want a higher level than 3, the level it starts at.

You can change the two smaller flags in the rule by dragging points on them. (1) If you drag the point at the top of the flagpole of a smaller flag, you can make its flagpole taller or shorter, and you can change the rotation associated to the rule. (2) If you drag a point at the tip of the flag, you can stretch and squeeze the flag, make it droop more or point upward more, and even move it to the other side of the flagpole. (3) If you drag the midpoint of the flagpole, you can move the entire flag around. These all will affect the fractal tree generated by the rule.

If you want to reset the rule to its initial position, type the letter "r" for reset, or press the space bar.