/** Buddhabrot Demo * by Xavier Gouchet, 2008 * http://www.xgouchet.fr * xavier.gouchet@gmail.com */ // aerea settings float top = 1.5; float bottom = -1.5; float left = -2.0; float right = 1.0; // mndlbrt settings float step = 0.01; float mstep = 0.01; int limitR = 256; int limitG = 64; int limitB = 16; // display settings int width, height; int mwidth, mheight; // grids int[][][] mset; int[][][] bset; // Loop control int x=0,y=0,pass=0; int limit = max(max(limitR,limitG),limitB); // color level int mxR = 0, mxG = 0, mxB = 0; void setup(){ // Init frame settings width = (int) ( (right - left) / step ); height = (int) ( (top - bottom) / step ); size(width,height); background(0); frameRate(120); // init grids mwidth = (int) ( (right - left) / mstep ); mheight = (int) ( (top - bottom) / mstep ); mset = new int[mwidth][mheight][3]; bset = new int[mwidth][mheight][3]; } void draw(){ //print (pass); //println (" -> "); switch (pass){ case 0 : mandelbrot(); break; case 1 : buddhabrot(); break; case 2 : exposure(); break; default : break; } } void mandelbrot(){ for (int l = 0; l<100; l++){ if ((x 4){ stroke(96); break; } // decal Mx = Nx; My = Ny; } int i = (int) round((Cx-left)/step); int j = (int) round((Cy-bottom)/step); point(i,j); } // Inc X and Y x ++; if (x>=mwidth){ x=0; y++; if (y>= mheight){ x = 0; y=0; pass++; } } } } void buddhabrot(){ for (int l = 0; l<50; l++){ if ((x0)&&(gi0)&&(gj=mwidth){ x=0; y++; if (y>= mheight){ x = 0; y=0; pass++; println(mxR); println(mxG); println(mxB); } } } } void exposure(){ for (int l = 0; l<100; l++){ if ((x=0) && (nx=0) && (ny=mwidth){ x=0; y++; if (y>= mheight){ x = 0; y=0; pass++; } } } }