Nurbs curve with minimal control points

I want to create Nurbs curves which approximate a periodic planar curve well, while having a degree of 2 and as few control points as possible. What i have done so far is determine where the inflection points on the original curve are, and then set the minimal Nurbs control points to 2*inflection_points. from there, I manually adjust each control point so that the Nurbs curve approximates the original curve well, as shown below:

The black curve is the original planar curve which is baked into the Rhino environment. The red curve is a Nurbs curve with 8 manually moved control points, this process took half an hour.

Contrarily, this is what it looks like to use the Rebuild Curve function with degree set to two and 8 control points:

You can see that this is a significantly worse result. But I do not want to spend 30 minutes on every curve optimizing the control points. Any idea how to do this?

Below is the necessary files to play with.|attachment (14.6 KB) FitReducedNurbs.3dm (3.8 MB) (14.6 KB)

I had a go just connecting your variables to goat and optimising to minimise squared distance from a few sampled points to the original curve: (22.6 KB)
Seems to work pretty well (I just used the default solver options).

1 Like

I use grasshopper and rhino for mac, is there a way to get goat on a mac?

@maje90 would be nice to see how your approach performs. plans to release it as a plug-in?

I’d really like to.
But my knowledge about c# constantly goes up and down (i forget everything in some day… i got problems) … the VB part + finalizing the script would take some 3/4 days for me… by doing nothing else.
So… or i start and finish that in that same week, or i have to start again in future.
I haven’t found a quiet week to put it down since that post of mine, sadly…

1 Like

The solution is rather simple:


I’d like to laugh about it too… :upside_down_face: