How would I best test if a selected point is inside a circle, I have the following three (semi-hackish) ideas:

1) Very bad: Draw circle onto a surface which is painted color A, fill with color B, plot point in color C. Go through entire bitmap looking for C's location, etc.

2) Alright: Decrease radius of circle in for loop and test if point lies on circle.

3) find all points of circle and draw lines to them from center point (is this realistic)

I have code for #2 here, but it doesn't seem to work.

PHP Code:

```
bool cSChicken::inRadius(int bx, int by)
```

{

int r = radius;

for(r=radius; r >= 0; r--) //shrink circle down to a single point one point at a time

if( pow(bx-cx,2) + pow(by-cy,2) == pow(r,2) ) //if point lies on circle

return true;

return false;

}

cx and cy are the center coords of the circle, radius is (duh) the predefined radius of the circle.

What else could I do? What is wrong with the code I wrote for #2? Has anyone ever had to do this for something they were writing?