I an really new to processing. Try to create a program that highlights a line when the mouse is moved over it. I downloaded the picking library from here:
http://code.google.com/p/processing-picking-library/
I looked at the demos which show how it works in 3D and I modified the code to 2d circle and it works too. When I changed the circle to a line it doesn't work any more. Any help is appreciated.
Below is the code I modified based on the demo.
------------------------------------
import picking.*;
Picker picker;
void setup() {
size(200, 200);
smooth();
picker = new Picker(this);
stroke(255);
}
void draw() {
background(50);
picker.start(0);
line(0, 0, width, height);
picker.stop();
int id = picker.get(mouseX, mouseY);
switch (id) {
case -1:
stroke(255);
break;
case 0:
stroke(255, 150, 150);
break;
default:
stroke(120);
break;
}
}
2