38
1 CS 430/536 Computer Graphics I Fractals Week 10, Lecture 19 David Breen, William Regli and Maxim Peysakhov Geometric and Intelligent Computing Laboratory Department of Computer Science Drexel University http://gicl.cs.drexel.edu

Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

Embed Size (px)

Citation preview

Page 1: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

1

CS 430/536Computer Graphics I

FractalsWeek 10, Lecture 19

David Breen, William Regli and Maxim PeysakhovGeometric and Intelligent Computing Laboratory

Department of Computer ScienceDrexel University

http://gicl.cs.drexel.edu

Page 2: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

2

Overview

• Fractal representations• Algorithms for drawing fractals• Mandelbrot Set• Brownian Motion

1994 Foley/VanDam/Finer/Huges/Phillips ICG

Page 3: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

3

Introduction to Fractals• Term Fractal coined by Benoit Mandelbrot• Properties of fractal:

– Self-similarity (small portion looks like the whole object )– Have fractional dimensions– Non-differentiable– Infinite length

Construction of Koch Curve

Compiled from Gary W. Flake “The Computational Beauty of Nature”

Page 4: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

4

Length of the Fractals

• Lewis Richardson(1961) measuredlength of coastlines

• Total length increaseas measurementstick reduced

• Does this meancoastlines are infinitein length?

Compiled from Gary W. Flake “The Computational Beauty of Nature”

Page 5: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

5

Koch Curve

http://www.arcytech.org/java/fractals/

Page 6: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

6

• Has no tangent at any point• Length of the curve at iteration n is (4/3)n

• Koch curve is 1.26186 …dimensional object

Properties of Koch Curve

Compiled from Gary W. Flake “The Computational Beauty of Nature”

1.77777780.11111111621.33333330.333333341

3.11798*10121.94033*10-481.04858*1060100

1110Total lengthLength of segmentNum of segmentsStep

Page 7: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

7

Fractal Dimensions• 1D line of unit length divided into n segments

looks like the whole line scaled by 1/n• 2D square of unit area divided into n segments

looks like the whole square scaled by 1/n1/2– i.e. 4 segments, each one 1/2 the size of the original

• Divide an object into n segments where eachsegment is scaled by 1/s

• s = n1/d d = log(n)/log(s) 2 = log(4)/log(2)• The square is divided into 4 parts and each part is

1/2 the size of the original• d = log(4)/log(2) = 2

Page 8: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

8

Fractal Dimensions• s = n1/d d = log(n)/log(s)• Koch curve divides line into 4 parts, each part is

1/3 the size of the original• Therefore the dimension of the Koch curve is:

!

41d = 3, n1/ d

= s

d =log(4)

log(3)=

log(n)

log(s)=1.26186 ...

Page 9: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

9

Space Filling Fractals• Peano curve (1890)• Fills a 2D region• Fractal dimension - 2• s = n1/d 9 segments 1/3 original size

2 = log(9)/log(3)

Construction of Peano Curve

Compiled from Gary W. Flake “The Computational Beauty of Nature”

Page 10: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

10

Sierpinski Triangle

http://www.arcytech.org/java/fractals/

Page 11: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

11

• Fractals often occur in nature• All natural fractals are grown• We can model natural objects with fractals

Naturally Occurring Fractals

Brain Lungs Kidney

Compiled from Gary W. Flake “The Computational Beauty of Nature”

Page 12: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

13

Production Systems

• In 1968 A. Lindenmayer developeda formalism describing plant growth.

• Called L-system• L-system consists of:

– Seed cell (axiom)– Production rules

Axiom: B Rules: B=>F[-B][+B] F=>FF

Compiled from Gary W. Flake “The Computational Beauty of Nature”

Page 13: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

14

PlantlikeFractals 1

Compiled from Gary W. Flake “The Computational Beauty of Nature”

Page 14: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

15

PlantlikeFractals 2

Compiled from Gary W. Flake “The Computational Beauty of Nature”

Page 15: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

16

PlantlikeFractals 3

Compiled from Gary W. Flake “The Computational Beauty of Nature”

Page 16: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

17

• Fractal often described to contain miniatureversions of itself.

• We can use affine transformations to describewhere these miniatures should be placed– Translation– Rotation– Scaling

• Self-affine fractals may have different scalingfactors in different dimensions

Affine Transformation Fractals

Compiled from Gary W. Flake “The Computational Beauty of Nature”

Page 17: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

18

• Can be simulated with real copy machine• Copy machine takes a seed image• Creates several transformed copies of it as an output.• Procedure is recursive

Multiple Reduction CopyMachine Algorithm

Compiled from Gary W. Flake “The Computational Beauty of Nature”

Page 18: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

19

MRCM Examples

Compiled from Gary W. Flake “The Computational Beauty of Nature”

