Figure Asymptote fractales -- 008
🔗This picture comes from the Asymptote gallery of topic fractales

Show fractales/fig0080.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Surveys | Fractals
Tags : #Fractals | #Loop/for/while | #Picture
size(10cm,0); real mandelbrot(pair c, real r, int count=100) { int i=0; pair z=c; do { ++i; z=z^2+c; } while (length(z) <= r && i<count); return (i<count) ? i/count : 0; } real r=4; real step=.01; real xmin=-2.25, xmax=.75; real ymin=-1.3, ymax=0; real x=xmin, y=ymin; int xloop=round((xmax-xmin)/step); int yloop=round((ymax-ymin)/step); pen p; path sq=scale(step)*unitsquare; for(int i=0; i < xloop; ++i) { for(int j=0; j < yloop; ++j) { p=mandelbrot((x,y),r,20)*red; filldraw(shift(x,y)*sq,p,p); y += step; } x += step; y=ymin; } add(reflect((0,0),(1,0))*currentpicture);