1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic...

46
1 06/23/22 14:53 UML Simplicity in Complexity

Transcript of 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic...

Page 1: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

104/20/23 04:55

UML

Simplicity in Complexity

Page 2: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

204/20/23 04:55

UML

Rewriting SystemsClassic Example: Koch 1905

Initiator

Generator

Page 3: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

304/20/23 04:55

UML

Rewriting Systems:Formal Grammars

0 Best understood rewriting systems are those that operate on character strings

0 Chomsky 1956: formal grammars applied to natural languages

0 Backus & Naur 1959: rewriting notation applied to formal definition of programming language (ALGOL-60)

0 Lindenmayer 1968 introduced a new type of rewriting system, subsequently termed L-systems- Essential difference between Chomsky grammars and L-

systems is that in L-systems productions are applied in parallel.

Page 4: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

404/20/23 04:55

UML

Deterministic, Context Free L-Systems (DOL)

a ab

b a

b

b

a

ab

aba

abaab

abaababa

axiom:

Grammar:

Derivation:

Page 5: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

504/20/23 04:55

UML

Formal Definition of L-System

Let denote an alphabet, the set of all words over , and the

set of all non empty words over . A is an ordered

triplet where is the of the system, is a

non - empty word called the , and is a finite set of

. A production is written: . The letter

and the word are called the and the of this

production, respectively. It is assumed that for any letter there is

at least one word such that . If no production i

V V V V

V string OL-system

G V P V alphabet V

axiom P V V

productions a P a

a predecessor successor

a V

V a

* +

+

, ,

( , )

*

s explicitly

defined for a given predecessor , the

is assumed to belong to the set of produtions . An OL system

is (noted DOL - system) if and only if for each

there is exactly one such that .

a V identity production

a a P

er istic a V

V a

det min*

100%RealMath

Page 6: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

604/20/23 04:55

UML

Formal Definition of Derivation

Let = be an arbitrary word over . The word

is from (or by)

noted , if and only if for all A word

is generated by in a derivation of length n if there exists a

of words such that:

and

a a V

V directly derived generated

a i m

G

developmental sequence

m

m

i i

n

n n

1

1

0 1

0 0 1

1

, ,..., .

, ,...,

, ,

100%RealMath

Page 7: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

704/20/23 04:55

UML

Turtle Interpretation of StringsAbelson & diSessa (MIT 1982)

The state of the turtle is defined as an orderedtriplet, where the cartesian coordinates represent the turtle’s position, and the angle , called the heading, is interpreted as the directionin which the turtle is facing.

( , , )x y ( , )x y

( , )x y

Where am I?

Page 8: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

804/20/23 04:55

UML

Turtle Interpretation of Character String

Move forward a step of length . The state of the turtly changes to

A line segment between the point and

is drawn.

Move forward a step of length without drawing a line.

Turn left by angle . The next state of the turtle is

The positive orientation of angles is counter - clockwise.

Turn right by angle . The next state of the turtle is

The negative orientation of angles is clockwise.

d

(x+d a,y+d a) x y

(x+d a,y+d a)

d

x y

x y

cos sin ( , )

cos sin

( , , ).

( , , ).

Character Interpretation

F

f

+

-

Page 9: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

904/20/23 04:55

UML

Turtle Interpretation of a String

FFF-FF-F-F+F+FF-F-FFFString:

+ -

Page 10: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

1004/20/23 04:55

UML

Example of Turtle Interpretation:Quadratic Koch Island

The L-System: :

:

F F F F

p F F F F FF F F F

Page 11: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

1104/20/23 04:55

UML

Sequence of Koch Curves Obtained byModification of Production Successor

Page 12: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

1204/20/23 04:55

UML

General Edge Rewriting

The Koch constructions are a restricted case of general edgerewriting, where there can be more than one edge letter, interpretedby the turtle as “move forward”.

Examples:

Page 13: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

1304/20/23 04:55

UML

Example of FASS Curves Generated byEdge-rewriting

FASS = space-filling, self-avoiding, simple, and self-similar

Page 14: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

1404/20/23 04:55

UML

Node Rewriting:Turtle Interpretation

PA QA

P

A

Q

A

Aligned withturtle statehere:

Turtle resumeshere:Subfigure A

Page 15: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

1504/20/23 04:55

UML

Node Rewriting Example:Hilbert Curve

:

:

:

L

p L RF LFL FR

p R LF RFR FL1

2

Page 16: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

1604/20/23 04:55

UML

Modeling in Three Dimensions

U

H

L

R

R

R

U

L

H

( )

cos sin

sin cos

( )

cos sin

sin cos

( )cos sin

sin cos

0 0

0 0

0 0 1 0

0 0 0 1

0 0

0 1 0 0

0 0

0 0 0 1

1 0 0 0

0 0

0 0

0 0 0 1

H L U H L U R' ' '

Page 17: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

1704/20/23 04:55

UML

Symbols to Control Turtle Orientation in Space

+ Turn left by angle , using rotation matrix Ru()

- Turn right by angle , using rotation matrix Ru(-)

& Pitch down by angle , using rotation matrix RL()

^ Pitch up by angle , using rotation matrix RL(-)

\ Roll left by angle , using rotation matrix RH()

/ Roll right by angle , using rotation matrix RH(-)

Symbol Turtle Semantics

Page 18: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

1804/20/23 04:55

UML

Three Dimensional Hilbert Curve

Page 19: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

1904/20/23 04:55

UML

Branching Structures:Axial Trees

•At each node at most one outgoing straight segment is distinguished

•The first segment in the sequence originates at the root of the tree or as a lateral segment at some node

•Each subsequent segment is a straight segment

•The last segment is not followed by any straight segments

