B-Spline interpolation method used in AutoCAD

interpolationspline

I have a number of input points that I would like to fit a B-Spline through using global interpolation (given a degree p). In other words, my B-Spline needs to pass directly through these points. Therefore, I need to determine the control points that will produce this B-Spline. AutoCAD has an option "Spline by Fit" which describes exactly what I want.

My problem has been in determining these control points. What formula should I use for this global interpolation? I have not found much on the internet about this, except for the document at https://pages.mtu.edu/~shene/COURSES/cs3621/NOTES/INT-APP/CURVE-INT-global.html, and have managed to successfully construct a B-Spline that does in fact pass through in the input points, however this method result in curves that wiggle a lot more than the ones in AutoCAD do, and so I am not sure if there are any alternate formulae which might produce slightly different result which AutoCAD may be using.

Help or guidance would be much appreciated.

Edit: I assigned the knot vectors using uniform distribution, with the first p + 1 knots being 0, and the last p + 1 being 1, with p being the degree of the curve. I assigned the parameters also uniformly, calculating t using t = i / n, where I is the current input point and there are n + 1 input points.

I figured that this wouldn't change the result THAT drastically, and that something had to be going wrong in my interpolation algorithm, but I'm not 100% sure. How could I improve this to make my curve less "wiggly"?

Best Answer

For B-spline curve interpolation, the two most important factors that would affect the resulting spline's shape are (a) the parameter assigned to each data point and (b) the knot vector.

For assigning parameter to each data point, there are many different ways but the two most popular choices are chord-length parametrization and centripetal parametrization. In this link, there is a picture showing the difference for using different parametrizations.

Once the parameter for all data point are decided, the knot vector needs to be decided based on the parameters in a way so that the matrix is not singular or nearly-singular. This is known as "Schoenberg-Whitney condition". A common way to determine knot vector that meets this condition is the parameter averaging scheme, which is described below using cubic B-spline as example.

Suppose we want to use a cubic B-spline to interpolate given $N$ points, the resulting B-spline will also have $N$ control points. Therefore, there are $N+4$ knot values that need to be decided. Assuming the point parametrization is $u_0=0.0,u_1,u_2,...,u_{N-1}=1.0$, we can decide the knot vector as

  • Assign $0.0$ to the first 4 knots,
  • $knots[4]=(u_1+u_2+u_3)/3$,
  • $knots[5]=(u_2+u_3+u_4)/3$,
  • ....
  • Assign $1.0$ to the last 4 knots.