| ||||||||||||||
| ||||||||||||||
|
||||||||||||||
|
Lindenmeyer Systems (or L-Systems) are ways of recursively representing geometric shapes. Most interestingly though, L-Systems can be used to represent quite realistic natural shapes, like fern leaves and shapes. This article will look at how L-Systems works, and how they can be recursively expanded to increase the complexity and depth of the shape. These concepts will be demonstrated through the Java applets below. L-System RulesL-Systems Explorer allows you to assign up to 26 recursive rules that are applied to an initial axiom. When the rules are expanded, the following commands are understood:
The user specifies X and theta. You may also use numbers to specify multiple angle increments or decrements - therefore, the following two statements are equivalent: "4+F" and "++++F". A final clarification, the '|' command is a little strange. It differs from the F command because it is not recursively expanded. When an F is reached, it is often substituted for whatever the F-rule specifies, and the segment length is decreased by a certain percentage, therefore the only F-commands that get interpreted are the commands at the final depth. This is not so with the '|' command, allowing a little more control over the segment lengths. Small ExampleHere is a small example to show how the rules can be applied recursively. Axiom: F F-Rule: -[F+F]F Applied L-SystemsFirstly, let us take a look at a simple tree/fern-like structure: Axiom: F F-Rule: |[+F]|[-F]+F So, under the first iteration the L-System would just draw a straight line, since it will only render the axiom, F. The next iteration would render |[+F]|[-F]+F. Try to visualize what this would look like. The system would render a line forward, draw a line to the right, continue forward, and draw a fork at the end. As the system's recursive depth goes deeper and deeper, the drawing gets more complex, but self-similar. Use the Java applet below to help you understand the concept further. Clicking on the applet will increase the complexity of the system. Notice how the system seems to "grow".
While the first example looks remotely natural, the following is much closer to a natural fern leaf. Obviously the F-Rule is fair bit more complex, but still easy to understand: |[5+F][7-F]-|[4+F][6-F]-|[3+F][5-F]-|F. Again, take a look at the Java applet below and increase the depth up to 5 to appreciate how well this rule can represent a fern leaf.
We should probably also look at an example of complex geometry. The Java applet below demonstrates a very complex rule with six different recursive rules: Axiom: Q P-Rule: --FR++++FS--FU Q-Rule: FT++FR----FS++ R-Rule: ++FP----FQ++FT S-Rule: FU--FP++++FQ-- T-Rule: +FU--FP+ U-Rule: -FQ++FT-
ConclusionHopefully this article has demonstrated the relatively simplicity of L-Systems, as well as how they can be used to produce both natural and geometric shapes. If you are interested in exploring L-Systems further you can look at L-Systems Explorer, an Windows application that allows for interactive exploration.
Submitted: 21/02/2004 Article content copyright © James Matthews, 2004.
|
|
|||||||||||||
All content copyright © 1998-2007, Generation5 unless otherwise noted.
- Privacy Policy - Legal - Terms of Use -