We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hey all, I am having a bit of a difficult time trying to measure the top/bottom quadrants of an ellipse in correlation to the mouse. So, if mouse positions are on top quadrant, do this, else, do that.
float fishX;
float fishY;
float theta;
float x;
float y;
float radius;
void setup() {
size(640, 360);
noStroke();
x = mouseX;
y = mouseY;
fishX =width/2;
fishY = height/2;
radius = dist(fishX, fishY, x,y);
}
void draw() {
background(255);
x= radius*cos(theta);
y = radius * sin(theta);
if(radius <= 100 && theta > 0 && theta < PI){
println("INSIDE");
background(0,0, 255);
}
else if ( radius > 100 || theta > PI && theta < TWO_PI){
println ("OUTSIDE");
background(0,255,0);
}
fill(255,0,0);
ellipse(fishX, fishY, 30,30);
}
Answers
I think this is what you want ...
Great! This is exactly what I am looking for. thanks!