|
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 |
|
|
Finding 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 difficult 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 have 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 possibilities (the circles can be also tangent)
Fig. 1
|
Fig. 2
|
Fig. 3
|
Fig. 4
|
Fig. 5
|
Fig. 6
|
Fig. 7
|
Fig. 8
|
Fig. 9
|
Fig. 10
|
Fig. 11
|
Fig. 12
|
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,2 | Circles 1,3 | Circles 2,3 | Circles 1,2 | Circles 1,3 | Circles 2,3 | Circles 1,2 | Circles 1,3 | Circles 2,3 |
1 | 0 | 0 | 0 | No | No | No | 0 | 0 | 0 | No | - |
2 | 2 | 0 | 0 | Yes | No | No | 0 | 0 | 0 | No | - |
3 | 2 | 2 | 0 | Yes | Yes | No | 0 | 0 | 0 | No | - |
4 | 0 | 0 | 0 | Yes | Yes | No | 0 | 0 | 0 | No | - |
5 | 2 | 0 | 0 | Yes | Yes | No | 0 | 0 | 0 | No | - |
6 | 0 | 0 | 0 | Yes | Yes | Yes | 0 | 0 | 0 | Yes | 1 |
7 | 2 | 0 | 0 | Yes | Yes | Yes | 2 | 0 | 0 | Yes | 2 |
8 | 2 | 0 | 0 | Yes | Yes | Yes | 0 | 0 | 0 | Yes | 1 |
9 | 2 | 2 | 0 | Yes | Yes | Yes | 2 | 0 | 0 | Yes | 2 |
10 | 2 | 2 | 2 | Yes | Yes | Yes | 2 | 0 | 0 | Yes | 2 |
11 | 2 | 2 | 2 | Yes | Yes | Yes | 1 | 1 | 1 | Yes | 3 |
12 | 2 | 2 | 2 | Yes | Yes | Yes | 2 | 2 | 0 | Yes | 4 |
13 | 2 | 2 | 2 | Yes | Yes | Yes | 0 | 0 | 0 | No | - |
(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 completely 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 these criteria we can verify cases 6 and 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 separate circles is by the formula:
|
r1 + r2 < D |
With these 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 degrees. 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 pair 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 chose 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 subtracting the area of the triangle from the sector area. |
|
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 defining 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 quadrilateral).
|
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 sides a - c and b - d. If the intersection points of both pairs lie outside of circle 1 then the sequence are correct. |
Intersection point between 2 sides a and c is: |
|
And the intersect point of sides b and d is at:
|
|