// sphere city float mainScale=0.5; // global variable for drawspeed float mainLen, mainLenMin=0.65, mainLenDec=0.00012; float mainRot; float randomBirth, randomBirthDec=0.00001; int[][] usedBy=new int[600][300]; // array that keeps track of draw-lines (who drew which pixel?) int unique_id; // unique id's for curves boolean initAll; void setup() { size(600,300,P3D); background(255); setupColors(); initAll=true; } void draw() { if (initAll) { background(255); initAll=false; for (int x=0;xmainLenMin&&random(1)=width) {x-=width;} while (y<0) {y+=height;} while (y>=height) {y-=height;} int sx=int(x), sy=int(y); setSmooth(sx,sy,c,0.1*f); f-=0.002; if (f<=0) {active=false;} int use=usedBy[sx][sy]; if (use!=-1&&use!=id) {active=false;} } } } ////////////////////////////// end Filler ////////////////////////////// ////////////////////////////// class Curvedrawer ////////////////////////////// int nr_curves=1000; int maxChildren=12; Curvedrawer[] curvedrawer; void initCurves() { curvedrawer=new Curvedrawer[nr_curves]; for (int i=0;i=width) {x-=width;} while (y<0) {y+=height;} while (y>=height) {y-=height;} // check for full circle: fullrot+=rot; if (fullrot>TWO_PI) {active=false;} // draw filler: color c=fillColor[fillColorIndex][(int)random(fillColor[fillColorIndex].length)]; findAndCreateFiller(id,x,y,dir-(HALF_PI+fillerDir),len*0.5,0.1+mainLen-mainLenMin,c); findAndCreateFiller(id,x,y,dir+(HALF_PI+fillerDir),len*0.5,0.1+mainLen-mainLenMin,c); // draw: int sx=int(x), sy=int(y); if (sx>=0&&sx=0&sy0?1:-1; float ndir=dir+dr*HALF_PI; float nx=x+len*cos(ndir), ny=y+len*sin(ndir); float nlen=len; int ncol;//=(int)random(mainColor.length); do { ncol=colorIndex+(random(1)<0.5?-1:1); } while (ncol<0||ncol>=mainColor.length); findAndCreateCurve(nx,ny,ndir,nlen,ncol); } } ////////////////////////////// end Curvedrawer ////////////////////////////// ////////////////////////////// drawing routines ////////////////////////////// void setSmooth(int x, int y, color c1, float p1) { float p2=1.0-p1; color c2=get(x,y); int rr=int(p1*(c1>>16&255)+p2*(c2>>16&255)); int gg=int(p1*(c1>>8&255)+p2*(c2>>8&255)); int bb=int(p1*(c1&255)+p2*(c2&255)); set(x,y,rr<<16|gg<<8|bb); } ////////////////////////////// end drawing routines //////////////////////////////