Download presentation
1
L-Systems and Affine Transformations
Moreno Marzolla Dip. di Informatica—Scienza e Ingegneria (DISI) Università di Bologna
2
Copyright © 2014, Moreno Marzolla, Università di Bologna, Italy
( This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 License (CC-BY-SA). To view a copy of this license, visit or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA. Image credits: the Web; The Computational Beauty of Nature website Complex Systems
3
Introduction We have seen that fractals are very effective for squeezing a great deal of length (perhaps infinite) into a finite area It is not surprising that fractals are used within living organisms for achieving special goals Human brain (maximize surface area) Respiratory system, circulatory system (tree-like branching) Complex Systems
4
Production systems The “instructions” for building such complex structures must be stored somewhere (e.g., within the DNA) It is therefore important to be able to store that information as compactly as possible L-Systems were proposed in 1968 by biologist Arstid Lindenmayer as a mathematical description of how plants grow Can be applied to other structures as well Complex Systems
5
L-Systems An L-System consists of a special “seed” cell (axiom), and a set of rules describing how new cells can be generated from old cells Example: expands to Axiom B Rules B → F[-B] + B F → FF B → F[-B] + B → FF[-F[-B] + B] + F[-B] + B → FFFF[-FF[-F[-B]+B] + F[-B]+B] + FF[-F[-B]+B] + F[-B] + B → ... Complex Systems
6
Turtle graphics commands
F Draw forward by a fixed length G Go forward by a fixed length (without drawing) + Turn right by a fixed angle (n+ turns right n times) - Turn left by a fixed angle (n- turns left n times) [ Save the current position in the stack ] Restore position from the top of the stack | Draw forward by a length computed from the execution depth Complex Systems
7
lsys -da 60 -axiom “F” -rule "F=F-F++F-F"
Koch Curve Angle: 60 Axiom: F Rule: F → F-F++F-F lsys -da 60 -axiom “F” -rule "F=F-F++F-F" Complex Systems
8
lsys -da 60 -axiom “F++F++F” -rule "F=F-F++F-F"
Koch Snowflake Angle: 60 Axiom: F++F++F Rule: F → F-F++F-F lsys -da 60 -axiom “F++F++F” -rule "F=F-F++F-F" Complex Systems
9
lsys -da 90 -axiom "F" -rule "F=F-F+F+F+F-F-F-F+F"
Peano curve Angle: 90 Axiom: F Rule: F → F-F+F+F+F-F-F-F+F lsys -da 90 -axiom "F" -rule "F=F-F+F+F+F-F-F-F+F" Complex Systems
10
Other examples Complex Systems
11
Affine Transformations
Affine transformations can be used to easily describe fractal objects that are made of “smaller copies of themselves” Possibly scaled and/or translated and/or rotated Complex Systems
12
Translation 𝑥′ 𝑦′ = 𝑥 𝑦 + Δ𝑥 Δ𝑦 Complex Systems
13
Scaling 𝑥′ 𝑦′ = 𝑠𝑥 0 0 𝑠𝑦 𝑥 𝑦 Complex Systems
14
Reflection 𝑥′ 𝑦′ = − 𝑥 𝑦 𝑥′ 𝑦′ = −1 𝑥 𝑦 Complex Systems
15
Rotation 𝑥′ 𝑦′ = cos θ −sin θ sin θ cos θ 𝑥 𝑦 Complex Systems
16
Composing linear transformations
Rotation, scaling, flipping + translation With a suitable choice for terms a through f, this can be rewritten using a single matrix product To compose multiple transformations: 𝑥′ 𝑦′ = 𝑎 𝑏 𝑐 𝑑 𝑥 𝑦 + 𝑒 𝑓 𝑥′ 𝑦′ 1 = 𝑎 𝑏 𝑐 𝑑 𝑒 𝑓 𝑥 𝑦 1 𝐱′=𝐂 𝐁 𝐀𝐱 Complex Systems
17
The Multiple Copy Reduction Machine (MCRM)
Next Image Seed Image A A One or more affine linear transformations Recursion Complex Systems
18
The Multiple Copy Reduction Machine (MCRM)
Complex Systems Source: Il linguaggio dei frattali, Le Scienze n. 266, october 1990
19
Example Complex Systems
20
Speeding up convergence
Start with a random point Iterate the point for n steps (n large) At each step choose one transformation with probability proportional to the area of the transformed box, i.e., the determinant of matrix Skip the first iterations, plot the positions of all other points 𝑎 𝑏 𝑐 𝑑 Complex Systems
21
The Multiple Copy Reduction Machine (MCRM)
One transformation Single point Next point 𝑥 𝑦 𝑥′ 𝑦′ One transformation Random choice One transformation Recursion Complex Systems
22
Examples Complex Systems
23
Examples Complex Systems
24
Examples Complex Systems
25
Examples Complex Systems
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.