34
How to Draw a Tree L-Systems in Computer Graphics Steven Janke

How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Embed Size (px)

Citation preview

Page 1: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

How to Draw a TreeL-Systems in Computer Graphics

Steven Janke

Page 2: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Natural Trees

Page 3: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Tree Shapes

Page 4: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Euclidean Geometry Approach

Page 5: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Self-Similarity of Organic Forms

Page 6: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Computation = Processing Strings

aababccacabb adfeeefgComputer

Input: Output:

00110010 00101011 00110011 00110101

2 + 3 5

Interpretation:

Page 7: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

L-System

(Named after biologist Astrid Lindemayer in 1970’s)

Alphabet of characters. First string called the axiom. Set of productions showing how to replace characters. All appropriate productions applied at once.

Alphabet: {a, b} Axiom: abProductions: a bab , b a

Example:

Derivation: ab baba abababab

Page 8: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Languages:

L(G) = set of strings that can be derived from the system G.

Example 1:

Axiom: ab Productions: a a b ab

ab aab aaab aaaab L(G) = { an b | n > 0 }

Example 2:

Axiom: a Productions: a b b ab

a b ab bab abbab bababbab

L(G) = ?

Page 9: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Languages:

L(G) = set of strings that can be derived from the system G.

Example 1:

Axiom: ab Productions: a a b ab

ab aab aaab aaaab L(G) = { an b | n > 0 }

Example 2:

Axiom: a Productions: a b b ab

a b ab bab abbab bababbab

L(G) = { s | s0 = a, s1 = b, sn = sn-2 sn-1 }

Page 10: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Turtle Interpretation:

Simple L-System:

Alphabet: { F, +, - }

Axiom: F-F-F-F

Production: F FF

F means draw a line segment in current direction.+ means turn left.- means turn right.

F-F-F-F means:

StartInitial direction

Delta = 90 degrees

Page 11: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Branching L-Systems:

Add two characters to alphabet: [ and ]Interpret [ to mean “start branch”.Interpret ] to mean “end branch”.

F[+F][-F] means:

StartInitial Direction

Delta = 45 degrees

Page 12: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Turtles in 3D:

Head

Left

Up

+ = left turn- = right turn

& = pitch down^ = pitch up

/ = roll right\ = roll left

Page 13: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Growth Functions:

F(k) = length of the kth word in the derivation sequence.

Example:

a aa Axiom: a F(k) = 2k

a abcc b bcc c c Axiom: a

a abcc abccbcccc abccbccccbcccccc

1 4 9 16F(

F(k) = k2

Page 14: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Growth Functions:

G: a b b ab Axiom: b

ak = number of a’s at iteration k.bk = number of b’s at iteration k.

ak

bk

ak+1

bk+1

=0 1

1 1

Theorem: Every growth function for an L-system is a linear combination of terms that are polynomials times exponential functions.

Problem: Plants usually grow according to a logistic (or sigmoidal) function.

Page 15: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Parametric L-Systems:

Axiom: A(3)

A(x) : x<5 B(x+1)A(x*r) B(y) : * F(y)[+F(y/2)][-F(y/2)]

Interpretation: F(x) means draw a segment of length x. +(x) means turn left x degrees.

Page 16: How to Draw a Tree L-Systems in Computer Graphics Steven Janke
Page 17: How to Draw a Tree L-Systems in Computer Graphics Steven Janke
Page 18: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Context Sensitive L-Systems

Axiom: SFFFFA

Production: SF FS SA B

SFFFFA FSFFFA FFSFFA FFFSFA FFFFSA FFFFB

Axiom: S[FA][FFA]

S[FA][FFA] [FSA][FSFA] [FB][FFSA] [FB][FFB]

Page 19: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Developmental model using signals:

Page 20: How to Draw a Tree L-Systems in Computer Graphics Steven Janke
Page 21: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

L-System Extensions:

Gravity - pull on branches. Phyllotaxis - angle and position of branches. Phototropism - towards the light. Self-Organizing - branch into free spaces.

Implementation: At each iteration, interpret the string and then decide based on the geometry and environment how to apply productions for the next iteration.

Page 22: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Colonization Algorithm: (Runions, Lane, and Prusinkiewicz 2007)

Page 23: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Colonization Algorithm:

Page 24: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Self-Organization Algorithm: (Palubicki 2009)

Page 25: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Self-Organization Algorithm:

Page 26: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Equivalence:

G1: a bb b a Axiom: b

b a bb aa bbbb

G2: a b b aa Axiom: a

a b aa bb aaaa

L(G1) = L(G2)

Is there an algorithm for determining if two L-Systems are equivalent?

Page 27: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Connection between Languages and Machines

Regular

Context Sensitive

Context Free

Recursively Enumerable

L-Systems

Page 28: How to Draw a Tree L-Systems in Computer Graphics Steven Janke
Page 29: How to Draw a Tree L-Systems in Computer Graphics Steven Janke
Page 30: How to Draw a Tree L-Systems in Computer Graphics Steven Janke
Page 31: How to Draw a Tree L-Systems in Computer Graphics Steven Janke
Page 32: How to Draw a Tree L-Systems in Computer Graphics Steven Janke
Page 33: How to Draw a Tree L-Systems in Computer Graphics Steven Janke
Page 34: How to Draw a Tree L-Systems in Computer Graphics Steven Janke

Iterated Function System: