Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E...

18
Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 1 Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner

Transcript of Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E...

Page 1: Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 1 Mohan Sridharan Based on Slides.

Chapter 9: Recursive Methods and Fractals

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

20121

Mohan SridharanBased on Slides by Edward Angel and Dave Shreiner

Page 2: Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 1 Mohan Sridharan Based on Slides.

Modeling

• Geometric:– Meshes.– Hierarchical.– Curves and Surfaces.

• Procedural:– Particle Systems.– Fractal.

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

20122

Page 3: Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 1 Mohan Sridharan Based on Slides.

Sierpinski Gasket

Rule based:

Repeat n times. As n →∞ Area→0

Perimeter →∞

Not a normal geometric object.

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

20123

Page 4: Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 1 Mohan Sridharan Based on Slides.

Coastline Problem

• What is the length of the coastline of England?• Answer: There is no single answer. Depends on length of

ruler (units).

• If we do experiment with maps at various scales we also notice self-similarity: each part looks a whole.

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

20124

Page 5: Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 1 Mohan Sridharan Based on Slides.

Fractal Geometry

• Created by Mandelbrot:– Self similarity.– Dependence on scale.

• Leads to idea of fractional dimension.

• Graftals: graphical fractal objects.

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

20125

Page 6: Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 1 Mohan Sridharan Based on Slides.

Koch Curve/Snowflake

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

20126

Page 7: Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 1 Mohan Sridharan Based on Slides.

Fractal Dimension

• Start with unit line, square, cube which we agree are 1, 2, 3 dimensional respectively.

• Consider scaling each one by a h = 1/n.

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

20127

Page 8: Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 1 Mohan Sridharan Based on Slides.

How Many New Objects?

• Line: n.• Square: n2.• Cube: n3.

• The whole is the sum of its parts, i.e., fractal dimension (d) is given by:

8E. Angel and D. Shreiner: Interactive

Computer Graphics 6E © Addison-Wesley 2012

ndk

= 1n

k

ln

lnd =

Page 9: Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 1 Mohan Sridharan Based on Slides.

Examples

• Koch curve:– Subdivision (i.e., scale) by 3 each time.– Create 4 new objects.– d = ln 4 / ln 3 = 1.26186.

• Sierpinski gasket:– Subdivide (scale) side by 2.– Keep 3 of the 4 new triangles, i.e., create 3 new objects.– d = ln 3 / ln 2 = 1.58496.

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

20129

Page 10: Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 1 Mohan Sridharan Based on Slides.

Volumetric Examples

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

201210

d = ln 4/ ln 2 = 2

d = ln 20 / ln 3 = 2.72683

Page 11: Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 1 Mohan Sridharan Based on Slides.

Midpoint subdivision

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

201211

Randomize displacement using a Gaussian random number generator.

Reduce displacement in each iteration by reducing variance of generator.

Page 12: Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 1 Mohan Sridharan Based on Slides.

Fractal Brownian Motion

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

201212

Variance ~ length -(2-d)

Brownian motion d = 1.5

Page 13: Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 1 Mohan Sridharan Based on Slides.

Fractal Mountains

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

201213

Use fractals to generate mountains and natural terrain.

Tetrahedron subdivision + midpoint displacement.

Control variance of randomnumber generator to controlRoughness.

Can apply to mesh surfaces too!

Page 14: Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 1 Mohan Sridharan Based on Slides.

Mandelbrot Set

Based on fractal geometry.Easy to generate but models infinite complexity in the shapes generated.

Based on calculations in the complex plane.

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

201214

Page 15: Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 1 Mohan Sridharan Based on Slides.

Mandelbrot Set

• Iterate on zk+1=zk2+c with z0 = 0 + j0.

• Two cases as k →∞:|zk |→∞

|zk | remains finite; • If for a given c, |zk | remains finite, then c belongs to the

Mandelbrot set.

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

201215

Page 16: Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 1 Mohan Sridharan Based on Slides.

Mandelbrot Set

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

201216

Page 17: Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 1 Mohan Sridharan Based on Slides.

Mandelbrot Set

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

201217

Page 18: Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 1 Mohan Sridharan Based on Slides.

More Details

• Section 9.8: fractals and recursive methods.

• Section 9.9: procedural noise.

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

201218