computing & information sciences kansas state university lecture 37 of 42cis 636/736:...

56
Computing & Information Sciences Kansas State University Lecture 37 of 42 CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April 2008 William H. Hsu Department of Computing and Information Sciences, KSU KSOL course pages: http://snipurl.com/1y5gc Course web site: http://www.kddresearch.org/Courses/CIS636 Instructor home page: http://www.cis.ksu.edu/~bhsu Readings: Handouts from Barnsley Intro to Fractals and L-Systems

Upload: cameron-rich

Post on 11-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Lecture 37 of 42

Monday, 28 April 2008

William H. Hsu

Department of Computing and Information Sciences, KSU

KSOL course pages: http://snipurl.com/1y5gc

Course web site: http://www.kddresearch.org/Courses/CIS636

Instructor home page: http://www.cis.ksu.edu/~bhsu

Readings:

Handouts from Barnsley

Intro to Fractals and L-Systems

Page 2: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Computer Graphics 11:3D Object Representations –

Octrees & Fractals

Course Website: http://www.comp.dit.ie/bmacnamee

Page 3: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Fractals

All of the modelling techniques covered so far use Euclidean geometry methods Objects were described using equations

This is fine for manufactured objects But what about natural objects that have irregular or fragmented

features? Mountains, clouds, coral…

“Clouds are not spheres, mountains are not cones, coastlines are not circles and bark is not smooth, nor does lightning travel in a straight line.”

Benoit Mandelbrot

Page 4: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Fractal Geometry Methods & Procedural Modelling

Natural objects can be realistically described using fractal geometry methods

Fractal methods use procedures rather than equations to model objects - procedural modelling

The major characteristic of any procedural model is that the model is not based on data, but rather on the implementation of a procedure following a particular set of rules

Modelling On The Fly!

Page 5: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Fractals

A fractal object has two basic characteristics: Infinite detail at every point A certain self similarity between object parts and the overall features

of the object

The Koch CurveMandelbrot Set Video From:

http://www.fractal-animation.net/ufvp.htm

Page 6: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Generating Fractals

A fractal object is generated by repeatedly applying a specified transform function to points in a region of space

If P0 = (x0, y0, z0) is a selected initial position, each iteration of a transformation function F generates successive levels of detail with the calculations:

In general the transformation is applied to a specified point set, or to a set of primitives (e.g. lines, curves, surfaces)

... , , , 231201 PFPPFPPFP

Page 7: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Generating Fractals (cont…)

Although fractal objects, by definition have infinite detail, we only apply the transformation a finite number of times

Obviously objects we display have finite dimension – they fit on a page or a screen

A procedural representation approaches a true representation as we increase the number of iterations

The amount of detail is limited by the resolution of the display device, but we can always zoom in for further detail

Page 8: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Example: The Koch Snowflake

Imag

es t

aken

fro

m H

earn

& B

aker

, “C

ompu

ter

Gra

phic

s w

ith O

penG

L” (

2004

)

Page 9: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Example: Ferns

Very similar techniques can be used to generate vegetation

Page 10: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Fractal Dimension

The amount of variation in the structure of a fractal object is

described as the fractal dimension, D More jagged looking objects have larger fractal dimensions

Calculating the fractal dimension can be difficult, especially for particularly complex fractals

We won’t look at the details of these calculations

Page 11: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Types Of Fractals

Fractals can be classified into three groups Self similar fractals

These have parts that are scaled down versions of the entire objectCommonly used to model trees, shrubs etc

Self affine fractalsHave parts that are formed with different scaling parameters in each

dimensionTypically used for terrain, water and clouds

Invariant fractal setsFractals formed with non-linear transformationsMandelbrot set, Julia set – generally not so useful

Page 12: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Random Midpoint Displacement Methods For Topography

One of the most successful uses of fractal techniques in graphics is the generation of landscapes

One efficient method for doing this is random midpoint displacement

Page 13: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Random Midpoint Displacement Methods For Topography (cont…)

Easy to do in two dimensions Easily expanded to three dimensions to generate terrain

Can introduce a roughness factor H to control terrain appearance Control surfaces can be used to start with a general terrain shape

Terrain generation demo:http://world.std.com/~bgw/applets/1.02/MtFractal/MtFractal.html

Page 14: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Fractals In Film Special Effects

Page 15: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

CS G140Graduate Computer Graphics

Prof. Harriet FellSpring 2007

Lecture 9 – March 26, 2007

Page 16: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Fractals

The term fractal was coined in 1975 by Benoît Mandelbrot, from the Latin fractus, meaning "broken" or "fractured".

(colloquial) a shape that is recursively constructed or self-similar, that is, a shape that appears similar at all scales of magnification.

