Calculating the intersection points of two circles, of which the centers are located on the x axis.

69 Views Asked by At

I'm trying to solve the problem mentioned in the title, and the answer detailed here provides exactly what I was looking for: https://stackoverflow.com/a/3349134/4777480...except for the fact that the author skips several steps, leaving me confused as to how he ended up with the results he obtained!

For starters, there's this line:

a = (r02 - r12 + d2 ) / (2 d)

Thankfully, a reply to the answer does clarify this one and I did verify it using the steps they detailed.

But leaves me with the last two steps...

How did we end up with this result?

P2 = P0 + a ( P1 - P0 ) / d

And how did that give us the intersection coordinates? (I think in the first line it should be 'a' instead of 'h' but I'm not sure, can someone clarify?)

x3 = x2 +- h ( y1 - y0 ) / d

y3 = y2 -+ h ( x1 - x0 ) / d

A step-by-step explanation would be greatly appreciated, I want to understand the full process so I can implement it correctly in my code.

2

There are 2 best solutions below

0
On BEST ANSWER

So I tried verifying the formula Yves posted and I'm not sure if I made a mistake or if it's incorrect...

But, I managed to find a decent & simple answer from this page: https://planetcalc.com/8098/

enter image description here

Essentially, we have:

$$$$ $$ a=(r_1^2-r_2^2+d^2)/2d$$

and:

$$h=√(r_1^2-a^2)$$

Therefore:

$$x_4=a+x_1$$

$$y_4=h$$

The coordinates for the second intersection point would simply be:

$$(a+x_1,-h)$$

3
On

Let the centers be $(x_0,0)$ and $(x_1,0)$, and the radii $r_0,r_1$.

We need the solutions of the system

$$\begin{cases}(x-x_0)^2+y^2=r_0^2,\\(x-x_1)^2+y^2=r_1^2.\end{cases}$$

By subtraction,

$$(2x-x_1-x_0)(x_0-x_1)=r_1^2-r_0^2$$

and

$$2x=x_1+x_0-\frac{r_1^2-r_0^2}{x_1-x_0}.$$ $y$ follows.