[Math] Finding a circle that touch two other circles and a line

circlesgeometric-constructiongeometry

Given two circles $(x_1, y_1, r_1), (x_2, y_2, r_2)$ and a line passing through two points $A(x_a, y_a)$ and $B(x_b, y_b)$. How to find a circle $(x_3, y_3, r_3)$ that is tangent to line and two given circles?

I need an algebraic equations not geometric construction.

Best Answer

Let's say $\epsilon$ is the line defined by A and B and $K_1,K_2$ and $K_3$ the centers of the given circles.

Then we have the following 3 equations that will help us define $x_3,y_3,r_3$

$1$. $\sqrt{(x_3-x_2)^2+(y_3-y_2)^2}=r_3+r_2$ or $\sqrt{(x_3-x_2)^2+(y_3-y_2)^2}=|r_3-r_2|$

That is, the distance of the centers $K_2,K_3$ equals the sum of the radius $r_3,r_2$ if the circles are tangent outwardly or the $|r_3-r_2|$ if they're tangent inwardly.

$2$. $\sqrt{(x_3-x_1)^2+(y_3-y_1)^2}=r_3+r_1$ or $\sqrt{(x_3-x_1)^2+(y_3-y_1)^2}=|r_3-r_1|$

$3$. The distance of the $K_3$ from $\epsilon$ equals $r_3$ if you write $\epsilon :Ax+By+C=0$ then $r_3=\frac{|Ax_3+By_3+c|}{\sqrt{A^2+B^2}}$

Related Question