Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Area of Intersection between Two Circles

Tags:

math

geometry

Given two circles:

  • C1 at (x1, y1) with radius1
  • C2 at (x2, y2) with radius2

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

like image 809
Chris Redford Avatar asked Nov 22 '10 16:11

Chris Redford


People also ask

What is the intersection between two circles called?

The intersections of two circles determine a line known as the radical line.

How do you find an intersected area?

If d≥r1+r2, the circles intersect at most up to a point (when d=r1+r2) and therefore the intersection area is zero. On the other extreme, if d+r2≤r1, circle C2 is entirely contained within C1 and the intersection area is the area of C2 itself: πr22.


1 Answers

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;
like image 157
Chris Redford Avatar answered Sep 29 '22 12:09

Chris Redford