E-Male
19th July 2005, 09:17
(i know for most programmers here this will sound like a very stupid question)
i'm looking code to find out if a pixel with the coordinates x & y is in a circle with the center coordinates cx & cy and radius r (radius in pixels)
thx in advance for any help
EDIT: would this be right?:
bool incircle = (x - rx)^2 + (y - ry)^2 < r^2
EDIT2:
how would the code look for an ellipse, with x-radius and y-radius?
i'm looking code to find out if a pixel with the coordinates x & y is in a circle with the center coordinates cx & cy and radius r (radius in pixels)
thx in advance for any help
EDIT: would this be right?:
bool incircle = (x - rx)^2 + (y - ry)^2 < r^2
EDIT2:
how would the code look for an ellipse, with x-radius and y-radius?