Hi ,
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)
Thanks @benedict for your repsonse. I want to obtain all those points (Minimum number of points ) used to recreate the curve. Can you please help as in Gh file ?
the geometry i8n your file is not internalized. Also I am not sure to understand what you want to get in the end. the same curve but with less points or the same curve with given points?
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.
In the last case I’ve made another C# script that searches for vertices that can be removed - in this case, 4 - without affecting the shape too much.
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)
My script implements a while loop in which the same list of points gets updated at each iteration. This is impossible to reproduce using standard GH components - which is why I chose to use C#.
If you absolutely need to use components, you’ll need Anemone or Hoopsnake plugins to simulate loops.