How to find custom point positions on common tangent line of two tangent circles
I have two circles that are tangent to one another and touches one another at exactly one point. The two circles share a common tangent line at the tangent point.
A (x1, y1), A (r1), B (x2, y2), B (r2), and l are known.
Is there an easy geometric way to get (x, y) positions of C
and D
points by changing the given input (length) l
?
The tangency point $T$ is given by
$T = (x_1, y_1) + \dfrac{r_1}{r_1 + r_2} ( (x_2 - x_1, y_2 - y_1) ) $
The normalized vector extending from $(x_1, y_1)$ to $(x_2, y_2)$ is given by
$u = (u_x, u_y) = \dfrac{ ( x_2 - x_1, y_2 - y_1 ) }{ \sqrt{ (x_2 - x_1)^2 + (y_2 - y_1)^2 } }$
The vector orthogonal to that is given by
$v = (- u_y, u_x) $
Now points $C$ and $D$ can be expressed as follows,
$C = T + L v $
and
$D = T - L v $