I'm trying to make a function that given 2 paths would draw all the lines that are common tangents of them.
More specifically I was trying to draw the common tangent of 2 ellipses so that it would look like a projected view of a cone or a cylinder. Something like this:
What I've tried: I followed another post here that given a point drew the tangent of a path, With that, I can manually pick a point on the second path that looks like the tangent, but how can I do it automatically and actually correct? I'm not very familiar with the whatever operator or the MetaFont solve macro but I think I could use them as an answer.
The body of the function would have something like this:
pair T,V,X,Y; path P,W;
P:=fullcircle scaled 100; W:=fullcircle scaled 200 shifted (400,100);
T:= point 2.5 of W; %Hand picked point on path W
V:= point 6 of W; %Hand picked point on path W
draw P withpen pencircle scaled 10;
draw W withpen pencircle scaled 10;
vardef f(expr t) = angle direction t of P - angle (T - point t of P) < eps enddef;
X = point solve f (11, 10) of P;
Y = point solve f (9, 14.5) of P;
draw X -- T withpen pencircle scaled 5 withcolor red;
draw Y -- V withpen pencircle scaled 5 withcolor red;
Which led to the result above.
Edit: To make myself more clear, I'm looking for the tangent of a generic curve and not only circles, example:


