The problem is to compute the area of the intersection of two circles of arbitrary radius.
In this post, the trivial cases (no intersection and one circle completely inside the other) are not discussed.
Let A be the center of the circle (x0,y0) of radius r0 and B be the center of the other circle (x1,y1) of radius r1.
We want to calculate the area of the green area in the figure 1.
Figure 1: Area to compute
Let’s add two points at the intersections between the two circles, C and D.
The area can therefore be decomposed in two sub-areas A1 and A2 being the left and the right parts of the intersection.
Figure 2: Sub-areas A1 and A2
The area of each sub-area can be calculated as the difference of the area of the pie and the triangle.
Figure 3: How to calculate one sub-area
First, and .
The area of the pie is proportionnal to the area of the whole circle
and therefore with alpha the angle of the pie you have the following relation:
We have to find the angles now.
so we just have to find BAC.
We know all the lengths of the edges of the triangle ABC and therefore
we can calculate its angles with the cosine rule (https://en.wikipedia.org/wiki/Law_of_cosines).
The length AB can be calculated simply from the coordinates of A and B
Now we juste have to calculate the area of the triangles and we are done.
Since we already have the length of two sides of the triangle and the angle in-between,
we can use that
The demonstration is easy:
Area of a triangle is
and so we finally get the expected result
Figure 4: Area of the triangle DAC
We finally have:
This article is mostly inspeared of the explanation on mathforum.
The figures were done with https://www.geogebra.org