Interpolated curve

Hi all,
Could you please explain a little more why interpolated curve adds 2 extra points and how those two points are created?
I think these two points are generated based on two calculated derivatives at the start and the end.
I got a very similar result of those two points calculating the control points of a cubic bezier using the first and the last pare of points.
I compared the curve’s point with the result that I have following the GLOBAL CURVE INTERPOLATION TO POINT DATA explained into the Nurbs book, and it is quite similar, but those two points create a curve that is more smooth.

Hi @bianchini,

Are you using Rhino3dm or just RhinoCommon? If Rhino3dm, which one? (e.g. .NET, Python, JS?).

– Dale

Hi @dale,
I am using RhinoCommon, because if I remember correctly if I use .NET Rhino3dm interpolated curve is supported via rhino compute, isn’t it?

Hi @bianchini,

I assume you are using Curve.CreateInterpolatedCurve, which is available in Rhino with RhinoCommon and with Rhino.Compute.

Can you provide the curve you have questions about and the code you used to generate it?

– Dale

Hi @dale,
yes exactly.
here the code.

  Point3d[] points = new Point3d[]{
  new Point3d(0, 0, 0),
  new Point3d(3, 4, 0),
  new Point3d(-1, 4, 0),
  new Point3d(-4, 0, 0),
  new Point3d(-4, -3, 0)

A = Curve.CreateInterpolatedCurve(points, 3, CurveKnotStyle.Chord);

and the result points are:

{0, 0, 0} {1.278803, 1.06885, 0} {5.265114, 4.792727, 0} {-2.182465, 4.50471, 0} {-4.175262, 0.712181, 0} {-4.204863, -2.021209, 0} {-4, -3, 0}

so the points {1.278803, 1.06885, 0}, {-4.204863, -2.021209, 0} are added.
As I said, I got a very similar result of these two points calculating the control points of a cubic bezier using the first and the last pare of points.

here the set of points defined solving the input points for a bezier interpolations.
{0, 0, 0} this one {1.630952, 1.589286, 0} {3.261905,3.178571,0} {3, 4, 0}

{3, 4, 0} {2.738095, 4.821429, 0} {0.583333,4.875,0} {-1, 4, 0}

{-1, 4, 0} {-2.583333, 3.125, 0} {-3.595238,1.321429,0} {-4, 0, 0}

{-4, 0, 0} {-4.404762, -1.321429, 0} this one {-4.202381, -2.160714, 0} {-4, -3, 0}

this is the result I have following the Nurbs book, where there aren’t any added points.
{0,0,0} {7.316964,3.686778,0} {-2.958131,6.678277,0} {-4.494953,-0.673692,0} {-4,-3,0}

Hi @bianchini,

I assume you are looking at this?

Rhino’s InterpCrv command and Curve.CreateInterpolatedCurve method create a cubic C2 NURBS curve that interpolates a given list of points.

All of these type algorithms, and there many, set up a system of equations and solve it in whatever the developer deems most efficient. The NURBS Book algorithm is probably the basic Greville interpolation where the parameter values for the points are set to the Greville abscissae for whatever knot vector is chosen - probably uniform. This has the advantage of making a nicely structured matrix for inverting: 5 points each give 5 equations for the 5 CVs.

Rhino’s algorithm is pretty much similar except it calculates a good starting and ending derivative vector based, I think, on the first and last 3 points. Thus, 5 points and 2 derivatives gives 7 equations for the 7 CVs.

Hope this helps.

– Dale

Hi @dale
I tested my code against nurbs-python to see if I have the same result.
In The Nurbs Book they use the chord length or the chord length squared.

Thanks, Dale for the clarification, makes totally sense.