Fractals Infinite detail at every point Self similarity between parts and overall features of the...

Post on 20-Dec-2015

216 views 0 download

Transcript of Fractals Infinite detail at every point Self similarity between parts and overall features of the...

Fractals• Infinite detail at every point• Self similarity between parts and overall features of the object• Zoom into Euclidian shape

– Zoomed shape see more detail• eventually smooths

• Zoom in on fractal– See more detail

• Does not smooth

• Model– Terrain, clouds water, trees, plants, feathers, fur, patterns

• General equation P1=F(P0), P2 = F(P1), P3=F(P2)…– P3=F(F(F(P0)))

Self similar fractals• Parts are scaled down versions of the entire object

– use same scaling on subparts– use different scaling factors for subparts

• Statistically self-similar– Apply random variation to subparts

• Trees, shrubs, other vegetation

Fractal types

• Statistically self-affine – random variations

• Sx<>Sy<>Sz– terrain, water, clouds

• Invariant fractal sets– Nonlinear transformations

• Self squaring fractals– Julia-Fatou set

» Squaring function in complex space

– Mandelbrot set

» Squaring function in complex space

• Self-inverse fractals– Inversion procedures

Julia-Fatou and Mandelbrot

• x=>x2+c– x=a+bi

• Complex number

• Modulus– Sqrt(a2+b2)– If modulus < 1

• Squaring makes it go toward 0– If modulus > 1

• Squaring falls towards infinity

• If modulus=1– Some fall to zero– Some fall to infinity– Some do neither

• Boundary between numbers which fall to zero and those which fall to infinity

– Julia-Fatou Set

Foley/vanDam Computer Graphics-Principles and Practices, 2nd edition

Julia-Fatou

Julia Fatou and Mandelbrot con’d

• Shape of the Julia-Fatou set based on c• To get Mandelbrot set – set of non-diverging points

– Correct method• Compute the Julia sets for all possible c• Color the points black when the set is connected and white when it is

not connected

– Approximate method• Foreach value of c, start with complex number 0=0+0i• Apply to x=>x2+c

– Process a finite number of times (say 1000)– If after the iterations is is outside a disk defined by modulus>100,

color the points of c white, otherwise color it black.

Foley/vanDam Computer Graphics-Principles and Practices, 2nd edition

Constructing a deterministic self-similar fractal• Initiator

– Given geometric shape

• Generator– Pattern which replaces subparts of initiator

• Koch Curve

Initiator generator First iteration

Fractal dimension• D=fractal dimension

– Amount of variation in the structure– Measure of roughness or fragmentation of the object

• Small d-less jagged• Large d-more jagged

• Self similar objects– nsd=1 (Some books write this as ns-d=1)

• s=scaling factor• n number of subparts in subdivision• d=ln(n)/ln(1/s)

– [d=ln(n)/ln(s) however s is the number of segments versus how much the main segment was reduced

» I.e. line divided into 3 segments. Instead of saying the line is 1/3, say instead there are 3 sements. Notice that 1/(1/3) = 3]

– If there are different scaling factors• • Sk

d=1K=1

n

Figuring out scaling factorsI prefer: ns-d=1 :d=ln(n)/ln(s)

• Dimension is a ratio of the (new size)/(old size)– Divide line into n identical

segments• n=s

– Divide lines on square into small squares by dividing each line into n identical segments

• n=s2 small squares

– Divide cube• Get n=s3 small cubes

• Koch’s snowflake– After division have 4 segments

• n=4 (new segments)

• s=3 (old segments)

• Fractal Dimension– D=ln4/ln3 = 1.262

– For your reference: Book method• n=4

– Number of new segments

• s=1/3 – segments reduced by 1/3

• d=ln4/ln(1/(1/3))

Sierpinski gasket Fractal Dimension

• Divide each side by 2– Makes 4 triangles– We keep 3– Therefore n=3

• Get 3 new triangles from 1 old triangle

