How to program a fractal?

后端 未结 14 996
花落未央
花落未央 2020-12-04 05:34

I do not have any experience with programming fractals. Of course I\'ve seen the famous Mandelbrot images and such.

Can you provide me with simple algorithms for fra

14条回答
  •  心在旅途
    2020-12-04 05:36

    Another excellent fractal to learn is the Sierpinski Triangle Fractal.

    Basically, draw three corners of a triangle (an equilateral is preferred, but any triangle will work), then start a point P at one of those corners. Move P halfway to any of the 3 corners at random, and draw a point there. Again move P halfway towards any random corner, draw, and repeat.

    You'd think the random motion would create a random result, but it really doesn't.

    Reference: http://en.wikipedia.org/wiki/Sierpinski_triangle

提交回复
热议问题