Intersection of two circlesWritten by Paul BourkeApril 1997
The following note describes how to find the intersection point(s) between two circles on a plane, the following notation is used. The aim is to find the two points P3 = (x3, y3) if they exist. ![]() First calculate the distance d between the center of the circles. d = || P1 - P0 ||. If d > r0 + r1 then there are no solutions, the circles are separate. Also, if d < || r0 - r1 || then there are no solutions because one circle is contained within the other. Considering the two triangles P0P2P3 and P1P2P3 we can write
Using d = a + b we can solve for a,
It can be readily shown that this reduces to r0 when the two circles touch at one point, ie: d = r0 + r1 Solve for h by substituting a into the first equation, h2 = r02 - a2 SoAnd finally, P3 = (x3,y3) in terms of P0 = (x0,y0), P1 = (x1,y1) and P2 = (x2,y2), is y3 = y2 -+ h ( x1 - x0 ) / d Contribution: C source code example by Tim Voght. |