(mathematics) a geometric object that has a Hausdorff dimension greater than its topological dimension.

Page 17: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Mandelbrot Set

Mandelbrotset, rendered with Evercat's program.

Page 18: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Mandelbrot Set

Page 19: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

What is the Mandelbrot Set?

2

:cf

z z c

0

where is the -fold composition of with itself.

nc

nc c

f

f n f

We start with a quadratic function on the complex numbers.

The Mandelbrot Set is the set of complex c such that

Page 20: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Example

2

2

2

2 2

1

0 1 0 1 1 1 0

1 odd0

0 even

2 4 1 3 2 3 9 1 8

2 tend to as tends to .

1 2 2 4 1 3

tend to as tends to .

n

n

n

f z z

f f f

nf

n

f f f

f n

f i i f i f

f i n

Page 21: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

(Filled-in) Julia Sets

2

:cf

z z c

The Julia Set of fc is the set of points with 'chaotic' behavior under iteration.The filled-in Julia set (or Prisoner Set), is the set of all z whos orbits do not tend towards infinity. The "normal" Julia set is the boundary of the filled-in Julia set.

c = –1 c = –.5 +.5i c = – 5 +.5i

Page 22: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Julia Sets and the Mandelbrot Set

Some Julia sets are connected others are not.

The Mandelbrot set is the set of c for which the Julia set of fc(z) = z2 + c is connected.

Map of 121 Julia sets in position over the Mandelbrot set (wikipedia)

Page 23: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

A fractal is formed when pulling apart two glue-covered acrylic sheets.

Page 24: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Fractal Form of a Romanesco Broccoli

photo by Jon Sullivan

Page 25: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Time for a Break

Page 26: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

L-Systems

An L-system or Lindenmayer system, after Aristid Lindenmayer (1925–1989), is a formal grammar (a set of rules and symbols) most famously used to model the growth processes of plant development, though able to model the morphology of a variety of organisms.

L-systems can also be used to generate self-similar fractals such as iterated function systems.

Page 27: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

L-System References

Przemyslaw Prusinkiewicz & Aristid Lindenmayer, “The Algorithmic Beauty of Plants,” Springer, 1996.

http://en.wikipedia.org/wiki/L-System

Page 28: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

L-System Grammar

G = {V, S, ω, P}, where V (the alphabet) is a set of variables S is a set of constant symbols ω (start, axiom or initiator) is a string of symbols from V defining the initial

state of the system P is a set of rules or productions defining the way variables can be replaced

with combinations of constants and other variables. A production consists of two strings - the predecessor and the successor.

Page 29: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

L-System Examples

Koch curve (from wikipedia) A variant which uses only right-angles.

variables : F constants : + − start  : F rules  : (F → F+F−F−F+F)

Here, F means "draw forward", + means "turn left 90°", and - means "turn right 90°" (see turtle graphics).

Page 30: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Turtle Graphics

