Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin...
Transcript of Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin...
![Page 1: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/1.jpg)
Fractals
Part 7 : L - systems
Martin Samuelčík
Department of Applied Informatics
![Page 2: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/2.jpg)
How to model growth?
We want to model growth and shape changes in time
We have just result
Hard when using IFS
![Page 3: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/3.jpg)
Development in time
Biologist Aristid Lindenmayer
Invented formal description for plants growth
Based on biology observations
Form <-> Growth
Suitable for computer implementation
![Page 4: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/4.jpg)
Example of growth
Anabaena catenula
2 types of cells
Cells are divided differently if they are left or right daughters
Cells are divided into small and big ones
![Page 5: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/5.jpg)
Example
![Page 6: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/6.jpg)
Using Algebra
A is small cell, B is big cell
Arrow means left or right daughter
Applying rules we get new iterations and system is growing
One set of rules:
ABB
BAB
ABA
BAA
![Page 7: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/7.jpg)
Extending
Small cells must grow longer to perform dividing
![Page 8: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/8.jpg)
L - systems
Alphabet: V = {a1,a2,…,an}
Production map: P: V -> V* ; a -> P(a)
Axiom a(0) in V*
For each symbol in V there is one production rule P(a)
V* is set of all strings
![Page 9: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/9.jpg)
Visualization
Graphical interpretation of strings
Is not predetermined in any way
Based on analyze and observation of object in nature
Can be in 2D, 3D
Using many primitives for part of strings
![Page 10: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/10.jpg)
Turtle graphics
One of graphical interpretation of L-systems
Turtle is drawing line based on basic commands
F - move forward drawing line
f - just move forward
+,- turn left (right) by the angle
![Page 11: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/11.jpg)
Turtle graphics 2
![Page 12: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/12.jpg)
More symbols
Composite movements
L = + F – F – F +
R = - F + F +F –
S = FF + F + FF – F – FF
Z = FF – F – FF + F + FF
![Page 13: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/13.jpg)
Growing Classical Fractals
L-system: Koch curve
Axiom: F
Production rules: F -> F + F - - F + F + -> + ; - -> -
Parameter: angle = 60°
Possible scaling
![Page 14: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/14.jpg)
Cantor set
L-system: Cantor set
Axiom: F
Production rules: F -> F f F f -> f f f + -> + ; - -> -
Parameter: angle = 0°-360°
![Page 15: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/15.jpg)
Sierpinski arrowhead
L-system: Sierpinski arrowhead
Axiom: L
Production rules: L -> + R - L - R + R -> - L + R + L - + -> + ; - -> -
Parameter: angle = 60°
L = +F-F-F+, R = -F+F+F-
![Page 16: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/16.jpg)
Sierpinski arrowhead 2
YF, X -> YF+XF+Y, Y -> XF-YF-X
![Page 17: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/17.jpg)
Peano curve
L-system: Peano curve
Axiom: F
Production rules: F -> FF + F + F + FF + F + F - F + -> + ; - -> -
Parameter: angle = 90°
![Page 18: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/18.jpg)
Hilbert curve
Angle 90, Axiom X, X = –YF+XFX+FY–, Y = +XF–YFY–FX+
Extension to 3D: up, right & dir vector, more operators, Axiom A +,- = rotate around up &,^ = rotate around right | = rotate around y by 180 degrees
A -> B-F+CFC+F-D&F^D-F+&&CFC+F+B B -> A&F^CFB^F^D^^-F-D^|F^B|FC^F^A C -> |D^|F^B-F+C^F^A&&FA&F^C+F+B^F^D D -> |CFB-F+B|FA&F^A&&FB-F+B|FC
![Page 19: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/19.jpg)
Hilbert curve 2
![Page 20: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/20.jpg)
Dragon Curve
L-system: Dragon curve
Axiom: D
Production rules: D -> - D + + E E -> D - - E + + -> + ; - -> -
Parameter: angle = 45°
D= - - F + + F; E = F - - F + +
![Page 21: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/21.jpg)
Examples
![Page 22: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/22.jpg)
Fractal dimension
For curves and turtle graphics interpretation
log(N)/log(d)
N = effective distance from start to end point after i-th step
d = distance from start to end point, in turtle steps
![Page 23: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/23.jpg)
Brushes & trees
Branching structure cannot be described with linear sequential list
2 new symbols: [ and ]
Left bracket saves current turtle state on stack, right bracket pops state from stack
In bracket are branches
![Page 24: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/24.jpg)
Weed Plant
L-system: Weed plant
Axiom: F
Production rules: F -> F[+F]F[-F]F + -> + ; - -> -
Parameter: angle = 25.7°
![Page 25: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/25.jpg)
Random Weed Plant
L-system: Random Weed
Axiom: F
Production rules: F -> F[+F]F[-F]F (prob. 1/3) F -> F[+F]F (prob. 1/3) F -> F[-F]F (prob. 1/3) + -> + ; - -> -
Parameter: angle = 25.7°
![Page 26: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/26.jpg)
Weeds
![Page 27: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/27.jpg)
Stochastic L-systems More than one production rule for one symbol, rule is picked by probabilities
![Page 28: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/28.jpg)
Context sensitive
The selection of a production for a symbol depends on the adjacent symbols in the current string
Simulating propagation of signal
![Page 29: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/29.jpg)
Parametric L-Systems
A parametric L-system (pL-system) is defined as ordered quadruplet <A,Σ,ω,P>, where:
A is an alphabet of symbols
Σ is a finite set of parameters
ω in (A × R*) is the axiom
P from ((A × Σ*) : C(Σ) → (A × E(Σ))* is the set
of productions
C(Σ) denotes a logical and E(Σ) an arithmetic expression with parameters from Σ
![Page 30: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/30.jpg)
Parametric L-Systems
ω: 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)
Result: B(2)A(4,4)
B(1)B(4)A(1,0)
B(0)B(3)A(2,1)
C B(2)A(4,3)
C B(1)A(8,7)
C B(0)B(8)A(1.142,0)
![Page 31: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/31.jpg)
Environmentally-Sensitive
Green’s voxel space automata
![Page 32: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/32.jpg)
Open L-Systems
Extension to general query modules and auxilary data structures
Check for self intersection and avoid them
Check for biological relevant conditions (soil composition, water, light, wind, ... )
![Page 33: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/33.jpg)
More examples
![Page 34: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/34.jpg)
More examples 2
![Page 35: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/35.jpg)
More more examples
![Page 36: Fractals - SCCGsccg.sk/~samuelcik/fractal/Fractals_7.pdf · Fractals Part 7 : L - systems Martin Samuelčík Department of Applied Informatics. How to model growth? ...](https://reader033.fdocuments.net/reader033/viewer/2022053013/5f106eee7e708231d449160a/html5/thumbnails/36.jpg)
End
End of Part 7