– s=2 (2 new segments from one old segment)

• Fractal dimension – D=ln(3)/ln(2) = 1.585

Cube Fractal Dimension

• Apply fractal algorithm– Divide each side by 3– Now push out the middle face of each cube– Now push out the center of the cube

• What is the fractal dimension?– Well we have 20 cubes, where we used to have 1

• n=20

– We have divided each side by 3• s=3

– Fractal dimension ln(20)/ln(3) = 2.727

Image from Angel book

Language Based Models of generating images

• Typical Alphabet {A,B,[,]}

• Rules– A=> AA– B=> A[B]AA[B]

• Starting Basis=B• Generate words

– Represents sequence of segments in graph structure

– Branch with brackets

– Interesting, but I want a tree

• B• A[B]AA[B]• AA[A[B]AA[B]]AAAA[A[B]AA[B]]

A

AA

B

B

A

AAB

AA

B

AAAA

A

B

AA

B

Language Based Models of generating images con’d

• Modify Alphabet {A,B,[,],(,)}

• Rules– A=> AA– B=> A[B]AA(B)– [] = left branch () = right

branchStarting Basis=B

• Generate words– Represents sequence of

segments in graph structure– Branch with brackets

• B

• A[B]AA(B)

• AA[A[B]AA(B)]AAAA(A[B]AA(B))

A

AA

B

B

A

AAB

AA

B

AAAA

AB

AA

B

Language Based models have no inherent geometry

• Grammar based model requires– Grammar– Geometric interpretation

• Generating an object from the word is a separate process– examples

• Branches on the tree drawn at upward angles

• Choose to draw segments of tree as successively smaller lengths

– The more it branches, the smaller the last branch is

• Draw flowers or leaves at terminal nodes

A

AAB

AA

B

AAAA

AB

AA

B

Grammar and Geometry

• Change branch size according to depth of graph

Foley/vanDam Computer Graphics-Principles and Practices, 2nd edition

Particle Systems• System is defined by a collection of particles that evolve

over time– Particles have fluid-like properties

• Flowing, billowing, spattering, expanding, imploding, exploding

– Basic particle can be any shape• Sphere, box, ellipsoid, etc

– Apply probabilistic rules to particles• generate new particles• Change attributes according to age

– What color is particle when detected?– What shape is particle when detected?– Transparancy over time?

• Particles die (disappear from system)• Movement

– Deterministic or stochastic laws of motion» Kinematically» forces such as gravity

Particle Systems modeling• Model

– Fire, fog, smoke, fireworks, trees, grass, waterfall, water spray.

• Grass– Model clumps by setting up trajectory paths for

particles

• Waterfall– Particles fall from fixed elevation

• Deflected by obstacle as splash to ground– Eg. drop, hit rock, finish in pool

– Drop, go to bottom of pool, float back up.

Physically based modeling• Non-rigid object

– Rope, cloth, soft rubber ball, jello

• Describe behavior in terms of external and internal forces– Approximate the object with network of point nodes connected by flexible connection

• Example springs with spring constant k

– Homogeneous object• All k’s equal

• Hooke’s Law– Fs=-k x

• x=displacement, Fs = restoring force on spring

• Could also model with putty (doesn’t spring back)• Could model with elastic material

– Minimize strain energy

kk

kk

“Turtle Graphics”• Turtle can

– F=Move forward a unit– L=Turn left– R=Turn right

• Stipulate turtle directions, and angle of turns

• Equilateral triangle– Eg. angle =120– FRFRFR

• What if change angle to 60 degrees– F=> FLFRRFLF– Basis F

• Koch Curve (snowflake)

– Example taken from Angel book

Using turtle graphics for trees

• Use push and pop for side branches []

• F=> F[RF]F[LF]F

• Angle =27

• Note spaces ONLY for readability

• F[RF]F[LF]F [RF[RF]F[LF]F] F[RF]F[LF]F [LF[RF]F[LF]F] F[RF]F[LF]F