Circle-circle intersection

745 Views Asked by At

In this article, two intersection points of three spheres are calculated.

I want to reduce this solution to 2-D. How do I calculate the intersection points between 2 circles?

I've tried to implement the method shown in this link, but it seems I could not do it.

Here's what I did:
$C_0(c_0, R)$
$C_1(c_1, r)$
are two circles.

$d$ is the euclidean distance between $c_0$ and $c_1$.
$p_0(0,0)$ and $p_1(0,d)$ are two points.
$x = \dfrac{d^2 - r^2 - R^2}{2d}$
$y = R^2 - x^2$
$y_0 = \sqrt{y}$
$y_1 = -y_0$
$i_0(x,y0)$ (point)
$i_1(x,y1)$ (point)
$i_0 = i_0 + c_0$
$i_1 = i_1 + c_0$

Which gives me wrong coordinates. Where am I mistaken?

1

There are 1 best solutions below

2
On

Assume, you introduced a frame of reference where $C_0$ is centered at the origin and $C_1$ at the point $(d,0)$. Then equation of both circles should like as follows \begin{align} x^2 + y^2 &= R^2 \\ (x-d)^2 + y^2 &= r^2 \end{align} Obviously, in that frame of reference, intersection points (if there is any) will have the same $x$'s and opposite $y$'s. Let's denote coordinates of the point with positive $y$ as $(X,Y)$, then \begin{align} X^2 + Y^2 &= R^2 \\ (X-d)^2 + Y^2 &= r^2 \end{align} Now, open up second equation $$ X^2 - 2X d + d^2 + Y^2 = r^2 \implies d(2X - d) = r^2 - R^2 \implies X = \frac {d^2 - r^2 + R^2}{2d} $$ So, the only difference is in the sign of $R^2$ in your equation, everything else looks the same. $Y = \sqrt{R^2 - X^2}$.

I put some small matlab script together, to test it, and it seems working.

function test
al = 0:pi/1000:2*pi;
r = 1;
R = 2;
d = 2.5;
x = r*cos(al);
y = r*sin(al);
plot(x,y)
hold on
x = d + R*cos(al);
y = R*sin(al);
plot(x,y)
x = (d^2-R^2+r^2)/(2*d);
y = sqrt(r^2-x^2);
plot(x,y,'o')
set(gca, 'DataAspectRatio', [1,1,1])

circles