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

Post on 19-Dec-2015

212 views 0 download

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

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

Modeling

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

• Procedural:– Particle Systems.– Fractal.

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

20122

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

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

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

Koch Curve/Snowflake

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

20126

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

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 =

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

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

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.

Fractal Brownian Motion

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

201212

Variance ~ length -(2-d)

Brownian motion d = 1.5

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!

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

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

Mandelbrot Set

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

201216

Mandelbrot Set

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

201217

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