//competitive plotter attractor net //by Steed neuron [] n = new neuron [256]; plot one; mouse f1,f2; BImage output; float E = 2.71828182845904523536; void setup(){ size (640,320); background(255); output = loadImage("output.gif"); for (int i=0; i th){ th += PI/10; } if (t < th){ th -= PI/10; } float m = speed; x += cos(th) * m; y += sin(th) * m; stroke(cr,cg,cb); println(cr+" "+cg+" "+cb); point(x,y); } } float normalD (float xx, float sigma, float mu){ return pow(E,-(sq((xx-mu))) / (2 * sq(sigma))) / (sigma*sqrt(TWO_PI)); }//where sigma is the scale of the graph & mu shifts the location of the graph along x boolean overRect(float xo, float yo, float x1, float y1, float x2, float y2){ if (xo >= x1 && xo <= x2 && yo >= y1 && yo <= y2) { return true; } else { return false; } } float fwrap (float fvalu, float flimi){ float fcar=fvalu; if (fcar>flimi){ fcar=(fcar)%flimi; } if (fcar<0){ fcar=flimi-fcar; fcar=(fcar)%flimi; fcar=flimi-fcar; } return fcar; }//fwrap; void cShift(int c){ if (c == 0){ one.cr = shift(one.cr, 10, 15); one.cb = shift(one.cb, 10, 15); one.cg = shift(one.cg, 10, 15); } if (c == 1){ one.cr = shift(one.cr, 200, 15); one.cb = shift(one.cb, 10, 10); one.cg = shift(one.cg, 10, 5); } if (c == 2){ one.cr = shift(one.cr, 200, 15); one.cb = shift(one.cb, 200, 10); one.cg = shift(one.cg, 200, 5); } } float shift (float a, float b, float v){ float r = 0.0; if (a >= b){ r = a - v; } if (a < b){ r = a + v; } return r; }