Upload
osuntzuo
View
222
Download
0
Embed Size (px)
Citation preview
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
1/34
8. L-Systems
8.1
L-Systems
Christoph Traxler 1
L-Systems
Christoph Traxler 2
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
2/34
8. L-Systems
8.2
Christoph Traxler 3
Christoph Traxler 4
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
3/34
8. L-Systems
8.3
L-Systems
Introduced 1968 by the biologistAristid Lindenmayer as a
development of simplemulticellular organisms
Subsequently applied to investigate higherplants and plant organs
Christoph Traxler 5
L-systems initialy generated the topology ofplants as a result of discrete development
L-Systems
Prusinkiewicz extendedL-systems in various ways:
-
Timed L-systems
Open L-systemsSimulation of ecosystems
Christoph Traxler 6
allows detailed modeling and a realisticvisualization of plants
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
4/34
8. L-Systems
8.4
L-Systems
L-systems are parallel rewriting systemsoperating on strings of symbols
- , , where
A is a finite set of symbols called alphabet
A+ is a non empty word called axiom
*
Christoph Traxler 7
s a n e se o pro uc ons
L-Systems
A production is written as av and meansthat each occurence of the symbol a in the
In a derivation step all symbols of the
current string are replaced simultaneouslyby the proper production
Difference compared with Chomsky-systems:
Christoph Traxler 8
Only one symbol is replaced in eachderivation step
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
5/34
8. L-Systems
8.5
L-Systems
If there exists no production for a symbol athen the identic production aa is applied
an L-system is called formal language of theL-system
An L-system is called deterministic (dL-system) if and only if there exists for each a
Christoph Traxler 9
A exactly one vA* so that av
L-Systems
Example:{a,b,c};a;{p1:aab,p2:bac}0 = a
1 = ab
2 = ab ac
3 = abacabc
4 = abacabcabacc
Christoph Traxler 10
ow are er ve str ngs trans orme nto agraphic ?
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
6/34
8. L-Systems
8.6
Turtle Graphics
The turtle is a drawing tool for the geometricinterpretation of a derived string
specific commands for certain symbolsand changes its state
Its state is defined by the triplet (x,y,),where x,y defines its position on the plane
Christoph Traxler 11
and the angle its orientation
Turtle Graphics
The turtle obeys to the following commands:
F draw a line of length d, the state
changes to (x+d cos, y+d sin, )
f move forward a step of length d without
drawing+ turn left by angle , the state changes to
x +
Christoph Traxler 12
- turn right by angle , the state changes
to (x,y,-)
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
7/34
8. L-Systems
8.7
Turtle Graphics
Starting conditions for the turtle:Initial state, d and
- - - - - ,d=1, =90
F
Christoph Traxler 13
+ -start
Classic Fractals by L-Systems
Using the turtle commands as alphabet
Construction of Kochs island:
= , epen s on er va on eng
= F--F--F //Initiator
F F+F--F+F //Generator
Christoph Traxler 14
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
8/34
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
9/34
8. L-Systems
8.9
Classic Fractals by L-Systems
Space Filling Curves
Node Replacement: Using additional symbols
derivation
Construction of the Hilbert curve
Christoph Traxler 17
L+RF-LFL-FR+ R-LF+RFR+FL-:L
Classic Fractals by L-Systems
Hilbert curve
Christoph Traxler 18
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
10/34
8. L-Systems
8.10
Branching Structures
The turtle constructs objects incrementaly,thus there must be a mechanism to move it
This is achieved by additional commands:
[ push the state of the turtle onto a stack
] pop the last state from the stack and
make it to the current state of the turtle
Christoph Traxler 19
Can be used to store and restore otherinformation as well
Branching Structures
2nd order branchterminal node
branching point
1st order branch
Christoph Traxler 20
F[+F][-F[-F]F]F[+F[+F][-F][-F]
segment
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
11/34
8. L-Systems
8.11
Branching Structures
n=5,=25.7:FFF[+F]F[-F]F
Christoph Traxler 21
n=5,=20:FFF[+F]F[-F][F]
Branching Structures
Node replacement
n=7,=20
:X F[+X]F[-X]+XF FF
Christoph Traxler 22
n=5,=22.5
:XX F-[[X]+X]+F[+FX]-XF FF
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
12/34
8. L-Systems
8.12
Non Deterministic L-Systems
At least one symbol has more than oneproduction
one of the productions for each symbolduring derivation:
Stochastic L-systems
Context sensitive L-systems
Christoph Traxler 23
Parametric L-systems
Stochastic L-Systems
Different productions for a symbol areselected randomly
number is used for each symbol
A probability is assigned to each productionUsed to generate variations among individualsof a s ecies
Christoph Traxler 24
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
13/34
8. L-Systems
8.13
Stochastic L-Systems
: Fp1: F
F[+F]F[-F]F: F F +F F
p3: F F[-F]F
Christoph Traxler 25
Stochastic L-Systems
Christoph Traxler 26
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
14/34
8. L-Systems
8.14
Context Sensitive L-Systems
The selection of a production for a symboldepends on the adjacent symbols in the
A context-sensitive production is writtenasA*A* A+, example:
xy < a > z ab
Christoph Traxler 27
xyazabyxayzab xyabzabyxaayzab
Context Sensitive L-Systems
Is used to simulate the propagation of signals(hormones, nutrients) between parts of a plant
: baaaaaaap1:b
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
15/34
8. L-Systems
8.15
Context Sensitive L-Systems
Branching structures: Topology has to beconsidered when searching for the context
gnore -
: Fb[+Fa]Fa[-Fa]F[+Fa]Fap: Fb< Fa Fb
Christoph Traxler 29
Parametric L-Systems
Symbols are assocciated with a finite set ofparameters
productions and to controll turtle geometry
Incorporation of geometrical features, thefinal shape is a result of the derivation
Im ortant for lant modelin because the
Christoph Traxler 30
geometry of a plant is the result of itsdevelopmental process
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
16/34
8. L-Systems
8.16
Parametric L-Systems
A parametric L-system (pL-system) is definedas ordered quadruplet A,,,P, where
is a finite set of parameters
(A R*)+ is the axiom
P ((A*) C() (A E())* is the set ofproductions
Christoph Traxler 31
C() denotes a logical and E() an arithmeticexpression with parameters from
Parametric L-Systems
PL-systems operate on strings of moduleswhich are parametric symbols, i.e. (AR*)
er va on: pro uc on p ma c es a mo u em of a string if:
The symbols of m and of the predecessorof p are the same
The number of real values in m is equal to
Christoph Traxler 32
the number of parameters in thepredecessor of p
The condition of p is true
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
17/34
8. L-Systems
8.17
Parametric L-Systems
Modules are replaced as follows:
1. All parameters in the production are set to
2. The condition is evaluated
3. If the condition is true, then the arithmeticexpressions in the successor are evaluated
4. The new modules with the resulting real
Christoph Traxler 33
values are filled into the new string
Parametric L-Systems
: B(2)A(4,4)p1: A(x,y): y3 B(x)A(x/y,0)p3: B(x) : x=1 B(x-1)
Result: B(2)A(4,4)B(1)B(4)A(1,0)
Christoph Traxler 34
,
C B(2)A(4,3)
C B(1)A(8,7)
C B(0)B(8)A(1.142,0)
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
18/34
8. L-Systems
8.18
Virtual construction tool in space
Its state is defined by a local coordinate
The 3D-Turtle
Within pL-systems the commands dependon parameters
head (h-axis)
Christoph Traxler 35
up u-ax s
right (r-axis)
The 3D-Turtle Commands
F(d) Position a cylinder of length d along the
h-axis, the turtle is translated to the
F(d,r) Position a cylinder with of length d
and radius r
-
Christoph Traxler 36
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
19/34
8. L-Systems
8.19
The 3D-Turtle Commands
+() Rotate around the u-axis by angle
&() Rotate around the r-axis by angle
o a e aroun e -ax s y ang e
| Turn around by 180, - the same as+(180)
[ ] Have the same effect as for the 2d-turtle
Christoph Traxler 37
Turtle commands can be extended byarbitrary parameters
The 3D-Turtle
A 3D-extentionof the Hilbert
Cubes
inbetweenrepresentnodes
Christoph Traxler 38
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
20/34
8. L-Systems
8.20
A Tree Model
Monopodial branching structures
:A(1,10)p1:A(l,w) F(l,w)[&(a0)B(lr2,wwr)]
/(d)A(lr1,wwr)p2:B(l,w) F(l,w)[+(-a1)$C(lr2,wwr)]
C(lr1,wwr)p3:C(l,w) F(l,w)[+(a1)$B(lr2,wwr)]
Christoph Traxler 39
B(lr1,wwr)The $ command turns the turtle back into ahorizontal position
A Tree Model
Parameters of the model:
r1: Contraction ratio for the trunk
2
a0: Branching angle from the trunk
a1: Branching angle for lateral axesd: Divergence angle
Christoph Traxler 40
r
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
21/34
8. L-Systems
8.21
A Tree Model
Christoph Traxler 41
Development of Inflorescences
Correct simulation of development in discretesteps
Christoph Traxler 42
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
22/34
8. L-Systems
8.22
Development of Inflorescences
Christoph Traxler 43
Phyllotaxis
Patterns of arrangements (leaves, seeds, ...)
Connected to Fibonacci numbers
Christoph Traxler 44
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
23/34
8. L-Systems
8.23
Phyllotaxis
Christoph Traxler 45
Environment Sensitive Growth
Greensvoxel
automata
Not possiblewithpL-systems
Christoph Traxler 46
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
24/34
8. L-Systems
8.24
Environmentally-Sensitive L-Systems
The propagation of signals is used to prunebranches against a surrounding surface
Christoph Traxler 47
Environmentally-Sensitive L-Systems
Query modules check the environment
They are evaluated after each derivation
turtles state
These values can be used to selectproductions (e.g. trigger a signal,terminate growth)
Christoph Traxler 48
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
25/34
8. L-Systems
8.25
Environmentally-Sensitive L-Systems
:A; p1:A F(1)?P(x,y)-A; p2:F(k) F(k+1)F(1)?P(*,*)-A
-,
F(2)?P(*,*)-F(1)?P(*,*)-A
F(2)?P(0,2)-F(1)?P(1,2)-A
F(3)?P(*,*)-F(1)?P(*,*)-F(1)?P(*,*)-A
F(3)?P(0,3)-F(1)?P(2,3)-F(1)?P(2,2)-A
Christoph Traxler 49
(0,1)
(0,2) (1,2)
(0,3) (2,3)
(2,2)
Synthetic Topiary
Pruning of a 2D branching structure against asquare
// continue growth
p1
: A>?P(x,y):!prune(x,y) @F/(180)A// prune last segment
p2: A>?P(x,y): prune(x,y) T%p3: F>T S
Christoph Traxler 50
// signal back propagation
p4: F>S SFp5: S // delete signalp6: @>S [+FA?P(x,y)] // triggers growth
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
26/34
8. L-Systems
8.26
Synthetic Topiary
Christoph Traxler 51
Synthetic Topiary
Christoph Traxler 52
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
27/34
8. L-Systems
8.27
Synthetic Topiary
Christoph Traxler 53
Open L-Systems
Extension to general querymodules and auxilary data
Check for self intersection
Realized Greens voxelspace automata
Check for biolo ical
Christoph Traxler 54
relevant conditions (soilcomposition, water, light,wind, ... )
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
28/34
8. L-Systems
8.28
Open L-Systems
Christoph Traxler 55
Fractals vs. Graftals
L-systems are a more general modelingtechnique for recursive defined objects,
Plants are not fractals, because:
They do not have infinite detailThey only have a very limited degree of selfsimilarity
Christoph Traxler 56
They have not the scaling properties offractals
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
29/34
8. L-Systems
8.29
Fractals vs. Graftals
PL-Systems are suitable for modelingobjects with a repetitive structure:
Terrains (fractal landscapes)
Linear fractals (IFS-attractors)
Architecture
Seashells
Christoph Traxler 57
Particle systems
Efficient Rendering of pL-Systems
Use Directed Cyclic Graphs (DCG) as objectrepresentation
whole scene in memory
Similar to Hart and deFantis method for raytracing of linear fractals and Kajiyas methodfor fractal terrain
Christoph Traxler 58
Problem: L-Systems are usually notcontractive
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
30/34
8. L-Systems
8.30
Efficient Rendering of pL-Systems
Components
Selection node: Each symbol is,
joins all the productions of the symboland selects the proper one in each cycle
Transformation node: Map into localcoordinate system
Christoph Traxler 59
Calculation node: Modify parameters,which affect production selection andtransformations
Efficient Rendering of pL-Systems
Optimization not trivial because of non-contractive mappings
equivalent with those of Hart and deFanti
Accumulate bounding boxes fortransformation nodes in pre-processing anduse their union for each traversal depth
Christoph Traxler 60
Fill a grid during pre-processing
Grid resolution is used to balance memoryconsumption and rendering performance
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
31/34
8. L-Systems
8.31
Efficient Rendering of pL-Systems
PL-System for Sierpinski tetrahedron
{c=6} S if(c>0,2,1)
2: S {c=c-1}(move(0.5,0.5,0.5)
uscale(0.5)S move(-0.5,-0.5,0.5)
uscale(0.5)S - -
Christoph Traxler 61
. , . , .
uscale(0.5)S move(-0.5,0.5,-0.5)
uscale(0.5)S)
Efficient Rendering of pL-Systems
DCG for Sierpinski tetrahedron
c = 6
S
c > 0 c
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
32/34
8. L-Systems
8.32
Efficient Rendering of pL-Systems
PL-System for a simple branching structure
{c=6} TR if(c>0,2,1)
2: TR {c=c-1}
(uscale(0.9) cylinder move(0,0,0.9)rotz(27)
(rotx(26)TR rotx(-32)TR))
Christoph Traxler 63
Efficient Rendering of pL-Systems
DCG for a simple branchingstructure
TR
c > 0 c
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
33/34
8. L-Systems
8.33
Efficient Rendering of pL-Systems
Ray Tracing:
Traverse graph for each ray
follow corresponding path
Evaluate calculation nodes
Apply inverse transformations oftransformation nodes to ray and accumulate
Christoph Traxler 65
themIntersect ray with primitive object
Back transform normal vector
Efficient Rendering of pL-Systems
Christoph Traxler 66
8/14/2019 Fractals -8- Dr Christoph Traxler.pdf
34/34
8. L-Systems
Web Sites
www.cg.tuwien.ac.at/research/rendering/csg-graphs/index.html
.
www.xfrogdownloads.com
Christoph Traxler 67