-
Fix line to the tangent of a circle
Hello,
I’ve created an expression the links the radius of a circle to the angle of a line forming a tangent to it. I was originally looking for a way to make the angle of the line dependent upon the radius of the circle, but using my limited trigonometry it seemed easier to drive the radius of the circle by the angle of the line. I’m not bothered which is the driver and which is driven. Anyway, I came up with the following expression, which works with partial success (see end of this post for the expression text).

…but the radius is always dependent on ‘opposite’ side of the right-angled triangle formed by the line (hypoteneuse), and therefore intersects the edge of the circle at larger diameters:

Any suggestions as to how I can tweak this to make the line always touch the edge of the circle, like a tangent should?
Thanks,
Paul
angleOfLine=degrees_to_radians(thisComp.layer("NewLine").transform.rotation);
lengthOfLine=1000;
radius=Math.tan(angleOfLine)*lengthOfLine;
[radius*2,radius*2]


