I am representing my 2D space (consider a window), where each pixel is shown as a cell in a 2D array. i.e. a 100x100 window is represented by the array of same dimensions.
You can bypass the need for a conditional check:
for(x=center-radius; x<center+radius; x++) { yspan = radius*sin(acos((center-x)/radius)); for(y=center-yspan; y<center+yspan; y++) { // (x,y) is inside the circle } }
If needed, you can round(yspan).
round(yspan)