# Thread: Finding a point within a circle

1. ## Finding a point within a circle

This is either a total newbie question or then it's a totally difficult question. Anyhow.
I'm working on a gravity-simulation program and I'm right now working on a method to define all points within a circle and it seems that I've struck a dead end. I can't think of anything.
I think that analytic geometry holds the key to this, but I haven't figured it out.
So: I don't necessarily need code. I'll just need a method to discern between points inside and outside of a circle whose function and radius are known.

2. the equation of a circle is x^2 + y^2 = r^2

all points within the circle
x^2 + y^2 <= r^2

all points outside of circle
x^2 + y^2 > r^2

I'm pretty sure that's right.

3. That's only if the circle is located at (0, 0).

More generally, a circle is specified by three variables:

center x-coordinate (xo)
center y-coordinate (yo)

The circle is then defined by the equation:

(x - xo)^2 + (y - yo)^2 = r^2.

If a point (x, y) is inside the circle, therefore, the follwing statement will be true:

(x - xo)^2 + (y - yo)^2 < r^2.

4. good point.

just a simple translation of the points gets it to (0,0).