// // name: strange_attractors.pde // // desc: renders an assortment of strange attractors // // info: bugs, blame and beratement -> <- // // => www.kiddphunk.com/experiments/ // // remember: andre the giant has a posse. // // todo: * nap // /////////////////////////////////////////////////////////////////////////////// int dim = 300; // screen dimensions (square window) int ndim = dim; int bailout = 200; // number of iterations before bail int plots = 500; // number of plots to execute per frame (x30 = plots per second) int time = 0; int num_strangers = 225; int num_to_a_side = 1; // int(random(2,5)); // 10 int offset = int(dim/num_to_a_side); Stranger strangers[] = new Stranger[num_strangers]; /////////////////////////////////////////////////////////////////////////////// void setup() { size(dim, dim); background(0); framerate(30); createStrangers(); } void loop() { time++; boolean kp = keyPressed; for (int n=0; n xxmin & yy < yymax && yy > yymin) { int xxx = int((xx-xxmin)*xinc); int yyy = int((yy-yymin)*yinc); int ix = xxx = int(floor((xx+2)*(dim-16)/4+8)); int iy = yyy = int(floor((-yy+2)*(dim-16)/4+8)); if (this.exposureR[ix*this.dim+iy]+10 < 255) { switch (choiceR) { case 1: this.exposureR[ix*this.dim+iy]=int(ceil(this.exposureR[ix*this.dim+iy]+2*abs(yy-y))); break; case 2: this.exposureR[ix*this.dim+iy]=int(ceil(this.exposureR[ix*this.dim+iy]+2*abs(xx-x))); break; case 3: default: this.exposureR[ix*this.dim+iy]++; } } if (this.exposureG[ix*this.dim+iy]+10 < 255) { switch (choiceG) { case 1: this.exposureG[ix*this.dim+iy]=int(ceil(this.exposureG[ix*this.dim+iy]+2*abs(yy-y))); break; case 2: this.exposureG[ix*this.dim+iy]=int(ceil(this.exposureG[ix*this.dim+iy]+2*abs(xx-x))); break; case 3: default: this.exposureG[ix*this.dim+iy]++; } } if (this.exposureB[ix*this.dim+iy]+10 < 255) { switch (choiceB) { case 1: this.exposureB[ix*this.dim+iy]++; break; case 2: this.exposureB[ix*this.dim+iy]=int(ceil(this.exposureB[ix*this.dim+iy]+2*abs(xx-x))); break; case 3: default: this.exposureB[ix*this.dim+iy]=int(ceil(this.exposureB[ix*this.dim+iy]+2*abs(xx-x))); break; } } x = xx; y = yy; z = zz; return xxx+" "+yyy; } return null; } void setOffset(int x, int y) { offx = x; offy = y; } } int countMaxExposures(Stranger s) { int count = 0; for (int i=0;i= 230 && s.exposureG[i*s.dim+j] >= 230 && s.exposureB[i*s.dim+j] >= 230) { count++; } } } return count; } boolean finishedExposure(Stranger s) { return (((float)countMaxExposures(s)/(s.dim*s.dim)) > .012); //.015 } void renderBrot(Stranger s) { // draw to screen for (int i=0;i