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

Preview:

Citation preview

How to Draw a TreeL-Systems in Computer Graphics

Steven Janke

Natural Trees

Tree Shapes

Euclidean Geometry Approach

Self-Similarity of Organic Forms

Computation = Processing Strings

aababccacabb adfeeefgComputer

Input: Output:

00110010 00101011 00110011 00110101

2 + 3 5

Interpretation:

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

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) = ?

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 }

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

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

Turtles in 3D:

Head

Left

Up

+ = left turn- = right turn

& = pitch down^ = pitch up

/ = roll right\ = roll left

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

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.

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.

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]

Developmental model using signals:

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.

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

Colonization Algorithm:

Self-Organization Algorithm: (Palubicki 2009)

Self-Organization Algorithm:

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?

Connection between Languages and Machines

Regular

Context Sensitive

Context Free

Recursively Enumerable

L-Systems

Iterated Function System:

Recommended