class Turtle { double angle; // direction of turtle motion in degrees double X; // current x position double Y; // current y position double step; // step size of turtle motion boolean pen; // true if the pen is down

public void forward(Graphics g) // moves turtle forward distance step in direction angle

public void turn(double ang)// sets angle = angle + ang;

public void penDown(), public void penUp()// set pen to true or false}

Page 31: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

My L-System Data Files

Koch Triangle Form // title4 // number of levels to iterate90 // angle to turnF // starting shapeF:F+F-F-F+F // a rule

F F+F-F-F+F F+F-F-F+F+F+F-F-F+F-F+F-F-F+F-F+F-F-F+F+F+F-F-F+F

Go to Eclipse

Page 32: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

More Variables

Dragon When drawing, treat L and R just like F.1090LL:L+R+R:-L-R

L L+R+ L+R+ + -L-R + L+R+ + -L-R + + - L+R+ - -L-R +

Page 33: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

A Different Angle

Sierpinski Gasket660RL:R+L+RR:L-R-L

R L-R-L R+L+R- L-R-L -R+L+R

Page 34: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Moving with Pen Up

Islands and Lakes290F+F+F+FF:F+f-FF+F+FF+Ff+FF-f+FF-F-FF-Ff-FFFf:ffffff // f means move forward with the pen up

F+F+F+F

next slide

F+f-FF+F+FF+Ff+FF-f+FF-F-FF-Ff-FFF

Page 35: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Islands and LakesOne Side of the Box

F+f-FF+F+FF+Ff+FF-f+FF-F-FF-Ff-FFF

Page 36: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

FF-[-F+F+F]+[+F-F-F]

Using a Stack to Make Trees

Tree1 [ push the turtle state onto the stack4 ] pop the turtle state from the stack22.5FF:FF-[-F+F+F]+[+F-F-F]

and I add leaves here

Page 37: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Stochastic L-Systemshttp://algorithmicbotany.org/lstudio/CPFGman.pdf

seed: 2454 // different seeds for different treesderivation length: 3axiom: FF--> F[+F]F[-F]F : 1/3F--> F[+F]F : 1/3F--> F[-F]F : 1/3

Page 38: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

3D Turtle Rotations

Heading, Left, or, Up vector tell turtle direction.+(θ) Turn left by angle θ◦ around the U axis.−(θ) Turn right by angle θ◦ around the U axis.&(θ) Pitch down by angle θ◦ around the L axis.∧(θ) Pitch up by angle θ◦ around the L axis.\(θ) Rollleftbyangleθ◦ around the H axis./(θ) Roll right by angle θ◦ around the H axis.| Turn around 180◦ around the U axis. @v Roll the turtle around the H axis so that H and U lie in a common vertical plane with U closest to up.

Page 39: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

A Mint http://algorithmicbotany.org/papers/

A model of a member of the mint family that exhibits a basipetalflowering sequence.

Page 40: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Myles Akeem SingletonCentral Illinois Chapter

National BDPA Technology Conference 2006Los-Angeles, CA

Examining the World of Fractals

Page 41: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Content of presentation

Introduction to fractals L-systems/Production rules Plant images Turtle geometry Conclusion

Page 42: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Introduction to fractals

Fractal Geometric Self-similar Has fractional dimension

Categorized under chaos science - fractal geometry 1975 - Benoît Mandelbrot defined the term fractal from the Latin

fractus, “broken” or “fractured”

Page 43: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Example of self-similarity

Page 44: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Koch Snowflake iterations

Page 45: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Julia set graphic

Page 46: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Introduction to L-systems

Fibonacci Thu-Morse Paperfolding Dragon curve Turtle graphics Branching Bracketed Several biological forms are branched, fragmented, or cellular in

appearance and growth Example where a trunk emerges from a branch:

Page 47: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Production rules

1968 - biologist Aristid Lindenmayer invents the L-system formula Used as a grammar to model the growth pattern of a type of

algae Set of production rules:

Rule 1: a → ab

Rule 2: b → a

Page 48: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Deterministic, context-free Lindenmayer system (D0L system)

Rule 1: a → ab

Rule 2: b → a

b → a a → ab ab → aba aba → abaab abaab → abaababa

Page 49: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Ben Hesper and Pauline Hogeweg

Two of Lindenmayer’s graduate students Tested to see if L - systems could resemble botanic forms Images controlled by special characters would draw an image onto a screen

F → move forward one, drawingf → move forward one, without drawing+ → rotate clockwise by a given angle- → rotate counterclockwise by a given angle[ → push into stack] → pop from stack

Page 50: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Koch Island example“F → F + F - F - FF + F + F - F”

F → move forward one, drawing

+ → rotate clockwise by a given angle

- → rotate counterclockwise by a given angle

Page 51: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Plant images

Adding a cursor stack system branching is gained Allows for the creation of plant-

like images

Mimics the structure of trees, bushes and ferns

Page 52: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Push/pop operations at work

Angle 45

Axiom F

F = F [ + F ] F

Page 53: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Variables, constants, start words, and rules

Variables - symbols denoting replaceable elements Constants - symbols denoting fixed elements Start words - define how the system begins Rules - define how to replace variables with other variables or

constants

Page 54: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Turtle geometry

Form of Logo programming Created 1967 at BBN, a Cambridge research firm, by Wally Feurzeig and

Seymour Papert

Grammar:nF - “n” steps forwardnB - “n” steps backaR - turn a degrees rightaL - turn a degrees leftConstants = {nF, nB, aR, aL, Stop}Variables = {, , , ...}Start = (none)

Page 55: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Turtle path example

<Path> → 5F 90R <Path><Path> → 5F 90R <Path><Path> → 5F 90R <Path><Path> → 5F 90R <Path><Path> → 5f <Path><Path> → 5F 90R <Path><Path> → 5F 90R <Path><Path> → 5F STOP

Production rules:F → move forward, drawingF → move forward, without drawingnF → “n” steps forwardnB → “n” steps backaR → turn “a” degrees rightaL → turn “a” degrees left <Path> denotes the part of the turtle's trail that is not specified Moves are represented by the transactions

Turtle graphic generated

Page 56: Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April

Computing & Information SciencesKansas State University

Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics

Conclusion

Fractal uses Model many different objects and shapes Scientific modeling Creating graphic designs for clothes Multimedia 3-D artwork

Music pioneers of this research are learning how to apply the application of fractals to create new styles of music Uses a recursive process Algorithm is applied multiple times to process its previous output Provides very abstract musical results Becoming one of the most exciting fields of new music research

The limits of fractal will continue to stretch