float polygon::intersect_circles | ( | const float | d, | |
const float | r1, | |||
const float | r2 | |||
) |
calculate the intersecting AREA of two circles of radii r1 and r2 at distance d.
Let the centers of the circles be denoted by A and B, and the intersecting points by C and D. First, we calculate the angles CAD=2(CAB) and CBD=2(CBA). Then we find the segment of each of the circles cut off by CD, by taking the area of the sector of the circle BCD and subtracting the area of triangle BCD. Similarly we find the area of the sector ACD and subtract the area of triangle ACD.
See also http://mathforum.org/library/drmath/view/54785.html.