I am trying to recreate the exact same curve using minimum or least number of points. I have given a shot but I see I am loosing the geometry as shown in fugure. I am trying to get rid of undesired points using concept of curvature.
How can I recreate the entire curve with min points without loosing the geometry ? query1.3dm (36.6 KB) Query1.gh (13.8 KB)
Referring to gh file I have attached I am deleting off the points in red i.e whenever a segment of curve approches a straight line I am deleting off those points. But on doing so I am loosing a bit of originality of the curve.
Just looking at this, your initial curve has 36 control points which, given the amount of twists and turns is rather a good number. Some control points may seem superflous, but they are necessary to constraint the curve in neighbouring sections.
The rebuild operation leads to a 62 points polyline, so better keep the original ?
Do you want to approximate your curve by a polyline ? A PolyArc ? Or keep a NURBS curve ?
In the first case I’ve made a C# script that removes the “best” vertex each time until a target count is reached.
Since your goal seems to be to fit a polyline into a three degree curve, you should know that there is no optimal solution. You can always just do an approximation of sorts and lose some definition/curvature here and there. Less fidelity translates to fewer sample points.
Like @magicteddy, I have a couple of curve resampling scripts, but it would be good to first know what you’re end goal is?
Similar to @magicteddy’s script, I get an acceptable result in terms of fidelity at around 70 to 80 points, depending on which method I use.
Hey @magicteddy first scipt is exactly what I wanted. As your name says its truly magic ! I really appreciate your help. However I was trying to convert the C script into grasshopper as I am unfamiliar with coding. Althogh I have understood the logic.
I was womdering If you can help me to do it in grasshopper. I have given it a shot though.
It would be really helpful if you can help me. tedopt.gh (16.7 KB)