We want an internal tangent to two circles
from T_{1} to T_{2}, as shown in the opposite image.
Circle 1: M_{1} = <x_{1},y_{1},0>, r_{1}.
Circle 2: M_{2} = <x_{2},y_{2},0>, r_{2}. 
An internal tangent is parallel to a tangent from the center of the smaller circle (here: M_{2})
to a other circle around the center of the bigger circle (M_{1}) but with the radius r_{1}+r_{2}.

For the calulation of the point S we have to calculate the sides of the triangle (M_{2},M_{1},S).
d(M_{1},S) = r_{1}+r_{2} .
According the Pythagorean Theorem we can calculate:
d(M_{1},M_{2}) = sqrt((x_{2}x_{1})^{2}+(y_{2}y_{2})^{2}) .
So the third side (again with the Pythagorean Theorem):
d(M_{2},S) = sqrt( d(M_{1},S)^{2}+d(M_{1},M_{1})^{2})
The angle between the direction of (M_{1},M_{2}) and the xdirection we can find
with trigonometric functions.
If x_{1} < x_{2} we have
α = abs(degrees( atan ((y_{2}y_{1})/(x_{2}x_{1}))).
else:
α = 180°  abs(degrees( atan ((y_{2}y_{1})/(x_{2}x_{1}))),
Then we can calulate β and γ as follows:
β = abs( degrees( asin( d(M_{1}, S ) / d(M_{1},M_{2}) ) )) .
γ = α  β .
The position of T_{1}:
x_{T1} = x_{1}  r_{1}·cos( Angle(M_{1}S) ).
y_{T1} = y_{1}  r_{1}· sin( Angle(M_{1}S) ).
The position of T_{2}:
x_{T2} = x_{2} + r_{1}·cos( Angle(M_{1}S) ).
y_{T2} = y_{2} + r_{1}· sin( Angle(M_{1}S) ).


Internal tangent of two circles rendered with POVRay
Note: To avoid any collision with builtin identifiers and reserved words in POVRay,
it's strongly recommanded to use only words beginning with capital letters for all identifiers of variables declared by the user,
i.e. use "R1" instead of "r_{1}"
and use "Y2" instead of "y_{M2}".
#local X1= 0.40; #local Y1= 0.80; #local R1= 0.20;
#local X2= 0.64; #local Y2= 0.15; #local R2= 0.15;
#local M1 = <X1,Y1,0>; #local M2 = <X2,Y2,0>
//
#local M_Dist = sqrt(pow(X2X1,2)+pow(Y2Y1,2));
#if ( X1 < X2) #local Alpha =
abs( degrees( atan((Y2Y1)/(X2X1))));
#else #local Alpha =
180abs(degrees(atan((Y2Y1)/(X2X1))));
#end
#local Beta = abs(degrees(asin((R1+R2)/M_Dist)));
#local Gamma = Alpha  Beta;
#local T1 = M1<(R1)*cos( radians(Gamma)),
(R1)*sin( radians(Gamma)),0>;
#local T2 = M2+<(R2)*cos( radians(Gamma)),
(R2)*sin( radians(Gamma)),0>; 
The calulation of the tangent from T_{1} to T_{2} in POVRay
