mathgeometry

Area of Intersection between Two Circles


Given two circles:

How do you calculate the area of their intersection? All standard math functions (sin, cos, etc.) are available, of course.


Solution

  • Okay, using the Wolfram link and Misnomer's cue to look at equation 14, I have derived the following Java solution using the variables I listed and the distance between the centers (which can trivially be derived from them):

    double r = radius1;
    double R = radius2;
    double d = distance;
    if(R < r){
        // swap
        r = radius2;
        R = radius1;
    }
    double part1 = r*r*Math.acos((d*d + r*r - R*R)/(2*d*r));
    double part2 = R*R*Math.acos((d*d + R*R - r*r)/(2*d*R));
    double part3 = 0.5*Math.sqrt((-d+r+R)*(d+r-R)*(d-r+R)*(d+r+R));
    
    double intersectionArea = part1 + part2 - part3;