as an extend to previous post, we suppose the 2 circles are labeled by subscript 1 and 2.

lets suppose we have the touch point on circle 1, say $\vec{r_0}$. thus, the solution of the normal vector of tangent lines are:

$\vec{n}\cdot (\vec{r_2}-\vec{r_0}) = l_\pm$

$(P \cdot \vec{n}) \cdot (\vec{r_2}-\vec{r_0}) = \pm d_2$

$P = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}$

where $P$ is the right rotation matrix. $l_\pm$ is the length between 2 touching points.

$l_\pm = \sqrt{(r_1-r_2)^2+(d_1\pm d_2)^2}$

and the pulse sign for $d2$ is for the center of the circle is on the right hand size.

the assumed touching point on circle can be expressed by $P\cdot n$.

$\vec{r_0} \pm d_1 (P\cdot n) = \vec{r_1}$

sub into the equation,  simplify, we have:

$\vec{n}\cdot (\vec{r_2} - \vec{r_1}) = l_\pm$

$(P\cdot \vec{n}) \cdot (\vec{r_2}-\vec{r_1}) = \pm d_2 \pm (d_1)$

again, plus sign for center of circle on left side.