An artistic watercolor visualization by J. Tarbell.
// Substrate Watercolor // j.tarbell June, 2004 // Albuquerque, New Mexico // complexification.net // Processing 0085 Beta syntax update // j.tarbell April, 2005 int dimx = 250; int dimy = 250; int num = 0; int maxnum = 100; // grid of cracks int[] cgrid; Crack[] cracks; // color parameters int maxpal = 512; int numpal = 0; color[] goodcolor = new color[maxpal]; // sand painters SandPainter[] sands; // MAIN METHODS --------------------------------------------- void setup() { size(250,250,P3D); background(255); takecolor("pollockShimmering.gif"); cgrid = new int[dimx*dimy]; cracks = new Crack[maxnum]; begin(); } void draw() { // crack all cracks for (int n=0;n1000)) { px = int(random(dimx)); py = int(random(dimy)); if (cgrid[py*dimx+px]<10000) { found=true; } } if (found) { // start crack int a = cgrid[py*dimx+px]; if (random(100)<50) { a-=90+int(random(-2,2.1)); } else { a+=90+int(random(-2,2.1)); } startCrack(px,py,a); } else { //println("timeout: "+timeout); } } void startCrack(int X, int Y, int T) { x=X; y=Y; t=T;//%360; x+=0.61*cos(t*PI/180); y+=0.61*sin(t*PI/180); } void move() { // continue cracking x+=0.42*cos(t*PI/180); y+=0.42*sin(t*PI/180); // bound check float z = 0.33; int cx = int(x+random(-z,z)); // add fuzz int cy = int(y+random(-z,z)); // draw sand painter regionColor(); // draw black crack stroke(0,85); point(x+random(-z,z),y+random(-z,z)); if ((cx>=0) && (cx =0) && (cy 10000) || (abs(cgrid[cy*dimx+cx]-t)<5)) { // continue cracking cgrid[cy*dimx+cx]=int(t); } else if (abs(cgrid[cy*dimx+cx]-t)>2) { // crack encountered (not self), stop cracking findStart(); //makeCrack(); } } else { // out of bounds, stop cracking findStart(); //makeCrack(); } } void regionColor() { // start checking one step away float rx=x; float ry=y; boolean openspace=true; // find extents of open space while (openspace) { // move perpendicular to crack rx+=0.81*sin(t*PI/180); ry-=0.81*cos(t*PI/180); int cx = int(rx); int cy = int(ry); if ((cx>=0) && (cx =0) && (cy 10000) { // space is open } else { openspace=false; } } else { openspace=false; } } // draw sand painter sp.render(rx,ry,x,y); } } class SandPainter { color c; float g; SandPainter() { c = somecolor(); g = random(0.01,0.1); } void render(float x, float y, float ox, float oy) { // modulate gain g+=random(-0.050,0.050); float maxg = 1.0; if (g<0) g=0; if (g>maxg) g=maxg; // calculate grains by distance //int grains = int(sqrt((ox-x)*(ox-x)+(oy-y)*(oy-y))); int grains = 64; // lay down grains of sand (transparent pixels) float w = g/(grains-1); for (int i=0;i