• Non ci sono risultati.

L-Systems and L-Systems and Affine Transformations Affine Transformations

N/A
N/A
Protected

Academic year: 2021

Condividi "L-Systems and L-Systems and Affine Transformations Affine Transformations"

Copied!
25
0
0

Testo completo

(1)

L-Systems and L-Systems and

Affine Transformations Affine Transformations

Moreno Marzolla

Dip. di Informatica—Scienza e Ingegneria (DISI) Università di Bologna

http://www.moreno.marzolla.name/

(2)

Copyright © 2014, Moreno Marzolla, Università di Bologna, Italy (http://www.moreno.marzolla.name/teaching/CS2013/)

This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 License (CC-BY-SA). To view a copy of this license, visit http://creativecommons.org/licenses/by- sa/3.0/ 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 http://mitpress.mit.edu/sites/default/files/titles/content/cbnhtml/home.html

(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)

(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

(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

(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

(7)

Koch Curve

Angle: 60

Axiom: F

Rule: F → F-F++F-F

lsys -da 60 -axiom “F” -rule "F=F-F++F-F"

(8)

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"

(9)

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"

(10)

Other examples

(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

(12)

Translation

( x ' y ' ) = ( x y ) + ( Δ x y )

(13)

Scaling

( x ' ) = ( sx 0 )( x )

(14)

Reflection

( x ' ) = ( −1 0 )( x ) ( x ' ) = ( 1 0 )( x )

(15)

Rotation

( x ' ) = ( cos(θ) −sin (θ)

) ( x )

(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

( x ' y ' ) = ( a b c d )( x y ) + ( e f )

( x ' y ' 1 ) = ( d e a b c 0 0 1 f )( 1 x y )

x ' =C ( B( A x))

(17)

The Multiple Copy Reduction Machine (MCRM)

A One or more affine A A A

linear transformations

Recursion

Seed Image Next Image

(18)

The Multiple Copy Reduction Machine

(MCRM)

(19)

Example

(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

( a b c d )

(21)

The Multiple Copy Reduction Machine (MCRM)

One transformation

Recursion

Next point

( x y ) One transformation ( x ' y ' )

One transformation

Single point

Random choice

(22)

Examples

(23)

Examples

(24)

Examples

(25)

Examples

Riferimenti

Documenti correlati

Supponiamo che non si voglia aggiornare il file “prezzo fax” con questa aggiunta (quindi non premete il pulsante Salva), ma si voglia salvare questo testo con un

Per poter scegliere quali barre personalizzare cliccare sul pulsante Strumenti, selezionare Barra degli strumenti e quindi fare clic sulla barra degli strumenti

The data-driven GPP data correspond to the MPI-BGC model (27), the process-based GPP corresponds to the median of an ensemble of 10 global dynamic vegetation models from the Trendy

Here, we describe the crystal structure of Fe 3 + -enterobactin bound to PfeA, which reveals the molecular details of the ferric- siderophore recognition at a binding site in

Specifically, our contribution is twofold: first, we formalise the intuitive idea that a location-scale DPM-G model on a given dataset induces a location-scale DPM-G model on

In this paper we show that if (G, L) is the Hall triple system associated with a group of exponent 3 (G, +), then (G, L) is an affine space if and only if (G, +) is nilpotent of

Here, we use the resource control lambda calculus λr, proposed in [2], as a starting point for obtaining computational interpretations of implicative fragments of some