Given a circle and a total length 'L', calculate point where 2 tangent lines curve

This gif shows what I want to achieve, except the fact that 1 input and output are switched.

Instead of giving the point where the tangent lines converge/end (Y value slider) and receiving the total curvelength from Grasshopper.

I’d like to be able to input the total length and receive the point.
Does anyone have any ideas?

I can achieve by making use of Galapagos and it’s accurate enough for my application but I’d rather have a real time solution instead of letting Galapagos solve for a minute.

Middelbare school wiskunde. Weet je nog? :slight_smile:

The distance d from the circle centre to the intersection point p is the long edge of a right triangle. The circle radius r and the tangent line t connecting the circle with the intersection point are the right sides of that same triangle.

Thus (given Pythagoras) p^2 = r^2 + t^2 and p = \sqrt{r^2 + t^2}.

pythagoras.gh (9.4 KB)

Thank you for the quick answer, this is what I previously had.
But it’s only part of of what I search. Maybe I didn’t explain it clearly.

I want to be able to have the total length as input.
i.e. the length of (2) tangents, like you provided + the length of arc around the circle between 2 tangents.

Yeah that’s a lot harder. Haven’t gotten to an analytic solution yet, maybe my approach is flawed.

I assumed a unit circle (so we just scale up our answer by the actual radius) and a total length L for the part of the circle s and the two tangent line lengths t, giving us L = s + 2t.

The angle \alpha is defined as the angle between the horizontal axis and the line connecting the centre of the circle to the tangent point on the circle. Since we’re working with a unit circle, this angle is tan(\alpha) = t, \alpha = tan^{-1}(t).

Furthermore s is merely the part of the circle not covered by 2\alpha. This leads us to the compound expression L = (\pi - \alpha) + 2tan(\alpha), but I haven’t been able to solve for \alpha.

I have the feeling I’m missing some easy solution.

Here’s a dirty approximate solution. Instead of rewriting the equation L = 2 \left(\sqrt{p^2-1} - cos^{-1}\left(\frac{1}{p} \right) + \pi \right) so that p is expressed in terms of L, I just graphed a portion of the graph and intersected it with a horizontal line at the L elevation. This could be solved much more accurately by a small loop in a C# component though.

approximatesolution.gh (20.5 KB)

This is amazing and definitely accurate enough for me.
Could you explain how you got to this formula from the one in the previous comment?

I tried adapting it to accomodate for a variable radius, but the lengths keep diverging if I change the radius with this formule.
L = 2 \left(\sqrt{p^2-Radius^2} - Radius*cos^{-1}\left(\frac{1}{p} \right) + \pi*{Radius} \right)

Nevermind, I figured it out. The formula with Radius should be correct now.

1 Like