Reputation: 563
If having a centre(xc,yc) and radius(r), how can i calculate total number of coordinates(x,y) in the circle?
Upvotes: 0
Views: 38
Reputation: 80187
I suspect that you are talking about integer points in the circle. Otherwise question is senseless.
In this case you can apply Gauss formula
N = 1 + 4 * r + 4 * sum[i=1..r]{floor(sqrt(r^2-i^2))}
Note that center has integer coordinates too.
Upvotes: 1