Suppose we have a circle with diameter `r˙ whose center is in the center of a cell. I would like to calculate how many cells are inside this circle (even if only a fraction of the cell is inside). How can I do this?
Currently I used other cell's center points and checked if they fall in the diameter zone but obviously this doesn't work for cells where only corners are inside but not the centers.
So for the example below the correct number is 21 (with my current method I get 9).

Suppose the four corners of a cell are P1, P2, P3, P4. Let M1, M2, M3, M4 be the mid-points of the sides of the cell. Then the cell "touches" the circle if (and only if) at least one of the eight points P1, P2, P3, P4, M1, M2, M3, M4 is inside the circle.
The pseudocode would be something like this:
This code is very inefficient -- it's written for clarity, not speed. Many optimizations are possible. For example, you should work with squared distances, to avoid calculating square roots, and you can often avoid testing a cell because you know the test results for some of its neighbours.