Longest Line Inside a Closed Curve

I have a use case similar to the above topics, but a little simpler I think in some ways. I tried to have a turn at it, getting close, but maybe I’m missing some extra helpful logic for it.

What I’m trying to do is create the longest line inside of a closed curve, i.e. furthest distance that can be made between two points on a single closed curve. My definition nearly works, but it doesn’t give me a single solution - depending on how the object is initially rotated, it calculates a slightly different line and longest length.

CurveFurthestPoints_internalised.gh (22.0 KB)

The problem in your solution is that you are rotating around bounding box center… and you do it two times. That’s why it “wiggle”…

Similar to bounding box is the component Extremes.

We can obtain some fast raw data about the shape with Extremes, then draw a graph about the on-going max distance (where an axis is the rotation angle of the evaluation and the other axis is the found extremes distance), and then find the extreme of that graph to retrieve the best angle:

CurveFurthestPoints_internalised_V2.gh (12.7 KB)

Beware this solution does not consider if the found line internally intersect with the shape… but if you are working with shoe soles/shapes it shouldn’t be a problem…

Hope it helps!


That’s a really interesting solution! I did wonder what that interpolated curve was doing there at first. I suppose some ‘sampling’ was always going to get a cleaner solution

Yeah I just tested my solution again, and the parameter of the CCP-1 changes slightly at the different rotations. I guess this could be affected by curvature or something like that, and my arbitrary diagonal line from the bounding box wasn’t helping too much basically.