L-Systems - Introduction http://ai.toastbrot.ch/life/intro.php Artificial Life - Term Project · L-Systems · marc mathis & ivo schindler forward main Introduction This page is an overview and introduction to Lindenmayer- (L-) Systems with some examples. First we will show some easy to understand samples creating squares, stars etc. Then we will move on to the famous Koch-, Hilbert-, Dragon- curve and finish by creating real plants, always using the Lindenmayer formalism. In 1968, Aristid Lindenmayer introduced this formalism especially for modeling and simulating the development of plants. L- Systems are also used in computer graphics to generate complex images from simple rules, for example fractal objects (Koch, Hilbert, Dragon- curve). As you will see, it is very closely related to formal languages. The easiest way to imagine the rules of L- systems is by using pictures and the most common way to paint them is Turtle graphic. Entering the depth of derivation, an angle factor, a starting string (Axiom) and the production rules, the application starts drawing your input. We use a nice java applet which starts drawing the first iteration, when you click on it and so on. In the section "Play yourself" where you can experiment with your own set of rules. The L-System Let us show you a very simple example of a production system: Axiom : A Angle : 45° Rule 1: A=BF Rule 2: B=FA 1. We always start with the Axiom. Here it is: A 2. The only rule which we can apply is the "A=", Rule 1. By replacing A with the righthand side of this rule we get: BF 3. Furtheragain we apply "BF" on the given rules and so we replace "B" (We don't replace "F", because there are no rules for "F"). We get FAF 4. In "FAF" we can replace "A" again and we get 1 of 3 10/8/03 3:39 PM
L-Systems - Introduction http://ai.toastbrot.ch/life/intro.php FBFF 5. and so on... FFAFF FFBFFF Now this is a simple mathematical formalism. To interpret these symbols we give them some meanings, like "F" means draw a straight line with length 1. "A" and "B" are just variables which we define with the rules. In our example above we get a straight line which always gets longer and longer. Nothing special, was just an example to show how to adjust the rules to the axiom. It is also possible to turn the turtle: " + " means turn left 45° (specified with the Angle in the production system). " - " means turn right . Furthermore by using " [ " we can save a position and direction of the turtle and return to the last saved by " ] " . This function is very important for creating real plants . In our pages we relate on the syntax below: Typical Set of Commands: here the syntax used in L-System 5 by Timothy C. Perz Drawing: F Draw full unit Z Draw half unit Movement: f Move full unit z Move half unit Orientation: + Turn left - Turn right & Pitch down ^ Pitch up < Roll left > Roll right Special Orientation: | Turn 180 deg % Roll 180 deg $ Roll until Horizontal ~ Turn/Pitch/Roll t Pitch down Structure: [ Store current location ] Return to location { Start polygon shape } End polygon shape 2 of 3 10/8/03 3:39 PM
L-Systems - Introduction http://ai.toastbrot.ch/life/intro.php Increment / Decrement: " Inc. length by 1.1 ' Dec. length by 0.9 ; Inc. angle by 1.1 : Dec. angle by 0.9 ? Inc. thickness by 1.4 ! Dec. thickness by 0.7 Additional: c Increment color index c(x) Set color index to x forward main 3 of 3 10/8/03 3:39 PM
Recommend
More recommend