Area of circle bounded by x,y limits

80 Views Asked by At

I need to obtain the area of a disc centered at $(x_0, y_0)$ with radius $r$, that is bounded in $x, y$ by the box defined by the limits:

$$(x_{\min}, x_{\max}), (y_{\min}, y_{\max})$$

This means that the circle can be entirely included within the box (left) or partially (right):

enter image description here

The double integral would need look something like this:

$$ \int_{x_{\min}}^{x_{\max}} \int_{y_{\min}}^{y_{\max}} f(x,y) \, dx \, dy $$

But I don't know what is the form of the $f(x,y)$ function.

PD: I'm coming from this SO question.

1

There are 1 best solutions below

0
On

HINT

Instead of integration, I would consider doing this in a different way. If you draw line segments from the center of the circle to both endpoints of the arc and to the inscribed square corners, you cut the area you want into 3 triangles and a sector.

The areas of triangles can be easily computed by Heron's formula, since you know the vertices and hence you know the lengths of the sides.

The area of the sector only depends on the amount of radians in the forming angle, which you can also compute straight from the coordinates and the center...