Page 20: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

2004/20/23 04:55

UML

Tree OL-Systems

A tree OL - System is specified by three components:

a set of edge labels an initial tree (axiom) with labels from

and a set of tree productions

V V

P

, ,

.

s

a

bc

de

s

T1 T2

a

bc

de

Production

Page 21: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

2104/20/23 04:55

UML

Bracketed OL-Systems

Turtle semantics:

[ Push the current state of the turtle onto a stack. The information saved contains the turtle’s position andorientation, and possibly other attributes such as color,segment width

] Pop a state from the state and make it the current state of the turtle. No line is drawn, although in general theposition of the turtle changes

Example:F[+F][-F[-F]F]F[+F][-F]

Page 22: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

2204/20/23 04:55

UML

Plant-Like Structures Generated byBracketed OL-Systems

Page 23: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

2304/20/23 04:55

UML

Plant-Like Structures Generated byBracketed OL-Systems

Page 24: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

2404/20/23 04:55

UML

Three Dimensional Bracketed OL-System

Page 25: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

2504/20/23 04:55

UML

Stochastic OL-Systems

:

: [ ] [ ]

: [ ]

: [ ]

.

.

.

F

p F F F F F F

p F F F F

p F F F F

133

233

334

0.33 0.33 0.34

Page 26: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

2604/20/23 04:55

UML

Page 27: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

2704/20/23 04:55

UML

Example of Stochastic DOL-System

Page 28: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

2804/20/23 04:55

UML

Parametric DOL-Systems

: ( ) ( , )

: ( , ): ( , )

: ( , ): ( ) ( , )

: ( ):

: ( ): ( )

B A

p A x y y A x x y

p A x y y B x A xy

p B x x C

p B x x B x

2 4 4

3 2

3 0

1

1 1

1

2

3

4

p A x y y A x x y1 3 2: ( , ): ( , )

Formal Parameters Actual Parameters

Condition

B A

B B A

B B A

CB A

CB A

( ) ( , )

( ) ( ) ( , )

( ) ( ) ( , )

( ) ( , )

( ) ( . , )

2 4 4

1 4 1 0

0 3 2 1

2 4 3

1 133 7

Derivation:L-System:

Module

Page 29: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

2904/20/23 04:55

UML

Parametric DOL Systems

0 A production matches a nodule in a parametric word if the following conditions are met:- The letter in the module and the letter in the production

predecessor are the same- The number of actual parameters in the module is equal

to the number of formal parameters in the production predecessor

- The condition evaluates to true if the actual parameter values are substituted for the formal parameters in the production

Page 30: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

3004/20/23 04:55

UML

Turtle Interpretation of Parametric Words

If one or more parameters are associated with a symbol interpreted by the turtle, the value of the first parameter controls the turtle’s state. If the symbol is not followed by any parameters, default values specified ooutside the L-system are used as in the non-parametric case. The basic set of symbols affected by the introduction of parameters is listed below:

F(a) Move forward a step of length a > 0.

f(a) Move forward a step of length a without drawing a line

+(a) Rotate around U by an angle of a degrees

&(a) Rotate around L by an angle of a degrees

/(a) Rotate around H by an angle of a degrees

Page 31: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

3104/20/23 04:55

UML

Example of Textures and Parametric Surface Models

Page 32: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

3204/20/23 04:55

UML

Developmental Surface Models

Consider the following L-system:

:

: |

:

L

p L FX X FX FX X FX

p X FX1

2

Page 33: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

3304/20/23 04:55

UML

Fern Drawn Using Leaves Specified byPrevious L-System

Page 34: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

3404/20/23 04:55

UML

Alternative Notation for Polygon Drawing

Page 35: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

3504/20/23 04:55

UML

Parametric L-Systems Produce Varying Leaf Structures

Page 36: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

3604/20/23 04:55

UML

Page 37: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

3704/20/23 04:55

UML

Rose Leaves Generated by L-System ofPrevious Slide

Page 38: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

3804/20/23 04:55

UML

Parametric L-System Used to GenerateCompound Leaves

Page 39: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

3904/20/23 04:55

UML

Examples of Compound Leaves Generated byL-System of Slide 38

Page 40: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

4004/20/23 04:55

UML

Examples of Compound Leaves Generated byL-System of Slide 38

Page 41: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

4104/20/23 04:55

UML

General Branching Patterns

Let denote continuing apices, denote a terminal apex, and

I an internode, the terminal and sympoidal patterns are characterized

by rules of the form:

Monopoidal and polypoidal patterns have rules of the form:

A B C X

A I B X X

A I B X C

n m

n m

, ,

[ ] [ ]

[ ] [ ]

0 Terminal: main apex and all lateral apices terminate0 Sympoidal: main apex terminates; some lateral apices

continue0 Monopoidal: main apex continues; all lateral apices terminate0 Polypoidal: main apex continues; some lateral apices also

continue

Page 42: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

4204/20/23 04:55

UML

Inflorescences: Compound Flowering StructuresRacemes: Monopoidal Inflorscences

:

: [ ]

: [ ]

: [ ]

a

p a I L a

p a I L A

p A I K A

1

2

3

Generating Partial L-System:

L: leafI: InternodeK: Flower

Page 43: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

4304/20/23 04:55

UML

Pattern of Simple Racemes

Page 44: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

4404/20/23 04:55

UML

Lily-of-the-ValleyExample of Simple Raceme

Page 45: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

4504/20/23 04:55

UML

Development of Raceme:Capsella Bursa-Pastoris

Page 46: 1 10/27/2015 07:26 UML Simplicity in Complexity. 2 10/27/2015 07:26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.

4604/20/23 04:55

UML

L-System Generating Capsella Bursa-Pastoris