// sphere city color[] mainColor = { 0x715F2C, 0x857031, 0x9B853B, 0x5E451D, 0x655422, 0x422B0E, 0x564520 }; color[][] fillColor = { { 0x6F6AAC, 0x7B71AE, 0x8477BC, 0x9084B4, 0x8076B3, 0x7F76B9 }, { 0xC7749E, 0xCE739F, 0xCA719D, 0xCB78A2, 0xD67FAC, 0xD279A5 }, // { 0xE584AD, 0xF08EB7, 0xF091B1, 0xF990B8, 0xF58FBE, 0xEF8AB4 }, { 0xF38F9B, 0xFC96A3, 0xF995A1, 0xFFA8AE, 0xFA9AA6, 0xF8939B }, { 0xFADB80, 0xFADC7A, 0xFCDF79, 0xF8DB75, 0xFFE181, 0xFDDE81 }, { 0x85AE07, 0x7EA400, 0x83AE07, 0x7C9F07, 0x7AA800, 0x7FA406 }, { 0x697728, 0x677623, 0x627B16, 0x6B811F, 0x657D1B, 0x6E8326 } }; float mainScale=0.5; // global variable for drawspeed float mainLen; float mainRot; int[][] usedBy; // array that keeps track of draw-lines (who drew which pixel?) int unique_id; // unique id's for curves void setup() { size(800,400,P3D); background(255); usedBy = new int[800][400]; for (int x=0;x0.3&&random(1)<0.04) { findAndCreateCurve(mainLen); } updateCurvedrawers(); updateFillers(); } void mousePressed() { setup(); } ////////////////////////////// class Filler ////////////////////////////// int nr_fillers=20000; Filler[] filler; void initFillers() { filler=new Filler[nr_fillers]; for (int i=0;i=width) {x-=width;} while (y<0) {y+=height;} while (y>=height) {y-=height;} int sx=int(x), sy=int(y); setDarken(sx,sy,c,0.2*f); f-=0.005; 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=8; 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,mainLen,c); findAndCreateFiller(id,x,y,dir+(HALF_PI+fillerDir),len*0.5,mainLen,c); fillerDir+=(noise(x,y)*0.2-0.1); // 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 ////////////////////////////// void setDarken(int x, int y, color c, float f) { setSmooth(x,y,c,f); } 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); }