How to locate every X-Y pair inside of a circle?

AndyPI

New member
Joined
Jun 15, 2014
Messages
6
Hello,
I was wondering how I could find every X-Y pair that is an integer inside of a circle?

For instance:

If you have a circle with a radius of 15, centered around the origin,
How could you find every X-Y pair that is an integer contained in that circle?

I do know of course the basic area of a circle formula:

A = pi * r2

But I don't know how this could relate?
I also know that I could graph the circle and manually find every coordinate, but I thought that there must be an easier way.
Thanks for any help! :)
 
Hello,
I was wondering how I could find every X-Y pair that is an integer inside of a circle?

For instance:

If you have a circle with a radius of 15, centered around the origin,
How could you find every X-Y pair that is an integer contained in that circle?

I do know of course the basic area of a circle formula:

A = pi * r2

But I don't know how this could relate?
I also know that I could graph the circle and manually find every coordinate, but I thought that there must be an easier way.
Thanks for any help! :)

Is it

contained in the circle, OR

On the boundary of the circle?
 
Is this to find each individual X-Y pair?
If so, how would would I use it?
(and how many are there?)
Oh wait, I think I just figure it out!
In order to find every X-Y pair inside and on the edge of the circle, would it be:
X2+Y2<=152
?
 
Keep it simple by working with the quarter-circle in the top right quadrant.
Multiply results by 4.

I assume you're after the number of points, not also the actual coordinates.
If you need to list the cordinates, then again stick to top right quadrant:
like (2,3) means other 3 points are (-3,2), (-3,-2) and (3,-2); get my drift?

That's all you get from me...watching the basketball game :cool:

Ok, that makes sense...
I was after the actual coordinates though, so will this work for that:
X2+Y2<=152
??:confused:

Thanks! :)
 
You can do this also graphically.

All the points within the square whose vertices (0,0), (0,10), (10,0) & (10,10) will be inside the circle.

Now expand it with rectangles - e.g. whose vertices (0,0), (0,11), (10,0) & (10,11) etc.

By the way 122 + 92 = 152
 
I'm not sure. Sticking to top right quadrant, you'd need a looper program.
r = radius of circle.

Loop x from 1 to r
Loop y from 1 to r
If x^2 + y^2 =< r^2 THEN PRINT x,y; -x,y; -x,-y; x,-y

Make a square (15 by 15) around the quarter circle:
above program would examine every integer coordinates inside that square.
Program can be refined to jump out of y loop each time x^2 + y^2 > r^2
Thanks!
That was exactly what I needed!
however, I use javascript, but I can do exactly the same thing...
Thnks again! :)
 
Top