Take the 2-minute tour ×

As I am using Unity, I can easily grab a square of pixels of any length. However, I want to find the largest circle possible within that square of pixels.

So for instance, if I had a 40 x 40 square of pixels, how would I get an array of pixels that form a circle inside of the square?

share|improve this question
Are you just interested in the case of a square? So your question could be simplified to: "How can I draw a rasterized circle?". Or am I missing something here? –  bummzack Apr 18 '11 at 15:40

1 Answer 1

up vote 1 down vote accepted

On a 40×40 square of pixels, you can draw a circle with approximately 40×sqrt(8) pixels.

If you are looking for a circle drawing algorithm to let you pick the pixels to put in your array, an easy way is to draw an eighth of the circle, for instance using the midpoint algorithm, then mirror it three times.

share|improve this answer

Your Answer


