Optimizing and converting a curve

Hi,

I would like find out if there is a better way to convert an closed curve into segments of arc and straight line.

The way I have attemped is using PolyArc node.

It yields an acceptable result overall.

Except here:

Highly appreciate if anyone can share some insights / thoughts on how it can be done better.
Thank you.

GH with internalized data attached.
Rhino Spline to Revit Arc Question.gh (27.5 KB)

More points? This version uses Discontinuity. The first one, on the left, has ‘L’ input set to ‘analytic’ (838 points). The second one, on the right, has ‘L’ input set to ‘curvature’ (496 points) with long segments that appear to be straight? Maybe the straight sections could be culled, leaving only the curved sections to deal with.


PolyArc_2024Oct23a.gh (30.4 KB)

P.S. Divide and conquer? White segments are curved, blue segments might be straight.


PolyArc_2024Oct23b.gh (29.6 KB)

P.P.S. Yes, I think it’s safe to assume the blue segments are straight lines.


PolyArc_2024Oct23bb.gh (34.3 KB)

If you reduce the minimum length slider (‘Second Number’) to just more than 200, two more blue segments appear (9 instead of 7).

2 Likes

Hi @Joseph_Oster , first of all thank you very much for taking time to look into this question.
I have carefully analysed your scripts and learnt a few things (using Discontinuity node and way to varify straight segments)

Also want to thank you for your contribution to the GH forum! I have learnt from your responses to other questions in the past.