CS 430/536 Computer Graphics I
Overview
Fractal representations Algorithms for drawing fractals Mandelbrot Set Brownian Motion
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
1
2
1994 Foley/VanDam/Finer/Huges/Phillips ICG
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
Length of the Fractals
Lewis Richardson (1961) measured length of coastlines Total length increase as measurement stick reduced Does this mean coastlines are infinite in length?
4
Compiled from Gary W. Flake The Computational Beauty of Nature
Construction of Koch Curve
Compiled from Gary W. Flake The Computational Beauty of Nature
Koch Curve
Properties of Koch Curve
Has no tangent at any point Length of the curve at iteration n is (4/3)n
Step
0 1 2 100
Num of segments
1 4 16 1.04858*1060
Length of segment Total length
1 0.3333333 0.1111111 1.94033*10-48 1 1.3333333 1.7777778 3.11798*1012
Koch curve is 1.26186 dimensional object
5
http://www.arcytech.org/java/fractals/
6
Compiled from Gary W. Flake The Computational Beauty of Nature
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
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:
Divide an object into n segments where each segment 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
7
4 d = 3, n1/ d = s log(4) log(n) d= = = 1.26186 ... log(3) log(s)
!
8
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)
Sierpinski Triangle
Construction of Peano Curve
10
http://www.arcytech.org/java/fractals/
Compiled from Gary W. Flake The Computational Beauty of Nature
Naturally Occurring Fractals
Fractals often occur in nature All natural fractals are grown We can model natural objects with fractals
Production Systems
In 1968 A. Lindenmayer developed a formalism describing plant growth. Called L-system L-system consists of:
Seed cell (axiom) Production rules
Brain
Lungs
Kidney 11
Compiled from Gary W. Flake The Computational Beauty of Nature
Axiom: B Rules: B=>F[-B][+B] F=>FF
13
Compiled from Gary W. Flake The Computational Beauty of Nature
Plantlike Fractals 1
Plantlike Fractals 2
14
Compiled from Gary W. Flake The Computational Beauty of Nature
15
Compiled from Gary W. Flake The Computational Beauty of Nature
Plantlike Fractals 3
Affine Transformation Fractals
Fractal often described to contain miniature versions of itself. We can use affine transformations to describe where these miniatures should be placed
Translation Rotation Scaling
Self-affine fractals may have different scaling factors in different dimensions
16
Compiled from Gary W. Flake The Computational Beauty of Nature
17
Compiled from Gary W. Flake The Computational Beauty of Nature
Multiple Reduction Copy Machine Algorithm
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
MRCM Examples
18
Compiled from Gary W. Flake The Computational Beauty of Nature
19
Compiled from Gary W. Flake The Computational Beauty of Nature
Problems with MRCM
To get good image we must compute MRCM to large depth Computing time grows exponentially with depth Problem amplified when the reduction in size during one iteration is small
Fern Leaf
Iterated Functional System
Observations:
Fractal consist entirely of points Randomly and recursively apply affine transformation Li(p) to point p Converges to a fractal
20
500 points
5000 points
21
Compiled from Gary W. Flake The Computational Beauty of Nature
Compiled from Gary W. Flake The Computational Beauty of Nature
IFS Algorithm
Pick random point of the seed image Randomly pick one of the affine transformations Transform the point Continue recursively
IFS Generated Tree
Fern Leaf
22
23
Compiled from Gary W. Flake The Computational Beauty of Nature
Compiled from Gary W. Flake The Computational Beauty of Nature
Mandelbrot Set
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 plane x0=0 for (n=1 to n max) { xn= xn2+c if (|xn|>2) break } If (n < n max) color c = white else color c = black
Magnified region
Mandelbrot Set
24
from http://www.astro.su.se/~alexis/fractals/
25
Compiled from Gary W. Flake The Computational Beauty of Nature
Mandelbrot Set
Newton Set
f(x) = x3 - 1 xn+1 = xn - f(x) / f'(x)
26
Recorded with XaoS
27
Recorded with XaoS
Phoenix Set
zn + 1 = zn 2 + Re(c) + Im(c) * zn - 1
Brownian Motion
The dance of pollen grains in a water drop (Robert Brown in 1827) Explained by Albert Einstein in 1905 Self-similar motion Infinite length Used to simulate rivers mountains and other random natural phenomena
28
Recorded with XaoS
29
Fractional Brownian Motion
Fractional BM (fBM) is a generalization of BM to include memory
Integral on progress of random walk
XMOUNTAINS
fBM characterized by its 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
30
Voss & Saupe in The Science of Fractal images
Landscape generated by the XMOUNTAINS program by Steven Booth Realistic, self-similar image
31
Compiled from Gary W. Flake The Computational Beauty of Nature
XMOUNTAINS:
Changing Fractal Dimension
Random Midpoint Displacement
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 for each interval Displace the midpoint at random but based on the difference between end points
32
34
Michael Shantz @ University of Waterloo
RMD Algorithm
Generate points a and b at random ymid = (1/2)(y(a)+y(b))+r y r = s(|b-a|)rg() s - is a surface roughness y(b) parameter y(a) rg()- returns a Gaussian random value a (mean = 0, variance = 1)
In 3D version: ym = (1/4)(y(a)+y(b)+y(c)+y(d))+r
y a y y(b) y(a) ymid a a+b 2 e m b
Controlling the Topography
To model real environments we want to control the placement of peaks and valleys We can do it by setting up Control Surfaces. Calculate random elevations based on:
Elevation of control surface Average elevation of the midpoint
x
x b
y a h
b f c
c x
35
36
Fractal Mountains
Ken Musgrave
Cellular Automata
Invented by John von Neumann in 1940s Thoroughly studied by Wolfram Mechanism to study reproduction Dynamic system
Discrete in space Discrete in time
37 38
Compiled from Gary W. Flake The Computational Beauty of Nature
Cellular Automata in Nature
Conus Textile Seashell
Process which creates seashells has been linked to a one-dimensional CA
39
Compiled from Gary W. Flake The Computational Beauty of Nature
Source: wikipedia.org
40