210 likes | 409 Views
Taku Komura. L-System. What is an L-System ?. Lindenmayer system, or L-System, was introduced in 1968 by the biologist Aristid Lindemmayer Conceived as a mathematical theory on plant development. In the 'bible' of L-Systems, ``The Algorithmic Beauty of Plants'' he wrote:
E N D
Taku Komura L-System
What is an L-System ? Lindenmayer system, or L-System, was introduced in 1968 by the biologist Aristid Lindemmayer Conceived as a mathematical theory on plant development. In the 'bible' of L-Systems, ``The Algorithmic Beauty of Plants'' he wrote: ``The central concept of L-systems is that of rewriting. In general, rewriting is a technique for defining complex objects by successively replacing parts of a simple initial object using a set of rewriting rules or production.''
L-Systems Expanding the strings based on the deterministic rules The rewriting process start from an initial string called the axiom. At each derivation step, all letters in the current string are replaced simultaneously by applying their associated productions. L-System is defined as a tuple Variables Constants Axiom Rules
Example Variables: a, b Constants: none Axiom : a Rules: a->b, b->aa How does it go on then? Step #0 : a (axiom) Step #1 : b // a -> b Step #2 : a a // b -> aa Step #3 : b b // a -> b Step #4 : a a a a // b -> aa Because there is exactly one rewriting rule for each letter, the resulted strings will be deterministic . Because each letter was replaced regardless what neighbours it has, the rewriting rules arecontext-free
Exercise • Variables: a, b • Constants: none • Axiom : a • rules: a->aba, b->bbb • Solution • Step #0 : a (axiom) • Step #1 : aba • Step #2 : aba bbb aba • Step #3 : aba bbb aba bbb bbb bbb aba bbb aba • Step #4 : ...
Turtle interpretation of L-strings A turtle is sitting on a sheet of paper facing in a certain direction, The tail of the turtle is a bit dirty. Thus, it leaves a trail along the paper. By interpreting a L-string, the turtle leaves the trail along the paper
Turtle interpretation of L-strings • In 2D, for example, the state of the turtle is defined by its position and its heading vector • Given the step size d and the angle increment , the turtle's movements can respond to the commands represented by the L-symbols : • F Move forward a step of length d and connect the new position with the last position by a line segment. • + Turn left by angle (counter clockwise) • - Turn right by angle (clockwise).
Example • Variables: a • Constants: +, F • Axiom: a • Rules: a -> a+bF • Solution • Step 0: a • Step 1: a+bF • Step 2: a+bF+bF • Step 3: a+bF+bF+bF
Bracketed L-systems • In order to specify the data structure for presenting axial trees, the concept of ``strings with brackets'' was introduced by A.Lindenmeyer in 1968. The L-system's alphabet is extended by two new commands • [ Push the current state of the turtle onto a stack. • ] Pop a state from the stack and make it the current state of the turtle.
L-System 4 • http://www.geocities.com/tperz/L4About.htm • Tool to create 3D images with L-System syntax
Syntax • Functions • F: Move forward • +: Turn left • -: Turn right • ^: Turn up • &: Turn down • c: Change color • [ ]: Bracket
Sample Program • 4 # number interaction • 45 # rotation angle • 10 # line thickness • A # axiom • A=AF+ # rule • @ # run
Example • 1 • 90 • 25 • A • A=AF+AF-AF-AF+AF • @ • Step = 1 • Step = 2 • Step = 3
Example • 71591YYYY=X&X&X&X&XX&X&X&X&X=[+(90)AB[A]]A=A'BB=F'&FF&F@
Example • 9 • 19 • 25 • >(90)&(90)A • A=U[---P]a • a=U[-P]B • B=U[+++P]b • b=U[+P]A • C=V[-D][+D] • D=V[-E][+E] • E=VV[-G][+G] • G=V-VV • P=WV[-C][+C] • U=f[---f+++X][+++f---Y]FFFFF • V=fFF • W=f[---F++++++F]F • X=FFFF • Y=X • @
Stochastic L-systems To avoid the artificial regularity of models generated by deterministic L-system, variation of turtle interpretation and/or randomization of L-productions are needed.For example, the productions : p1 : a -> (0.7) b a p2 : a -> (0.3) c aare 2 rewriting rules for the letter a. In one derivation step, either p1 or p2 will be applied to each occurrence of a, according to the given distribution (0.7 and 0.3).
Parametric L-systems In order to model continuous phenomena, A. Lindenmeyer proposed that numerical parameters be associated with L-system symbols. Parametric L-system operate on parametric words, which are strings of modules consisting of their symbolic names with associated parameters.
Timed L-systems Changing the state of the leafs as time passes For animation purpose
Conclusion • L-System • Overwrite simultaneously • Tuple • Variables • Constants • Axiom • Rules • L-System 4