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.
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