Fractals

From GenerativeArt

(Difference between revisions)
Jump to: navigation, search
(Fractal or Box Counting dimension: added map example and new formula from wikipedia)
Current revision (22:33, 16 September 2013) (view source)
(Fractal or Box Counting Dimension)
 
{{SingleImage|imageWidthPlusTen=410|imageURL=http://philipgalanter.com/generative_art/graphics/kochcurveprogression.gif|caption=The recursion of a Koch curve}}
{{SingleImage|imageWidthPlusTen=410|imageURL=http://philipgalanter.com/generative_art/graphics/kochcurveprogression.gif|caption=The recursion of a Koch curve}}
   //  Given:
   //  Given:
-
  //  DRAW(x1, y1, x2, y2)    :draws a point from (x1, y1) to (x2, y2)
 
   //  res                      :length of smallest line to be drawn
   //  res                      :length of smallest line to be drawn
 +
  //  DRAW(x1, y1, x2, y2)    :draws a point from (x1, y1) to (x2, y2)
   //  DIST(x1, y1, x2, y2)    :distance between points (x1, y1) and (x2, y2)
   //  DIST(x1, y1, x2, y2)    :distance between points (x1, y1) and (x2, y2)
 +
  //  BEND(x1, y1, x2, y2)    :takes one line segment and bends it into 4 returning tx1, ty,2, tx2, ..., ty5
   <br>
   <br>
   '''function''' KOCH(x1, y1, x2, y2, res)
   '''function''' KOCH(x1, y1, x2, y2, res)
           DRAW(x1, y1, x2, y2)
           DRAW(x1, y1, x2, y2)
       '''else'''
       '''else'''
-
           // calculate new set of line segments tx1, ty1, tx2, ty2, ..., tx5, ty5
+
           BEND(x1,y1,x2,y2)
           KOCH(tx1, ty1, tx2, ty2, res)
           KOCH(tx1, ty1, tx2, ty2, res)
           KOCH(tx2, ty2, tx3, ty3, res)
           KOCH(tx2, ty2, tx3, ty3, res)
=====Stochastic fractal river=====
=====Stochastic fractal river=====
Both fractals and L-systems can have stochastic (random/chance) forms.
Both fractals and L-systems can have stochastic (random/chance) forms.
-
   '''function''' RIVERBEND(x1, y1, x2, y2, res)
+
   //  Given:
 +
  //  res                      :length of smallest line to be drawn
 +
  //  DIST(x1, y1, x2, y2)    :distance between points (x1, y1) and (x2, y2)
 +
  //  BEND(x1, y1, x2, y2)    :returns x3,y3 randomly between and offset
 +
  <br>
 +
'''function''' RIVERBEND(x1, y1, x2, y2, res)
       '''if''' DIST(x1, y1, x2, y2) > res
       '''if''' DIST(x1, y1, x2, y2) > res
-
           // pick a random point on the line
+
           BEND(x1, y1, x2, y2)
-
          // offset it by a random amount
+
-
          // that new point is (x3, y3)
+
           RIVERBEND(x1, y1, x3, y3)
           RIVERBEND(x1, y1, x3, y3)
           RIVERBEND(x3, y3, x2, y2)
           RIVERBEND(x3, y3, x2, y2)
   <br>
   <br>
-
===Fractal or Box Counting dimension===  
+
===Fractal or Box Counting Dimension===  
<br />
<br />
 +
In traditional units a Koch curve will have infinite length but 0 area.  This is not a useful measurement.<br />
A measurement of dimension filling. For example, D = 1.4 means it fills more than a line, but less than a plane.<br />
A measurement of dimension filling. For example, D = 1.4 means it fills more than a line, but less than a plane.<br />
<br />
<br />
-
e.g. in traditional units a Koch curve will have infinite length but 0 area.  Not useful.<br />
+
Where epsilon is the relative size of the division (1, 1/2, 1/3, etc.), and N is the number of copies or boxes.<br />
-
{{SingleImage|imageWidthPlusTen=410|imageURL=http://philipgalanter.com/generative_art/graphics/kochcurveprogression.gif|caption=The recursion of a Koch curve}}
+
Using this formula for increasingly smaller divisions, if the object is a fractal the dimension will be about the same.<br />  
-
 
+
If the dimension changes with scale the object is not a fractal.<br />
 +
<br />
{{SingleImage|imageWidthPlusTen=510|imageURL=http://philipgalanter.com/generative_art/graphics/box_counting_formula.png|caption=}}<br />
{{SingleImage|imageWidthPlusTen=510|imageURL=http://philipgalanter.com/generative_art/graphics/box_counting_formula.png|caption=}}<br />
-
{{SingleImage|imageWidthPlusTen=510|imageURL=http://www.viz.tamu.edu/courses/viza626/10Fall/fractImg1.gif|caption=}}<br />
+
{{SingleImage|imageWidthPlusTen=510|imageURL=http://www.viz.tamu.edu/courses/viza626/10Fall/fractImg1.gif|caption=Cantor dust breaks the segment in thirds and discards the middle one}}<br />
-
{{SingleImage|imageWidthPlusTen=510|imageURL=http://www.viz.tamu.edu/courses/viza626/10Fall/fractImg2.gif|caption=}}<br />
+
{{SingleImage|imageWidthPlusTen=510|imageURL=http://www.viz.tamu.edu/courses/viza626/10Fall/fractImg2.gif|caption=Koch curve breaks the segment into 4 segments}}<br />
-
{{SingleImage|imageWidthPlusTen=510|imageURL=http://www.viz.tamu.edu/courses/viza626/10Fall/fractImg3.gif|caption=}}<br />
+
{{SingleImage|imageWidthPlusTen=510|imageURL=http://www.viz.tamu.edu/courses/viza626/10Fall/fractImg3.gif|caption=Note that a line segment has a fractal dimension of 1}}<br />
-
{{SingleImage|imageWidthPlusTen=510|imageURL=http://www.viz.tamu.edu/courses/viza626/10Fall/fractImg4.gif|caption=}}<br />
+
{{SingleImage|imageWidthPlusTen=510|imageURL=http://www.viz.tamu.edu/courses/viza626/10Fall/fractImg4.gif|caption=Note that a square has a fractal dimension of 2}}<br />
-
{{SingleImage|imageWidthPlusTen=510|imageURL=http://philipgalanter.com/generative_art/graphics/box_counting_dimension.png|caption=}}<br />
+
{{SingleImage|imageWidthPlusTen=600|imageURL=http://philipgalanter.com/generative_art/graphics/sierp-det.GIF|caption=The Sierpinski triangle is constructed yielding 3 copies at 1/2 size so the fractal dimension = log(3)/log(2) = 1.58}}<br />{{SingleImage|imageWidthPlusTen=1000|imageURL=http://philipgalanter.com/generative_art/graphics/box_counting_dimension.png|caption=Here is an illustration of the box counting method to measure the fractal dimension of actual objects, in this case the coastline of England}}<br />

Current revision

Personal tools