lindenmayer systems martijn van den heuvel may 26th, may 26th, 2011

14
Lindenmayer Lindenmayer systems systems Martijn van den Heuvel Martijn van den Heuvel May 26th, May 26th, 2011

Upload: doreen-lawrence

Post on 02-Jan-2016

222 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Lindenmayer systems Martijn van den Heuvel May 26th, May 26th, 2011

Lindenmayer systemsLindenmayer systems

Martijn van den HeuvelMartijn van den Heuvel

May 26th, May 26th, 2011

Page 2: Lindenmayer systems Martijn van den Heuvel May 26th, May 26th, 2011

OutlineOutline

OriginOrigin DefinitionDefinition CharacteristicsCharacteristics ExtensionsExtensions Comparision with other modelsComparision with other models ConclusionConclusion

Page 3: Lindenmayer systems Martijn van den Heuvel May 26th, May 26th, 2011

Origin - Aristid LindenmayerOrigin - Aristid Lindenmayer

1925 – 1989 (63 years old)1925 – 1989 (63 years old) Hungarian/USHungarian/US Biologist at Utrecht UniversityBiologist at Utrecht University L-systems (1968) L-systems (1968) Biological development of multicellular Biological development of multicellular

organisms (algae)organisms (algae) Chomsky (formal) grammars (1957)Chomsky (formal) grammars (1957)

Page 4: Lindenmayer systems Martijn van den Heuvel May 26th, May 26th, 2011

DefinitionDefinition

Rewriting system:Rewriting system: Define complex objects by rewriting simple objectsDefine complex objects by rewriting simple objects

Tuple: Tuple: GG = ( = (AA,,ss,,RR))

G G = grammar= grammar

A A = alphabet (symbol set/states)= alphabet (symbol set/states)

s s = starting axiom (seed)= starting axiom (seed)

RR = set of production/transition rules= set of production/transition rules

‘‘Constants’ are identity functions; aConstants’ are identity functions; aaa

Page 5: Lindenmayer systems Martijn van den Heuvel May 26th, May 26th, 2011

CharacteristicsCharacteristics

RecursiveRecursive Parallel applying of productions Parallel applying of productions Rules can be deterministic/non-deterministicRules can be deterministic/non-deterministic Context-free / context sensitive statesContext-free / context sensitive states

NameName contextcontext <m,n>-system<m,n>-system RulesRules

0L-system0L-system freefree <0,0>-L-system<0,0>-L-system a a zz

IL-systemIL-system sensitivesensitive <m,n>-L-system<m,n>-L-system <a <a11,..,a,..,amm,,bb,c,c11…,c…,cnn>>zz

2L-system2L-system sensitivesensitive <1,1>-L-system<1,1>-L-system <a<a11,,bb,c,c11>>zz

Page 6: Lindenmayer systems Martijn van den Heuvel May 26th, May 26th, 2011

Example D0L-systemExample D0L-system

States: States: { a,b,c,d,k }{ a,b,c,d,k }

Rules: Rules: a a cbc cbc

b b dad dad

c c k k

d d a a

k k k k

Tuple: Tuple: GG = ( = (AA,,ss,,RR))

G G = grammar= grammar

A A = alphabet (symbol set/states)= alphabet (symbol set/states)

s s = starting axiom (seed)= starting axiom (seed)

RR = set of production/transition = set of production/transition rulesrules

aa

cbccbc

kdadkkdadk

kacbcakkacbcak

kcbckdadkcbckkcbckdadkcbck

kkdadkkacbcakkdadkkkkdadkkacbcakkdadkk

kkacbcakkcbckdadkcbckkacbcakkkkacbcakkcbckdadkcbckkacbcakk

……

Repeating structure from 4th array:Repeating structure from 4th array:

SSnn = kS = kSn-3n-3SSn-2n-2SSn-3n-3kk

Page 7: Lindenmayer systems Martijn van den Heuvel May 26th, May 26th, 2011

Example D0L-systemExample D0L-system

Geometrical interpretation:Geometrical interpretation: aa and and b b are are sharp tipssharp tips cc andand dd areare lateral margins of lobes lateral margins of lobes k k represents arepresents a notch notch

