Fractals
From GenerativeArt
(Difference between revisions)
(→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: | ||
- | |||
// 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''' | ||
- | + | 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) |