Wednesday, 16 January 2008


Look at my beautiful cow!! I have cracked some code (Jared Tarbell's 'Box Fitting Image' pictured above) - hooray!!

// Box Fitting Image
// j.tarbell May, 2004
// Albuquerque, New Mexico
// complexification.net

// Processing 0085 Beta syntax update April, 2005
// j.tarbell

int num = 0;
int maxnum = 2000;
int dimx = 510;
int dim = 330;
int dimborder = 10;
int time;

Box[] boxes;

// background image
PImage ab;



// MAIN -----------------------------------------------------------

void setup() {
size(510,330,P3D);
// size(dimx,dim,P3D);
rectMode(CENTER);
frameRate(30);
noStroke();

// create boxes
boxes = new Box[maxnum];

// load background image
ab = loadImage("http://www.ni-photos.jmcwd.com/cow3.jpg");

resetAll();
}

void draw() {
for (int n=0;n
0) {
// reset
selfinit();
if (chaste) {
makeNewBox();
chaste = false;
}
} else {
okToDraw = true;
}
}

int checkPixel(int x, int y) {
if ((x>dimborder) && (x
dimborder) && (y0) {
// a lit pixel has been found
return 1;
} else {
return 0;
}
}
}
return 0;
}
}

// j.tarbell May, 2004




No comments: