1
$\begingroup$

I want to calculate the area displayed in yellow in the following picture:

circle area

The red square has an area of 1. For any given square, I'm looking for the simplest formula to compute the yellow area in this picture.

(Squares are actually pixels in an image processing software, and I need to compute the opacity of the given pixel based on the relative area of the circle compared to the area of the pixel, to create smooth rounded corners.)

Update: I need to be able to do that for any individual square in the image: also the orange and the green one, for example.

  • 1
    I think what you really want is just [an algorithm for drawing an anti-aliased circle](http://stackoverflow.com/questions/485800/algorithm-for-drawing-an-anti-aliased-circle). I don't think Wu's algorithm actually computes exact areas, and I also don't think you need to. Remember, [a pixel is *not* a little square](http://alvyray.com/Memos/CG/Microsoft/6_pixel.pdf).2011-11-18

2 Answers 2