I was expecting to get the degrees from the center of the sketch to the mouse from 0 to 360 or zero to 2PI.
Instead I am getting zero to 180 from horizontal to the belly of the sketch and then I get negative numbers on the top…
This makes it very hard to send angle coordinates to Arduino,
What am I doing wrong?
Thanks
void setup()
{size(640, 840, JAVA2D);
}
void draw() {
background(204);
translate(width/2, height/2);
float a = atan2(mouseY-height/2, mouseX-width/2);
println(degrees (a));
rotate(a);
rect(-30, -5, 60, 10);
}