SlideShare a Scribd company logo
CS 543: Computer Graphics
Lecture 3 (Part I): Fractals
Emmanuel Agu
What are Fractals?
n Mathematical expressions
n Approach infinity in organized way
n Utilizes recursion on computers
n Popularized by Benoit Mandelbrot (Yale university)
n Dimensional:
n Line is one-dimensional
n Plane is two-dimensional
n Defined in terms of self-similarity
Fractals: Self-similarity
n Level of detail remains the same as we zoom in
n Example: surface roughness or profile same as we zoom in
n Types:
n Exactly self-similar
n Statistically self-similar
Examples of Fractals
n Clouds
n Grass
n Fire
n Modeling mountains (terrain)
n Coastline
n Branches of a tree
n Surface of a sponge
n Cracks in the pavement
n Designing antennae (www.fractenna.com)
Example: Mandelbrot Set
Example: Mandelbrot Set
Example: Fractal Terrain
Courtesy: Mountain 3D
Fractal Terrain software
Example: Fractal Terrain
Example: Fractal Art
Courtesy: Internet
Fractal Art Contest
Application: Fractal Art
Courtesy: Internet
Fractal Art Contest
Koch Curves
n Discovered in 1904 by Helge von Koch
n Start with straight line of length 1
n Recursively:
n Divide line into 3 equal parts
n Replace middle section with triangular bump with sides of
length 1/3
n New length = 4/3
Koch Curves
S3, S4, S5,
Koch Snowflakes
n Can form Koch snowflake by joining three Koch curves
n Perimeter of snowflake grows as:
where Pi is the perimeter of the ith snowflake iteration
n However, area grows slowly and S∞ = 8/5!!
n Self-similar:
n zoom in on any portion
n If n is large enough, shape still same
n On computer, smallest line segment > pixel spacing
( )i
iP
3
43=
Koch Snowflakes
Pseudocode, to draw Kn:
If (n equals 0) draw straight line
Else{
Draw Kn-1
Turn left 60°
Draw Kn-1
Turn right 120°
Draw Kn-1
Turn left 60°
Draw Kn-1
}
Iterated Function Systems (IFS)
n Recursively call a function
n Does result converge to an image? What image?
n IFS’s converge to an image
n Examples:
n The Fern
n The Mandelbrot set
The Fern
Mandelbrot Set
n Based on iteration theory
n Function of interest:
n Sequence of values (or orbit):
cszf += 2
)()(
ccccsd
cccsd
ccsd
csd
++++=
+++=
++=
+=
2222
4
222
3
22
2
2
1
))))((((
)))(((
))((
)(
Mandelbrot Set
n Orbit depends on s and c
n Basic question,:
n For given s and c,
• does function stay finite? (within Mandelbrot set)
• explode to infinity? (outside Mandelbrot set)
n Definition: if |d| < 1, orbit is finite else inifinite
n Examples orbits:
n s = 0, c = -1, orbit = 0,-1,0,-1,0,-1,0,-1,…..finite
n s = 0, c = 1, orbit = 0,1,2,5,26,677…… explodes
Mandelbrot Set
n Mandelbrot set: use complex numbers for c and s
n Always set s = 0
n Choose c as a complex number
n For example:
• s = 0, c = 0.2 + 0.5i
n Hence, orbit:
• 0, c, c2, c2+ c, (c2+ c)2 + c, ………
n Definition: Mandelbrot set includes all finite orbit c
Mandelbrot Set
n Some complex number math:
n For example:
n Modulus of a complex number, z = ai + b:
n Squaring a complex number:
1* −=ii
63*2 −=ii
22
baz +=
ixyyxyix )2()( 22
+−=+
Im
Re
Argand
diagram
Mandelbrot Set
n Calculate first 4 terms
n with s=2, c=-1
n with s = 0, c = -2+i
Mandelbrot Set
n Calculate first 3 terms
n with s=2, c=-1, terms are
n with s = 0, c = -2+i
575124
2415
512
2
2
2
=−
=−
=−
( ) iii
iii
ii
510)2(31
31)2()2(
2)2(0
2
2
−−=+−+−
−=+−++−
+−=+−+
Mandelbrot Set
n Fixed points: Some complex numbers converge to certain
values after x iterations.
n Example:
n s = 0, c = -0.2 + 0.5i converges to –0.249227 + 0.333677i
after 80 iterations
n Experiment: square –0.249227 + 0.333677i and add
-0.2 + 0.5i
n Mandelbrot set depends on the fact the convergence of
certain complex numbers
Mandelbrot Set
n Routine to draw Mandelbrot set:
n Cannot iterate forever: our program will hang!
n Instead iterate 100 times
n Math theorem:
n if number hasn’t exceeded 2 after 100 iterations, never will!
n Routine returns:
n Number of times iterated before modulus exceeds 2, or
n 100, if modulus doesn’t exceed 2 after 100 iterations
n See dwell( ) function in Hill (figure A4.5, pg. 755)
Mandelbrot dwell( ) function (pg. 755)
int dwell(double cx, double cy)
{ // return true dwell or Num, whichever is smaller
#define Num 100 // increase this for better pics
double tmp, dx = cx, dy = cy, fsq = cx*cx + cy*cy;
for(int count = 0;count <= Num && fsq <= 4; count++)
{
tmp = dx; // save old real part
dx = dx*dx – dy*dy + cx; // new real part
dy = 2.0 * tmp * dy + cy; // new imag. Part
fsq = dx*dx + dy*dy;
}
return count; // number of iterations used
}
Mandelbrot Set
n Map real part to x-axis
n Map imaginary part to y-axis
n Set world window to range of complex numbers to
investigate. E.g:
n X in range [-2.25: 0.75]
n Y in range [-1.5: 1.5]
n Choose your viewport. E.g:
n Viewport = [V.L, V.R, V.B, V.T]= [60,380,80,240]
n Do window-to-viewport mapping
Mandelbrot Set
Mandelbrot Set
n So, for each pixel:
n Compute corresponding point in world
n Call your dwell( ) function
n Assign color <Red,Green,Blue> based on dwell( ) return
value
n Choice of color determines how pretty
n Color assignment:
n Basic: In set (i.e. dwell( ) = 100), color = black, else color =
white
n Discrete: Ranges of return values map to same color
• E.g 0 – 20 iterations = color 1
• 20 – 40 iterations = color 2, etc.
n Continuous: Use a function
Mandelbrot Set
Use continuous function
FREE SOFTWARE
n Free fractal generating software
n Fractint
n FracZoom
n Astro Fractals
n Fractal Studio
n 3DFract
References
n Hill, Appendix 4
Ad

More Related Content

What's hot (20)

Lec02 03 rasterization
Lec02 03 rasterizationLec02 03 rasterization
Lec02 03 rasterization
Maaz Rizwan
 
Presentation 2(power point presentation) dis2016
Presentation 2(power point presentation) dis2016Presentation 2(power point presentation) dis2016
Presentation 2(power point presentation) dis2016
Daniel Omunting
 
Graphics6 bresenham circlesandpolygons
Graphics6 bresenham circlesandpolygonsGraphics6 bresenham circlesandpolygons
Graphics6 bresenham circlesandpolygons
Ketan Jani
 
Computer graphics 2
Computer graphics 2Computer graphics 2
Computer graphics 2
Prabin Gautam
 
Unit 3
Unit 3Unit 3
Unit 3
Siddhant Goyal
 
Computer graphics presentation
Computer graphics presentationComputer graphics presentation
Computer graphics presentation
LOKENDRA PRAJAPATI
 
Implementation
ImplementationImplementation
Implementation
Syed Zaid Irshad
 
Dda algo notes
Dda algo notesDda algo notes
Dda algo notes
shreeja asopa
 
DDA algorithm
DDA algorithmDDA algorithm
DDA algorithm
Yash Patel
 
Circle generation algorithm
Circle generation algorithmCircle generation algorithm
Circle generation algorithm
Ankit Garg
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.
Mohd Arif
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
Kamal Acharya
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
Nanhen Verma
 
bresenham circles and polygons in computer graphics(Computer graphics tutorials)
bresenham circles and polygons in computer graphics(Computer graphics tutorials)bresenham circles and polygons in computer graphics(Computer graphics tutorials)
bresenham circles and polygons in computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
Introduction to curve
Introduction to curveIntroduction to curve
Introduction to curve
Omprakash Chauhan
 
Bresenhamcircle derivation
Bresenhamcircle derivationBresenhamcircle derivation
Bresenhamcircle derivation
Mazharul Islam
 
Dda line algorithm presentatiion
Dda line algorithm presentatiionDda line algorithm presentatiion
Dda line algorithm presentatiion
MuhammadHamza401
 
Circle drawing algo.
Circle drawing algo.Circle drawing algo.
Circle drawing algo.
Mohd Arif
 
Bresenham derivation
Bresenham derivationBresenham derivation
Bresenham derivation
Kumar
 
5.1 quadratic functions
5.1 quadratic functions5.1 quadratic functions
5.1 quadratic functions
morrobea
 
Lec02 03 rasterization
Lec02 03 rasterizationLec02 03 rasterization
Lec02 03 rasterization
Maaz Rizwan
 
Presentation 2(power point presentation) dis2016
Presentation 2(power point presentation) dis2016Presentation 2(power point presentation) dis2016
Presentation 2(power point presentation) dis2016
Daniel Omunting
 
Graphics6 bresenham circlesandpolygons
Graphics6 bresenham circlesandpolygonsGraphics6 bresenham circlesandpolygons
Graphics6 bresenham circlesandpolygons
Ketan Jani
 
Computer graphics presentation
Computer graphics presentationComputer graphics presentation
Computer graphics presentation
LOKENDRA PRAJAPATI
 
Circle generation algorithm
Circle generation algorithmCircle generation algorithm
Circle generation algorithm
Ankit Garg
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.
Mohd Arif
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
Kamal Acharya
 
Bresenhamcircle derivation
Bresenhamcircle derivationBresenhamcircle derivation
Bresenhamcircle derivation
Mazharul Islam
 
Dda line algorithm presentatiion
Dda line algorithm presentatiionDda line algorithm presentatiion
Dda line algorithm presentatiion
MuhammadHamza401
 
Circle drawing algo.
Circle drawing algo.Circle drawing algo.
Circle drawing algo.
Mohd Arif
 
Bresenham derivation
Bresenham derivationBresenham derivation
Bresenham derivation
Kumar
 
5.1 quadratic functions
5.1 quadratic functions5.1 quadratic functions
5.1 quadratic functions
morrobea
 

Viewers also liked (20)

Unit testing
Unit testingUnit testing
Unit testing
princezzlove
 
Introduction to the Servlet / JSP course
Introduction to the Servlet / JSP course Introduction to the Servlet / JSP course
Introduction to the Servlet / JSP course
JavaEE Trainers
 
Software quality assurance
Software quality assuranceSoftware quality assurance
Software quality assurance
Prof. Erwin Globio
 
Web application using JSP
Web application using JSPWeb application using JSP
Web application using JSP
Kaml Sah
 
Data Access with JDBC
Data Access with JDBCData Access with JDBC
Data Access with JDBC
BG Java EE Course
 
Jdbc Dao it-slideshares.blogspot.com
Jdbc Dao it-slideshares.blogspot.comJdbc Dao it-slideshares.blogspot.com
Jdbc Dao it-slideshares.blogspot.com
phanleson
 
jdbc
jdbcjdbc
jdbc
Gayatri Patel
 
Jsp
JspJsp
Jsp
DSKUMAR G
 
1 intro of data structure course
1  intro of data structure course1  intro of data structure course
1 intro of data structure course
Mahmoud Alfarra
 
JDBC Driver Types
JDBC Driver TypesJDBC Driver Types
JDBC Driver Types
Rahul Sharma
 
Jdbc in java
Jdbc in javaJdbc in java
Jdbc in java
Asya Dudnik
 
Fundamentals of Software Testing
Fundamentals of Software TestingFundamentals of Software Testing
Fundamentals of Software Testing
Sagar Joshi
 
02-Hibernate. Hibernate
02-Hibernate. Hibernate02-Hibernate. Hibernate
02-Hibernate. Hibernate
Roman Brovko
 
2 introduction to data structure
2  introduction to data structure2  introduction to data structure
2 introduction to data structure
Mahmoud Alfarra
 
Test Levels & Techniques
Test Levels & TechniquesTest Levels & Techniques
Test Levels & Techniques
Dhanasekaran Nagarajan
 
Data structure and its types
Data structure and its typesData structure and its types
Data structure and its types
Navtar Sidhu Brar
 
Introduction to hibernate
Introduction to hibernateIntroduction to hibernate
Introduction to hibernate
hr1383
 
Java server pages
Java server pagesJava server pages
Java server pages
Tanmoy Barman
 
Intro To Hibernate
Intro To HibernateIntro To Hibernate
Intro To Hibernate
Amit Himani
 
Jsp
JspJsp
Jsp
Mumbai Academisc
 
Introduction to the Servlet / JSP course
Introduction to the Servlet / JSP course Introduction to the Servlet / JSP course
Introduction to the Servlet / JSP course
JavaEE Trainers
 
Web application using JSP
Web application using JSPWeb application using JSP
Web application using JSP
Kaml Sah
 
Jdbc Dao it-slideshares.blogspot.com
Jdbc Dao it-slideshares.blogspot.comJdbc Dao it-slideshares.blogspot.com
Jdbc Dao it-slideshares.blogspot.com
phanleson
 
1 intro of data structure course
1  intro of data structure course1  intro of data structure course
1 intro of data structure course
Mahmoud Alfarra
 
Fundamentals of Software Testing
Fundamentals of Software TestingFundamentals of Software Testing
Fundamentals of Software Testing
Sagar Joshi
 
02-Hibernate. Hibernate
02-Hibernate. Hibernate02-Hibernate. Hibernate
02-Hibernate. Hibernate
Roman Brovko
 
2 introduction to data structure
2  introduction to data structure2  introduction to data structure
2 introduction to data structure
Mahmoud Alfarra
 
Data structure and its types
Data structure and its typesData structure and its types
Data structure and its types
Navtar Sidhu Brar
 
Introduction to hibernate
Introduction to hibernateIntroduction to hibernate
Introduction to hibernate
hr1383
 
Intro To Hibernate
Intro To HibernateIntro To Hibernate
Intro To Hibernate
Amit Himani
 
Ad

Similar to Lecture03 p1 (20)

parameterized complexity for graph Motif
parameterized complexity for graph Motifparameterized complexity for graph Motif
parameterized complexity for graph Motif
AMR koura
 
detailed study for Fractals for Computer graphics
detailed study for Fractals for Computer graphicsdetailed study for Fractals for Computer graphics
detailed study for Fractals for Computer graphics
vaibhavsurana2004
 
tutorial5.ppt
tutorial5.ppttutorial5.ppt
tutorial5.ppt
jvjfvvoa
 
Trident International Graphics Workshop 2014 4/5
Trident International Graphics Workshop 2014 4/5Trident International Graphics Workshop 2014 4/5
Trident International Graphics Workshop 2014 4/5
Takao Wada
 
"Mesh of Periodic Minimal Surfaces in CGAL."
"Mesh of Periodic Minimal Surfaces in CGAL.""Mesh of Periodic Minimal Surfaces in CGAL."
"Mesh of Periodic Minimal Surfaces in CGAL."
Vissarion Fisikopoulos
 
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdfCD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
RajJain516913
 
Dynamic Programming.pptx
Dynamic Programming.pptxDynamic Programming.pptx
Dynamic Programming.pptx
Thanga Ramya S
 
Complex Integral
Complex IntegralComplex Integral
Complex Integral
HalmatJalalHassan
 
Chapter-05c-Image-Restoration-(Reconstruction-from-Projections).ppt
Chapter-05c-Image-Restoration-(Reconstruction-from-Projections).pptChapter-05c-Image-Restoration-(Reconstruction-from-Projections).ppt
Chapter-05c-Image-Restoration-(Reconstruction-from-Projections).ppt
VSUDHEER4
 
CS 354 More Graphics Pipeline
CS 354 More Graphics PipelineCS 354 More Graphics Pipeline
CS 354 More Graphics Pipeline
Mark Kilgard
 
CS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and CullingCS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and Culling
Mark Kilgard
 
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeksBeginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
JinTaek Seo
 
Solution of matlab chapter 6
Solution of matlab chapter 6Solution of matlab chapter 6
Solution of matlab chapter 6
AhsanIrshad8
 
Drawing Tools
Drawing ToolsDrawing Tools
Drawing Tools
Ghaffar Khan
 
3.pdf
3.pdf3.pdf
3.pdf
Dhiraj Bhaskar
 
Cgm Lab Manual
Cgm Lab ManualCgm Lab Manual
Cgm Lab Manual
Oriental College of Technology,Bhopal
 
Primitives
PrimitivesPrimitives
Primitives
Nageswara Rao Gottipati
 
01 - DAA - PPT.pptx
01 - DAA - PPT.pptx01 - DAA - PPT.pptx
01 - DAA - PPT.pptx
KokilaK25
 
Visualization of general defined space data
Visualization of general defined space dataVisualization of general defined space data
Visualization of general defined space data
ijcga
 
ADVANCED ALGORITHMS-UNIT-3-Final.ppt
ADVANCED   ALGORITHMS-UNIT-3-Final.pptADVANCED   ALGORITHMS-UNIT-3-Final.ppt
ADVANCED ALGORITHMS-UNIT-3-Final.ppt
ssuser702532
 
parameterized complexity for graph Motif
parameterized complexity for graph Motifparameterized complexity for graph Motif
parameterized complexity for graph Motif
AMR koura
 
detailed study for Fractals for Computer graphics
detailed study for Fractals for Computer graphicsdetailed study for Fractals for Computer graphics
detailed study for Fractals for Computer graphics
vaibhavsurana2004
 
tutorial5.ppt
tutorial5.ppttutorial5.ppt
tutorial5.ppt
jvjfvvoa
 
Trident International Graphics Workshop 2014 4/5
Trident International Graphics Workshop 2014 4/5Trident International Graphics Workshop 2014 4/5
Trident International Graphics Workshop 2014 4/5
Takao Wada
 
"Mesh of Periodic Minimal Surfaces in CGAL."
"Mesh of Periodic Minimal Surfaces in CGAL.""Mesh of Periodic Minimal Surfaces in CGAL."
"Mesh of Periodic Minimal Surfaces in CGAL."
Vissarion Fisikopoulos
 
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdfCD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
RajJain516913
 
Dynamic Programming.pptx
Dynamic Programming.pptxDynamic Programming.pptx
Dynamic Programming.pptx
Thanga Ramya S
 
Chapter-05c-Image-Restoration-(Reconstruction-from-Projections).ppt
Chapter-05c-Image-Restoration-(Reconstruction-from-Projections).pptChapter-05c-Image-Restoration-(Reconstruction-from-Projections).ppt
Chapter-05c-Image-Restoration-(Reconstruction-from-Projections).ppt
VSUDHEER4
 
CS 354 More Graphics Pipeline
CS 354 More Graphics PipelineCS 354 More Graphics Pipeline
CS 354 More Graphics Pipeline
Mark Kilgard
 
CS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and CullingCS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and Culling
Mark Kilgard
 
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeksBeginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
JinTaek Seo
 
Solution of matlab chapter 6
Solution of matlab chapter 6Solution of matlab chapter 6
Solution of matlab chapter 6
AhsanIrshad8
 
01 - DAA - PPT.pptx
01 - DAA - PPT.pptx01 - DAA - PPT.pptx
01 - DAA - PPT.pptx
KokilaK25
 
Visualization of general defined space data
Visualization of general defined space dataVisualization of general defined space data
Visualization of general defined space data
ijcga
 
ADVANCED ALGORITHMS-UNIT-3-Final.ppt
ADVANCED   ALGORITHMS-UNIT-3-Final.pptADVANCED   ALGORITHMS-UNIT-3-Final.ppt
ADVANCED ALGORITHMS-UNIT-3-Final.ppt
ssuser702532
 
Ad

More from aa11bb11 (11)

Mathematical elements-for-computer-graphics-1
Mathematical elements-for-computer-graphics-1Mathematical elements-for-computer-graphics-1
Mathematical elements-for-computer-graphics-1
aa11bb11
 
Lect14
Lect14Lect14
Lect14
aa11bb11
 
Java assgn
Java assgnJava assgn
Java assgn
aa11bb11
 
Graphics assgnmnt
Graphics assgnmntGraphics assgnmnt
Graphics assgnmnt
aa11bb11
 
Graphics pdf
Graphics pdfGraphics pdf
Graphics pdf
aa11bb11
 
Graphics devices
Graphics devicesGraphics devices
Graphics devices
aa11bb11
 
Course plan computer graphics lab
Course plan computer graphics labCourse plan computer graphics lab
Course plan computer graphics lab
aa11bb11
 
Course plan computer graphics
Course plan computer graphicsCourse plan computer graphics
Course plan computer graphics
aa11bb11
 
Code
CodeCode
Code
aa11bb11
 
B spline
B splineB spline
B spline
aa11bb11
 
Bresenham circlesandpolygons
Bresenham circlesandpolygonsBresenham circlesandpolygons
Bresenham circlesandpolygons
aa11bb11
 
Mathematical elements-for-computer-graphics-1
Mathematical elements-for-computer-graphics-1Mathematical elements-for-computer-graphics-1
Mathematical elements-for-computer-graphics-1
aa11bb11
 
Java assgn
Java assgnJava assgn
Java assgn
aa11bb11
 
Graphics assgnmnt
Graphics assgnmntGraphics assgnmnt
Graphics assgnmnt
aa11bb11
 
Graphics pdf
Graphics pdfGraphics pdf
Graphics pdf
aa11bb11
 
Graphics devices
Graphics devicesGraphics devices
Graphics devices
aa11bb11
 
Course plan computer graphics lab
Course plan computer graphics labCourse plan computer graphics lab
Course plan computer graphics lab
aa11bb11
 
Course plan computer graphics
Course plan computer graphicsCourse plan computer graphics
Course plan computer graphics
aa11bb11
 
Bresenham circlesandpolygons
Bresenham circlesandpolygonsBresenham circlesandpolygons
Bresenham circlesandpolygons
aa11bb11
 

Lecture03 p1

  • 1. CS 543: Computer Graphics Lecture 3 (Part I): Fractals Emmanuel Agu
  • 2. What are Fractals? n Mathematical expressions n Approach infinity in organized way n Utilizes recursion on computers n Popularized by Benoit Mandelbrot (Yale university) n Dimensional: n Line is one-dimensional n Plane is two-dimensional n Defined in terms of self-similarity
  • 3. Fractals: Self-similarity n Level of detail remains the same as we zoom in n Example: surface roughness or profile same as we zoom in n Types: n Exactly self-similar n Statistically self-similar
  • 4. Examples of Fractals n Clouds n Grass n Fire n Modeling mountains (terrain) n Coastline n Branches of a tree n Surface of a sponge n Cracks in the pavement n Designing antennae (www.fractenna.com)
  • 7. Example: Fractal Terrain Courtesy: Mountain 3D Fractal Terrain software
  • 9. Example: Fractal Art Courtesy: Internet Fractal Art Contest
  • 10. Application: Fractal Art Courtesy: Internet Fractal Art Contest
  • 11. Koch Curves n Discovered in 1904 by Helge von Koch n Start with straight line of length 1 n Recursively: n Divide line into 3 equal parts n Replace middle section with triangular bump with sides of length 1/3 n New length = 4/3
  • 13. Koch Snowflakes n Can form Koch snowflake by joining three Koch curves n Perimeter of snowflake grows as: where Pi is the perimeter of the ith snowflake iteration n However, area grows slowly and S∞ = 8/5!! n Self-similar: n zoom in on any portion n If n is large enough, shape still same n On computer, smallest line segment > pixel spacing ( )i iP 3 43=
  • 14. Koch Snowflakes Pseudocode, to draw Kn: If (n equals 0) draw straight line Else{ Draw Kn-1 Turn left 60° Draw Kn-1 Turn right 120° Draw Kn-1 Turn left 60° Draw Kn-1 }
  • 15. Iterated Function Systems (IFS) n Recursively call a function n Does result converge to an image? What image? n IFS’s converge to an image n Examples: n The Fern n The Mandelbrot set
  • 17. Mandelbrot Set n Based on iteration theory n Function of interest: n Sequence of values (or orbit): cszf += 2 )()( ccccsd cccsd ccsd csd ++++= +++= ++= += 2222 4 222 3 22 2 2 1 ))))(((( )))((( ))(( )(
  • 18. Mandelbrot Set n Orbit depends on s and c n Basic question,: n For given s and c, • does function stay finite? (within Mandelbrot set) • explode to infinity? (outside Mandelbrot set) n Definition: if |d| < 1, orbit is finite else inifinite n Examples orbits: n s = 0, c = -1, orbit = 0,-1,0,-1,0,-1,0,-1,…..finite n s = 0, c = 1, orbit = 0,1,2,5,26,677…… explodes
  • 19. Mandelbrot Set n Mandelbrot set: use complex numbers for c and s n Always set s = 0 n Choose c as a complex number n For example: • s = 0, c = 0.2 + 0.5i n Hence, orbit: • 0, c, c2, c2+ c, (c2+ c)2 + c, ……… n Definition: Mandelbrot set includes all finite orbit c
  • 20. Mandelbrot Set n Some complex number math: n For example: n Modulus of a complex number, z = ai + b: n Squaring a complex number: 1* −=ii 63*2 −=ii 22 baz += ixyyxyix )2()( 22 +−=+ Im Re Argand diagram
  • 21. Mandelbrot Set n Calculate first 4 terms n with s=2, c=-1 n with s = 0, c = -2+i
  • 22. Mandelbrot Set n Calculate first 3 terms n with s=2, c=-1, terms are n with s = 0, c = -2+i 575124 2415 512 2 2 2 =− =− =− ( ) iii iii ii 510)2(31 31)2()2( 2)2(0 2 2 −−=+−+− −=+−++− +−=+−+
  • 23. Mandelbrot Set n Fixed points: Some complex numbers converge to certain values after x iterations. n Example: n s = 0, c = -0.2 + 0.5i converges to –0.249227 + 0.333677i after 80 iterations n Experiment: square –0.249227 + 0.333677i and add -0.2 + 0.5i n Mandelbrot set depends on the fact the convergence of certain complex numbers
  • 24. Mandelbrot Set n Routine to draw Mandelbrot set: n Cannot iterate forever: our program will hang! n Instead iterate 100 times n Math theorem: n if number hasn’t exceeded 2 after 100 iterations, never will! n Routine returns: n Number of times iterated before modulus exceeds 2, or n 100, if modulus doesn’t exceed 2 after 100 iterations n See dwell( ) function in Hill (figure A4.5, pg. 755)
  • 25. Mandelbrot dwell( ) function (pg. 755) int dwell(double cx, double cy) { // return true dwell or Num, whichever is smaller #define Num 100 // increase this for better pics double tmp, dx = cx, dy = cy, fsq = cx*cx + cy*cy; for(int count = 0;count <= Num && fsq <= 4; count++) { tmp = dx; // save old real part dx = dx*dx – dy*dy + cx; // new real part dy = 2.0 * tmp * dy + cy; // new imag. Part fsq = dx*dx + dy*dy; } return count; // number of iterations used }
  • 26. Mandelbrot Set n Map real part to x-axis n Map imaginary part to y-axis n Set world window to range of complex numbers to investigate. E.g: n X in range [-2.25: 0.75] n Y in range [-1.5: 1.5] n Choose your viewport. E.g: n Viewport = [V.L, V.R, V.B, V.T]= [60,380,80,240] n Do window-to-viewport mapping
  • 28. Mandelbrot Set n So, for each pixel: n Compute corresponding point in world n Call your dwell( ) function n Assign color <Red,Green,Blue> based on dwell( ) return value n Choice of color determines how pretty n Color assignment: n Basic: In set (i.e. dwell( ) = 100), color = black, else color = white n Discrete: Ranges of return values map to same color • E.g 0 – 20 iterations = color 1 • 20 – 40 iterations = color 2, etc. n Continuous: Use a function
  • 30. FREE SOFTWARE n Free fractal generating software n Fractint n FracZoom n Astro Fractals n Fractal Studio n 3DFract