Page 19: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

20

Problems with MRCM

• To get good image wemust compute MRCMto large depth

• Computing time growsexponentially with depth

• Problem amplified whenthe reduction in sizeduring one iteration issmall

Compiled from Gary W. Flake “The Computational Beauty of Nature”

Fern Leaf

Page 20: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

21

• Observations:– Fractal consist entirely of points– Randomly and recursively apply affine

transformation Li(p) to point p– Converges to a fractal

Iterated Functional System

Compiled from Gary W. Flake “The Computational Beauty of Nature”

500 points 5000 points

Page 21: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

22

• Pick random point of the seed image• Randomly pick one of the affine

transformations• Transform the point• Continue recursively

IFS Algorithm

Fern LeafCompiled from Gary W. Flake “The Computational Beauty of Nature”

Page 22: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

23

IFS Generated Tree

Compiled from Gary W. Flake “The Computational Beauty of Nature”

Page 23: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

24

• xn=xn-12+c for some complex number c

– For some c, x→ 0 as n→ ∞c ∈ Mandelbrot Set

– For some c, x→∞ as n→ ∞– For others neither

Mandelbrot Set

For each c in the complex planex0=0

for (n=1 to nmax) {xn= xn

2+cif (|xn|>2) break

}If (n < nmax) color c = white

else color c = blackfrom http://www.astro.su.se/~alexis/fractals/

Mandelbrot Set

Magnified region

Page 24: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

25

Mandelbrot Set

Compiled from Gary W. Flake “The Computational Beauty of Nature”

Page 25: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

26

Mandelbrot Set

Recorded with XaoS

Page 26: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

27

Newton Set f(x) = x3 - 1 xn+1 = xn - f(x) / f'(x)

Recorded with XaoS

Page 27: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

28

Phoenix Setzn + 1 = zn

2 + Re(c) + Im(c) * zn - 1

Recorded with XaoS

Page 28: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

29

• The dance of pollen grains in a water drop(Robert Brown in 1827)

• Explained by AlbertEinstein in 1905

• Self-similar motion• Infinite length• Used to simulate

rivers mountainsand other randomnatural phenomena

Brownian Motion

Page 29: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

30

• Fractional BM (fBM) is a generalization of BM toinclude memory– Integral on progress of random walk

• fBM characterized by it’s power spectrum– BM has 1/f2 power spectrum– fBM had 1/fβ power spectrum

with 1.0 ≤ β ≤ 3.0• Think of β as controlling

terrain roughness

Fractional Brownian Motion

Voss & Saupe in “The Science of Fractal images”

Page 30: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

31

• Landscape generated by the XMOUNTAINS programby Steven Booth

• Realistic, self-similar image

XMOUNTAINS

Compiled from Gary W. Flake “The Computational Beauty of Nature”

Page 31: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

32

XMOUNTAINS: Changing Fractal Dimension

Page 32: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

34

Random MidpointDisplacement

• fBM computations are time consuming• RMD are faster to compute but less realistic• Basic idea:

– Start with 2 (2D) 4 (3D)random points.

– Compute the midpoint foreach interval

– Displace the midpoint atrandom but based on thedifference between endpoints

Michael Shantz @ University of Waterloo

Page 33: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

35

RMD Algorithm

x

y

y(b)

y(a)

a b

x

y

y(b)

y(a)

a b

ymid

a+b2

x

y a b

d c

x

y a b

d c

h f

e

g

m

• Generate points a and b at randomymid = (1/2)(y(a)+y(b))+rr = s·(|b-a|)·rg()s - is a surface roughness

parameterrg()- returns a Gaussian random value

(mean = 0, variance = 1)

In 3D version:ym = (1/4)(y(a)+y(b)+y(c)+y(d))+r

Page 34: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

36

Controlling the Topography

• To model real environments we want tocontrol the placement of peaks and valleys

• We can do it by setting up Control Surfaces.• Calculate random elevations based on:

– Elevation of controlsurface

– Average elevation ofthe midpoint

Page 35: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

37

Fractal MountainsKen Musgrave

Page 36: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

38

Cellular Automata

• Invented by Johnvon Neumann in1940s

• Thoroughly studiedby Wolfram

• Mechanism to studyreproduction

• Dynamic system– Discrete in space– Discrete in time

Compiled from Gary W. Flake “The Computational Beauty of Nature”

Page 37: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

39

Compiled from Gary W. Flake “The Computational Beauty of Nature”

Cellular Automata in Nature

• Process which creates seashells has beenlinked to a one-dimensional CA

Page 38: Fractals Introduction to Fractals •Term Fractal coined by Benoit Mandelbrot •Properties of fractal: –Self-similarity (small portion looks like the whole object )

40

Conus Textile Seashell

Source: wikipedia.org