[Math] How to make a closed interpolating B-spline smooth at the joining point.

continuityinterpolationspline

I have implemented an algorithm to interpolate a set of points with a B-spline curve. The algorithm is from The NURBS Book. Given a set $Q$ of data points, the interpolating algorithm gives us a cubic nonrational B-spline curve with $n + 1$ control points, $m + 1$ knots, and defined on the interval $[0,1]$. The knot vector is clamped and nonuniform.

The problem with this interpolation arises on some of my data sets where the natural shape of the curve should be closed. Where one would want the curve to be smoothly joined at the first/last point, mine is not smooth. It is exhbiting only $C^0$ continuity, I believe.

Can you please help me find:

1) A way to interpolate a set of data with a closed, periodic, B-spline curve?

OR

2) Given a degree, set of control points, parameters, and a knot vector, manipulate these structures to obtain the closed periodic curve without losing the interpolating quality of my curve?

Any help would be much appreciated.

I have done some research on how to make a curve closed and have exhausted my searching abilities on the internet (mostly finding sites like this one). It's just not clear enough to me what I need to do.

Best Answer

Recall that each piece of a cubic B-spline depends on the six knots that straddle it, and four control points:

enter image description here

So to make a cubic B-spline periodic, where I assume that your knots are $0=u_0, u_1, \ldots, u_{n+1}=1$:

  1. Add new knots $u_{-2} = u_{n-1}-1$ and $u_{-1} = u_{n}-1$ (with control points copied from those at $u_{n-1}$ and $u_{n}$) to the beginning of the spline;

  2. Add new knots $u_{n+2} = 1+u_1$ and $u_{n+3}=1+u_2$ to the end of the spline;

  3. Draw the spline as usual on $t\in [0,1]$.

Related Question