Re: help circle-circle intersection area
- From: ellieandrogerxyzzy@xxxxxxxxxxxxxxxxxxxxxx (Roger Stafford)
- Date: Fri, 07 Apr 2006 18:52:11 GMT
In article <ef30267.-1@xxxxxxxxxxxxxxxx>, "Canne Olivier"
<olivier.canne@xxxxxxxxxxx> wrote:
Does somebody know how can i compute de area of a circle circle---------------------
intersection?
The radius of one circle must variate. I did a programmation but that
gives me complex numbers...
Thanks
oli
Let the center and radius of one circle be (x1,y1) and r1, and let
(x2,y2) and r2 be the center and radius for the other circle. Then do:
d = sqrt((x2-x1)^2+(y2-y1)^2); % Distance between centers
s = (r1+r2+d)/2; % Half the sum of the sides of the triangle
ta = sqrt(s*(s-r1)*(s-r2)*(s-d)); % Triangle's area
a1 = acos((d^2+r1^2-r2^2)/(2*d*r1)); % Angle at first center
a2 = acos((d^2+r2^2-r1^2)/(2*d*r2)); % Angle at second center
area = r1^2*a1+r2^2*a2-2*ta; % Area of intersection
The triangle referred to here is that defined by the two centers and one
of the points of circle intersection. Half the intersection area will be
the sum of the two circular arc sector areas in the triangle minus the
triangle's area.
As long as you ensure that the distance between the centers is less than
the sum of the two radii and greater than the absolute value of their
difference, the quantity, 'area', should remain a real number. Otherwise,
there is no intersection.
PS - I see Jos has found a website for you. However, since I've already
got this written up, I'll send it anyway and you can compare the two.
(Remove "xyzzy" and ".invalid" to send me email.)
Roger Stafford
.
- Follow-Ups:
- Re: help circle-circle intersection area
- From: Roger Stafford
- Re: help circle-circle intersection area
- References:
- help circle-circle intersection area
- From: Canne Olivier
- help circle-circle intersection area
- Prev by Date: Insurance Refusual for Nexium
- Next by Date: Obfuscating code
- Previous by thread: Re: help circle-circle intersection area
- Next by thread: Re: help circle-circle intersection area
- Index(es):
Relevant Pages
|