# How to find the area of circle inside the rectangle?

Consider a circle located at the origin

circ[R_] := Circle[{0,0},R]


and an arbitrary rectangle

rect[x1_,y1_,x2_,y2_] := Rectangle[{x1,y1},{x2,y2}]


These figures somehow intersect each other. Could you please tell me how to calculate the fraction of the circle's area $$\epsilon = S_{\text{intersection}}/\pi R^{2}$$ inside the rectangle, assuming completely arbitrary relative positions (i.e., a circle is inside the rectangle, or the latter is shifted)?

My attempt follows this question:

rectangle = Rectangle[{1, 1}, {2, 2}];
circle = Circle[{0, 0}, 2];
Area[RegionIntersection[rectangle, circle]]


But it gives zero, maybe since RegionIntersection does not compute the 2D region, only a curve of the surface intersections (?).

• rectangle = Rectangle[{1, 1}, {2, 2}]; circle = Disk[{0, 0}, 2]; Area[RegionIntersection[rectangle, circle]]  Mar 10 at 9:17
• use Disk instead of Circle if you want the area. Or use ArcLength instead of Area if you want the length of the length of the arc.
– kglr
Mar 10 at 9:17
• Thanks to both of you! Mar 10 at 9:46

rectangle = Rectangle[{1, 1}, {2, 2}];

use Disk instead of Circle if you want the area. Or use ArcLength instead of Area if you want the length of the arc.