Possible Duplicate:
How can I make Turtle recognize a circle?
I have a function that draws a few circles and I am going to place dots inside them. Depending if the dot falls within the circle, depends on wether the colour will change or not.
The biggest issue I am finding is how to check whether or not the dot is within the circle. Does anyone have any idea how to calculate coordinates within a circle or is their a method which can check coordinates against the circle?
For a circle with center (x,y)
and radius r
, a point (x1, y1)
is within the circle if
(x1-x)² + (y1-y)² <= r²