How to join two 3D lines with a third line that connects to each with tangent arcs? I need help trying to find the equation of a 3rd line that connects two lines that are already defined in 3d space. The third line has to connect to the first two with "fillet"/tangent arcs, both of the same radius. See the picture for clarifications. I do NOT want the first two lines to change in any way. Their start and end points need to stay exactly where they are.
Knowns: Arc radius and all parameters of the two already defined lines...start and end points, start/end tangent.
 
 A: Let $g_i$ $(1\leq i\leq 3)$ be the lines on which the segments $\ell_i$ are lying, and denote by $P_1$, $P_2$ the given endpoints of  $\ell_1$, $\ell_2$.  The line $g_1$ and the unknown line $g_3$ are tangents to some circle (of given radius $R$). They therefore are lying in the plane $\Pi_1$ of this circle, hence intersect in a point $Q_1\in g_1$ outside of the segment $\ell_1$. The distance $r_1:=|P_1Q_1|$ is unknown; it depends on $R$ and the deflection angle $\alpha_1$ at $Q_1$ between $g_1$ and $g_3$. This $\alpha_1$ is the angle of the circular arc to be drawn later. It is easy to see that
$$r_1=R\>\tan{\alpha_1\over2}\ .\tag{1}$$

In the same way we have between $g_2$ and $g_3$ the relation
$$r_2=R\>\tan{\alpha_2\over2}\ .\tag{2}$$
But we have to be aware that each of the angles $\alpha_i$ depends on both $r_i$ in a complicated way, independent of these conditions. 
Therefore you have to do the following: Consider the $r_i$ as variables ("unknowns"), and compute the points $Q_i\in g_i$ $(1\leq i\leq2)$. If ${\bf e}_i$ is the unit vector giving the direction of $g_i$ then $${\bf q}_i={\bf p}_i+ r_i\>{\bf e_i}\qquad(1\leq i\leq 2)\ .$$
Since $g_3=Q_1\vee Q_2$ the direction vector of $g_3$ is
$${\bf e}_3={{\bf q}_2-{\bf q}_1\over|{\bf q}_2-{\bf q}_1|}\ .$$ 
This ${\bf e}_3$ will depend on $r_1$ and $r_2$.  Compute the angles $\alpha_1=\angle({\bf e}_1, {\bf e_3})$, resp., $\tan{\alpha_1\over2}$, using vector algebra on the ${\bf e}_j$. Similarly for $\alpha_2$. Then determine the $r_i$ from the equations $(1)$ and $(2)$. When these equations are satisfied you can properly fill in  two circle arcs of radius $R$ beginning at $P_1$ and at $P_2$.
