View source
From GenerativeArt
for
L-systems II
Jump to:
navigation
,
search
__FORCETOC__ == A reminder about "The Algorithmic Beauty of Plants" == Essentially all of the information presented here, including illustrations and diagrams, are derived from the classic on the topic "The Algorithmic Beauty of Plants." That book is now available in .pdf form online. To access that book click on the above link. == Types of L-systems used in Generative Art == All L-systems operate via "rewriting." Rewriting is a string matching and replacement method that occurs all-at-once and in parallel rather than character by character from left to right. There are different types of L-Systems differentiated by the kinds of replacement methods they use. Note that where there is no production rule for a given character, that character is simply copied as part of the string replacement. * Bracketed OL-systems: these systems are deterministic and context free. The use of bracket notation allows the use of a stack that can remember and return to previous locations and headings. * Stochastic OL-systems: these systems are also context free but not deterministic. Rather than using a single mapping from predecessor to replacement string, these systems allow multiple replacements strings each with a probability of selection. * Context Sensitive L-systems: these systems are deterministic but add the use of angle-brackets to either side of the strict-predecessor. To trigger replacement the context prior to and after the strict-predecessor must also match. Such systems can simulate the transmission of signals up and down the resulting tree. * Parametric OL-systems: these systems add one or more floating point quantities within parenthesis to one or more letters creating a predecessor word. In addition a test is applied to the corresponding quantity. Such systems allow the creation of non-quantized lengths for stem segments. * Parametric 2L-systems: these systems combine parameters and context sensitivity. Such systems can simulate models that involve the diffusion of substances throughout the tree. * Other Stochastic L-systems: as a practical matter a stochastic element can be added to any combination of context sensitive and parametric features. == Modeling using L-Systems in 3 Dimensions == Models intended for 3D modeling add turtle graphic control symbols to extend heading operations to 3D space. All other control symbols remain the same. Other, and satisfy the equation H x L = U. Rotations of the turtle are then expressed by the equation [H' L' U']=[H L U] R where R is a 3 x 3 rotation matrix Specifically, rotations by angle α about vectors U, L and H are represented by the matrices: | cos α sin α 0 | R<sub>U</sub>(α) = |-sin α cos α 0 | | 0 0 1 | | cos α -sin α 0 | R<sub>L</sub>(α) = | 0 0 1 | | sin α 0 cos α | | 1 0 0 | R<sub>H</sub>(α) = | 0 cos α -sin α | | 0 sin α cos α | The following symbols control turtle orientation in space + Turn left by angle δ, using rotation matrix R<sub>U</sub> (δ). - Turn right by angle δ, using rotation matrix R<sub>U</sub>(-δ). & Pitch down by angle δ, using rotation matrix R<sub>L</sub>(δ). ^ Pitch up by angle δ, using rotation matrix R<sub>L</sub>(-δ). \ Roll left by angle δ, using rotation matrix R<sub>H</sub>(δ). / Roll right by angle δ, using rotation matrix R<sub>H</sub>(-δ). | Turn around, using rotation matrix RU(180°). {{SingleImage|imageWidthPlusTen=510|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/lsys2/01.jpg|caption=}} == How context sensitive L-systems transmit signals == Here is a simple example of signal transmission: The following sample L-system makes use of context to simulate signal propagation throughout a string of symbols: w: baaaaaaaa p1: b < a → b pg: b → a The first few words generated by this L-system are given below: baaaaaaaa abaaaaaaa aabaaaaaa aaabaaaaa aaaabaaaa For fully animated growth models see "Timed DOL-systems" in section 6.1 of The [http://algorithmicbotany.org/papers/#abop Algorithmic Beauty of Plants.] == How parametric (context free) OL-systems work == Here is a simple example of a parametric (context free) OL-system: ω : B(2) A(4, 4) p1 : A(x, y) : y ≤ 3 → A(x × 2, x + y) p2 : A(x, y) : y > 3 → B(x) A(x/y, 0) p3 : B(x) : x < 1 → C p4 : B(x) : x ≥ 1 → B(x - 1) {{SingleImage|imageWidthPlusTen=290|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/lsys2/02.jpg|caption=}} Here are the extended control symbols used in a 3D parametric L-system <table> <tr> <td valign="top" width="10%"><i>F</i>(<i>a</i>)</td> <td>Move forward a step of length <i>a</i> > 0. The position of the turtle changes to (<i>x', y', z'</i>), where <i>x'</i> = <i>x</i> + <i>aH<sub>x</sub></i>, <i>y'</i> = <i>y</i> + <i>aH<sub>y</sub></i> and <i>z'</i> = <i>z</i> + <i>aH<sub>z</sub></i>. A line segment is drawn between points (<i>x, y, z</i>) and (<i>x', y', z'</i>).</td> </tr> <tr> <td valign="top" width="10%"><i>f</i>(<i>a</i>)</td> <td>Move forward a step of length a without drawing a line.</td> </tr> <tr> <td valign="top" width="10%">+(<i>a</i>)</td> <td>Rotate around U by an angle of <i>a</i> degrees. If <i>a</i> is positive, the turtle is turned to the left and if a is negative, the turn is to the right.</td> </tr> <tr> <td valign="top" width="10%">&(<i>a</i>)</td> <td>Rotate around <i>L</i> by an angle of <i>a</i> degrees. If <i>a</i> is positive, the turtle is pitched down and if <i>a</i> is negative, the turtle is pitched up.</td> </tr> <tr> <td valign="top" width="10%">/(<i>a</i>)</td> <td>Rotate around <i>H</i> by an angle of <i>a</i> degrees. If <i>a</i> is positive, the turtle is rolled to the right and if <i>a</i> is negative, it is rolled to the left.</td> </tr> </table> {{SingleImage|imageWidthPlusTen=702|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/lsys2/03.jpg|caption=}} {{SingleImage|imageWidthPlusTen=728|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/lsys2/04.jpg|caption=}} == How parametric (context sensitive) L-systems work == Here is a simple example of a parametric 2L-system: Productions in parametric OL-systems are context-free, ie., applicable regardless of the context in which the predecessor appears. A context- sensitive extension is necessary to model information exchange between neighboring modules. In the parametric case, each component of the production predecessor (the left context, the strict predecessor and the right context) is a parametric word with letters from the alphabet V and formal parameters from the set E. Any formal parameters may appear in the condition and the production successor. A sample context-sensitive production is given below: A(<i>x</i>) < B(<i>y</i>) > C(<i>z</i>) : <i>x</i> + <i>y</i> + <i>z</i> > 10 → E((<i>x</i> + <i>y</i>)/2)F((<i>y</i> + <i>z</i>)/2) It can be applied to the module <i>B</i>(5) that appears in a parametric word …<i>A</i>(4)<i>B</i>(5)<i>C</i>(6)… Because the test succeeds symbol replacement is made as follows (assuming "A(4)" and "C(6)" are not also words requiring replacement): ((<i>x</i>+<i>y</i>)/2) = ((4+5)/2) = 4.5 ((<i>y</i>+z)/2) = ((5+6)/2) = 5.5 …<i>A</i>(4)<i>E</i>(4.5)<i>F</i>(5.5)<i>C</i>(6)… == Artistic use of L-Systems == One of the problems with using L-System is that they are difficult to build with a specific end design in mind. This is one reason why evolving L-Systems using genetic algorithms is so useful. It allows the artist to "steer" the result towards a desired goal. {{SingleImage|imageWidthPlusTen=962|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/lsys2/05.jpg|caption=}} {{SingleImage|imageWidthPlusTen=846|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/lsys2/06.jpg|caption=}} {{SingleImage|imageWidthPlusTen=919|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/lsys2/07.jpg|caption=}}
Template:SingleImage
Return to
L-systems II
.
Views
Page
Discussion
View source
History
Personal tools
Log in
Navigation
Main Page
Community portal
Current events
Recent changes
Random page
Help
Search
Toolbox
What links here
Related changes
Upload file
Special pages