Fractals

From GenerativeArt

(Difference between revisions)
Jump to: navigation, search
(Fractal or Box Counting dimension: added map example and new formula from wikipedia)
(Recursive Koch curve: improve pseudocode)
{{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)

Revision as of 20:44, 16 September 2013

Personal tools