How to calculate maximum fillet radius between two lines?

I’m writing a Grasshopper component that fillets lines with Curve.CreateFilletCurves. Sometimes it fails because the fillet radius is too big. Is there an easy way to calculate the maximum fillet radius between two lines that are not necessarily at right angles to each other? If one of the lines is trimmed to zero length, is that considered an invalid fillet with the above method?

If they are co-planar lines, then there’s some trig that will give you the answer (not necessarily easy, but at least analytic), if it involves curves, then all bets are off.

So this file contains a script which computes the fillet circle with the maximum possible radius given three input points (A, B, C) with B being the corner which is filleted. It’s not the cleanest, technically you can figure out right at the start which of the two segments (AB) or (BC) is the relevant one depending on whether A or C is closer to B.

maxfillet.gh (6.0 KB)

2 Likes

Thanks for that @DavidRutten.