2
$\begingroup$

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.

$\endgroup$
1
$\begingroup$

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]$.

$\endgroup$
1
$\begingroup$

I found the answer - after weeks of searching - in the documentation to a latex package (of all places) called pst-bspline. I can interpolate a cubic periodic B-spline through the points $S_0,\dots, S_{n - 1}$ by solving the matrix equation

$$ \begin{bmatrix} 4 & 1 & & & 1\\ 1 & 4 & 1 & & \\ & 1 & 4 & 1 & \\ & & \cdots & & 1\\ 1 & & & 1 & 4 \end{bmatrix} \cdot \begin{bmatrix} B_1\\ B_2\\ B_3\\ \cdots\\ B_n \end{bmatrix} = \begin{bmatrix} 6S_1\\ 6S_2\\ 6S_3\\ \cdots\\ 6S_n \end{bmatrix} $$

where $S_n$ is equal to $S_0$. Solve for $B$ then simply push back the points $B_0$, $B_1$, and $B_2$ into the back of the $B$ (so that the first three and last 3 points of $B$ are the same). Supply a uniform knot vector and you've got it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.