Intersection of 3 circles calculator
Circles of the form:     (x-a)2 + (y-b)2 = r2
Circle 1: ( x - )2 + ( y - )2 = 2
x2 + y2 + x + y + = 0
Circle 2: ( x - )2 + ( y - )2 = 2
x2 + y2 + x + y + = 0
Circle 3: ( x - )2 + ( y - )2 = 2
x2 + y2 + x + y + = 0
Circles of the form:     x2 + y2 + Ax + By + C = 0
Distance circles centers 1-2
Distance circles centers 1-3
Distance circles centers 2-3
Triangle ABC area
Lapping area

Input Limit:
Circles 1-2 intersection points
Circles 1-3 intersection points
Circles 2-3 intersection points
Lapping segments points
Total intersection points

Findding the lapping area between 3 circles
While finding the intersection points between the three circles are relatively an easy task, finding the lapping area of all 3 circles is a bit more dificullt as the circles can be placed in each of the different arrangement as shown bellow. It is necessary to determine the relative position of the circles because each arrangements has its own method to calculate the lapping area.

Note: the circles can be tangent to each other, in this case only one intersection point exists.
Three circles arrange posibillities (the circles can be also tangent)
Figure - 1
Fig. 1

Figure - 2
Fig. 2

Figure - 3
Fig. 3

Figure - 4
Fig. 4

Figure - 5
Fig. 5

Figure - 6
Fig. 6

Figure - 7
Fig. 7

Figure - 8
Fig. 8

Figure - 9
Fig. 9

Figure - 10
Fig. 10

Figure - 11
Fig. 11

Figure - 12
Fig. 12

Figure - 13
Fig. 13

To write a subroutine to calculate the common area we have first to recognize the relationship between the circles, for this purpose we can use the following table.

Table - 1
Fig Num Number of intersection points Over lapping areas Internal points (1) Overlap areas Number of lapping segments
Circles 1,2Circles 1,3Circles 2,3Circles 1,2Circles 1,3Circles 2,3Circles 1,2Circles 1,3Circles 2,3
1000NoNoNo000No-
2200YesNoNo000No-
3220YesYesNo000No-
4000YesYesNo000No-
5200YesYesNo000No-
6000YesYesYes000Yes1
7200YesYesYes200Yes2
8200YesYesYes000Yes1
9220YesYesYes200Yes2
10222YesYesYes200Yes2
11222YesYesYes111Yes3
12222YesYesYes220Yes4
13222YesYesYes000No-
(1)   Number of intersection points of two circles that lies inside the third circle.

1. A basic check to verify if lapping area exists is to check if at least one intersection point between two circles lies inside the third circle, if this check is positive for any pair of circles (total 3 cases to check) then lapping area exists.
This check is good to verify figs. 7, 9, 10, 11, 12, 13.

The condition of a point (xp, yp) to be inside a circle of radius r and center at (a, b) is:

2. This condition alone is not enough, for example fig. 8 contains common lapping area even though condition 1. is not satisfy. Another condition we have to check is if one circle is completly inside the other circle, this condition is stated by the formula:

| r1 - r2 | > D

(D is the distance between circles centers and is equal to:
With this creteria we can verify cases 6, 8.
3. Another condition that we can check is if any of the circles are not intersecting at all, in this case no lapping area exists, the condition for seperate circles is by the formula:
r1 + r2 < D
With this criteria we can verify cases, 1,2,3,4,5. (see table - 1)
Table - 2 Calculating lapping area
The lapping area of 3 circles can be either one of the following forms.



Calculating
cases:
7, 9, 10
The lapping area contains two circular segments area.
Cord a can be calculated according to the two intersection points (xi1 yi1) and (xi2 yi2).
The area of segment with radius r1 and cord a and angle θ1 is:
In order to find angle θ1 We define:
Note: We used both circles radii in order to calculate the angle θ1 this method enables us
to get angles greater then 180 degree.   See solved example
The same way we find the other segment area:
Total lapping area is: A = Aseg1 + Aseg2



Calculating
case:
11


See note (2)
The lapping area contains the area of three segments and an inner triangle whose sides are the 3 circles segments cords (Circular triangles).
The area of the triangle with sides a, b and c is according to Heron's formula:
Where s is equal to:
The sides a, b and c of the inner triangle can be calculated according to the intersection points between each pairs of the circles for example.
In order to calculate the segment area we can't use formula (2) because we have 2 radii involved in each cord, instead we use the formula:
The combined lapping area is the sum:



Calculating
case:
12


See note (3)
This case is the most complicated shape of lapping area and it contains 4 circular segments and an area of an irregular convex quadrilateral.
The area of an irregular convex quadrilateral whose sides are a, b, c, d and diagonals p and q is by the following formula (we choosed this formula among many others also see note 3).
is the angle between diagonals p and q.
The lengths of the diagonals p and q can be calculated same way as the sides a, b, c and d:
The combined area of the segments is:
Notes
(2)  Formula (4) obtained by subtructing the area of the triangle from the sector area.
Sector area is:
Using the formulas above are not working in all cases for example the set of circles:
The result will be wrong that is because the segment of circle with the radius of 5.5 should be the bigger one and not the small one (in this case the segment area is more then half circle area and the
angle θ1 > 180 degree).
A way to deal with this problem is to add a check that will verify which area should be used, this is done by the following method (see the drawing at the right):
First find the mid point of the segment cord
The equation of the line connecting mid point and circle center is of the form y=mx+n:
Now we have to find the intersection points of this line and the circle, this is done by definning a new constant:
And the circle line intersection points will be:
We define:
Circle 1 equation:
Now we have to find which point of the two points found lies inside the other two circles (circle 2 and 3), this will be done by equation (1) performed on both points (xic1 yic1) and (xic2 yic2).
Once we found the correct point all we have to do is to find if the segment area is the small or the big portion of the circle that will be done by measuring the distance of the point to the mid point and compare it to the radius of the circle. If the distance is less or more then the radius then apply equation (5) as follows; we assumed in the next formula that the correct point is (xic2 yic2).
And finally the correct area of the segment is:

(3)  We can use the following formula which uses the sides and the diagonals lengths only to calculate the
       quadrilateral area.
Note: circle 1 contain all 4 points of the lapping area (see also fig 12 in table 1).
The problem in this case is how we determine the correct sequence of the intersection points (not to get a crossed quadrilteral).
One way to deal with this problem is to calculate inner angles α, β, γ, and δ The sum of the angles should be 360 degree for a convex quadrilateral.
The angles can be calculated according to the cosine law for example for angle α we have:
Second way to deal with this problem is to find the intersection points of sids a - c and b - d. If the intersection points of both pairs lies outside of circle 1 then the sequance are correct.
Intersection point between 2 sides a and c is:
And the intersect point of sides b and d is at: