Fractals
From GenerativeArt
(Difference between revisions)
(→Stochastic fractal river) |
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: | ||
- | |||
// 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) | ||
=====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 | ||
- | + | BEND(x1, y1, x2, y2) | |
- | + | ||
- | + | ||
RIVERBEND(x1, y1, x3, y3) | RIVERBEND(x1, y1, x3, y3) | ||
RIVERBEND(x3, y3, x2, y2) | RIVERBEND(x3, y3, x2, y2) | ||
<br> | <br> | ||
- | ===Fractal or | + | ===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 /> | ||
<br /> | <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=510|imageURL=http:// | + | 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 /> | |
- | {{SingleImage|imageWidthPlusTen=510|imageURL=http://www.viz.tamu.edu/courses/viza626/10Fall/fractImg1.gif|caption=}}<br /> | + | <br /> |
- | {{SingleImage|imageWidthPlusTen=510|imageURL=http://www.viz.tamu.edu/courses/viza626/10Fall/fractImg2.gif|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/fractImg3.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/fractImg4.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=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=Note that a square has a fractal dimension of 2}}<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 /> |