Page 8: Lindenmayer systems Martijn van den Heuvel May 26th, May 26th, 2011

Geometrical extensions:Geometrical extensions:Turtle graphicsTurtle graphics

Turtle has:Turtle has: A position (coordinates;A position (coordinates; x,yx,y)) An orientation (angle; An orientation (angle; aa)) A state A state s=(x,y,a)s=(x,y,a)

Also (possible):Also (possible): Angle increment Angle increment bb Step size Step size dd

Page 9: Lindenmayer systems Martijn van den Heuvel May 26th, May 26th, 2011

Geometrical extensions:Geometrical extensions:Turtle graphicsTurtle graphics

Example: Sierpinski triangleExample: Sierpinski triangle variables: variables: A BA B both mean “draw forward”both mean “draw forward” constants: constants: ++ means “turn left by angle”means “turn left by angle”

−− means “turn means “turn right by angle”right by angle”

start: start: AA rules: rules: (A → B−A−B), (B → A+B+A)(A → B−A−B), (B → A+B+A) angle: angle: 60°60°

Fixed step size (Fixed step size (dd), no angle increment (), no angle increment (bb))

Page 10: Lindenmayer systems Martijn van den Heuvel May 26th, May 26th, 2011

Geometrical extensions:Geometrical extensions:Turtle graphicsTurtle graphics

Result for Result for n=2n=2, , n=4n=4, , n=6n=6 and and n=8n=8

Page 11: Lindenmayer systems Martijn van den Heuvel May 26th, May 26th, 2011

Geometrical extensions:Geometrical extensions:BracketingBracketing

Extends previous turtle extension to splitExtends previous turtle extension to split Uses brackets Uses brackets [[,,] ] to delimit branches:to delimit branches:

[ [ meansmeans “Pop a state from the stack and make “Pop a state from the stack and make it the current state of the it the current state of the

turtle.” turtle.”  ]] means means “Push the current state of the “Push the current state of the

turtle onto a pushdown stack.”turtle onto a pushdown stack.”

Page 12: Lindenmayer systems Martijn van den Heuvel May 26th, May 26th, 2011

Geometrical extensions:Geometrical extensions:BracketingBracketing

Start: Start: FF       

Rule: Rule: F F F[-F]F[+F][F] F[-F]F[+F][F]

Angle:Angle: 25°25°

Page 13: Lindenmayer systems Martijn van den Heuvel May 26th, May 26th, 2011

Comparision to other MOCComparision to other MOC

Very similar to semi-Thue & Markov systemsVery similar to semi-Thue & Markov systems L-systems parallel/simultaneous, others sequential.L-systems parallel/simultaneous, others sequential. L-systems can be both deterministic/non-deterministicL-systems can be both deterministic/non-deterministic All are Turing-completeAll are Turing-complete

Cellular automataCellular automata Also simultaneous application of rulesAlso simultaneous application of rules

Ozhigov proves:Ozhigov proves: The set of languages, computed in a polynomial time on L-

systems, is exactly NP- languages. Even states L-systems might be a more powerful MOC

than a non-deterministic Turing machine

Page 14: Lindenmayer systems Martijn van den Heuvel May 26th, May 26th, 2011

ConclusionsConclusions Powerful systemsPowerful systems

Distinguishing by parallel appliance of rulesDistinguishing by parallel appliance of rules As formal language:As formal language:

0L-languages are context free 0L-languages are context free type-2 in Chomsky hierarchy type-2 in Chomsky hierarchy IL-languages are context sensitive IL-languages are context sensitive type-1 Chomsky hierarchy type-1 Chomsky hierarchy

Interesting readings:Interesting readings: The The algorithmicalgorithmic beauty of beauty of plantsplants – – LindenmayerLindenmayer & & PrusinkiewiczPrusinkiewicz

(1990) (1990) Lindenmayer systems as a model of computations – Y. Ozhigov (1998) Parametric L-systems and their application to the modelling and

visualization of plants – J.S. Hanan (1992) http://www.kevs3d.co.uk/dev/lsystems/# (online L-system renderer)