I need to draw an approximate circle on a grid of squares and find its area. Each square must either be completely part of the circle or not at all occupied. Obviously, this means that it cannot be a perfect circle. Instead, it will look something like the circles in this picture:
The circle is generated by selecting a center point (x,y coordinates in the grid) and a radius and counting any square in the grid as part of the circle if the Euclidean distance between it and the center point is less than that radius. Up until now I've just been checking every cell in the vicinity to see if it meets these criteria, but it seems like there must be a better way if I just need to know how many cells are included (i.e. the area).
Is it possible to come up with a formula for calculating the area of this sort of circle based on the radius, or does the discretization make it too unpredictable?