Maybe you mean mine, I just found it in the sketchbook of Processing version 0054. It's not online, but here's the code. Warning: this is old code, so you'll need to tweak it a bit before it will run on Processing Beta. Another warning: the code is really weird, I wrote it when I just started programming.
Code:avoidVector[][] vectors = new avoidVector[9][9];
float adjust = 0;
void setup() {
size(200, 200);
background(255);
ellipseMode(CENTER_DIAMETER);
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
vectors[i][j] = new avoidVector(i*20+20, j*20+20, 20);
}
}
}
void loop() {
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
vectors[i][j].update();
}
}
if (keyPressed) {adjust = PI/2;}
if (mousePressed) {adjust = PI;}
if (!mousePressed && !keyPressed) {adjust = 0;}
}
void vector(int x, int y, float dir, float len) {
dir = dir - 2*dir - PI;
float x2 = sin(dir) * len + x;
float y2 = cos(dir) * len + y;
line(x, y, x2, y2);
}
class avoidVector {
int x, y;
float len;
avoidVector(int nx, int ny, float nlen) {
x = nx;
y = ny;
len = nlen;
}
void update() {
stroke(0);
vector(x, y, atan2(mouseY-y, mouseX-x)-PI/2+adjust, len);
fill(255, 0, 0);
noStroke();
ellipse(x, y, 4, 4);
}
}
Koenie