Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define the intersection of three circles?

Given three circles with their center point and radius, how can you define the area of intersection?

So far what I have is:

var point1 = {x: -3, y: 0};
var point2 = {x: 3, y: 0};
var point3 = {x: 0, y: -3};

var r1 = 5;
var r2 = 5;
var r3 = 5;

var area = returnIntersectionArea(point1, point2, point3, r1, r2, r3);

Also, if two collide but not the third, the function should return null. If none collide, null should be returned.

like image 997
nagymafla Avatar asked Oct 17 '25 15:10

nagymafla


1 Answers

This article describes how to find the area of the intersection between two circles. The result it easily extended to three circles.

-------------EDIT------------- OK, the problem is not easily extended to three circles, I found PhD theses on the subject. Assuming the three circles intersect as shown below, an approximate solution can be found (I think). Before we attempt it, we must check if the three circles indeed intersect as shown below. The problem changes quite a bit if say one circle is inside the other and the third intersects them both.

three circles.

Let S1,S2 and S3 denote the areas of the three circles, and X1,X2 and X3 denote the area of the intersections between each pair of circles (index increases in clockwise direction). As we already established, there are exact formulae for these. Consider the following system of linear equations:

A+D+F+G = A+D+X1 = S1

B+D+E+G = B+D+ X3 = S2

B+E+D+G = B+E+X2 = S3

It is underdetermined, but an approximate solution can be found using least squares. I haven't tried it numerically but will get back to you as soon as I do :D If the least-squares solution seems wrong, we should also impose several constraints, e.g. the area if the intersection between any pair of circles is smaller than the area of the circles. Comments are appreciated.

PS +1 to Simon for pointing out I shouldn't qualify things as easy

like image 168
mbatchkarov Avatar answered Oct 22 '25 01:10

mbatchkarov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!