Given $n+1$ control points; $P_0,P_1,...,P_n$ (where all are 2-dimensional points), and $k$ (which defines the order of the polynomial, and hence its degree; $k-1$) the B-Spline curve is defined by:
$$B(u)=\sum_{i=0}^{n}N_{i,k}(u)\cdot P_i$$

Where $N_{i,k}$ are the basis functions defined recursively as:
$$N_{i,0} = \begin{cases} 1 & \text{if }\hspace{5pt} t_i\leq u < t_{i+1}\\ 0 & \text{else} \end{cases}$$


$$N_{i,k}=\frac{u-t_i}{t_{i+k-1}-t_i}\cdot N_{i,k-1}+\frac{t_{i+k}-u}{t_{i+k}-t_{i+1}}\cdot N_{i+1,k-1}$$

The $t_i$'s are "knots values" taken from the "knot vector": $t=(t_0,t_1,...,t_{n+k})$

I want to write a computer program to formulate this, so I could later - given $n$ points - draw a B-Spline closed curve.

Since I want to generate a closed curve, I need that the curve will not pass through the end points ($P_0$ and $P_n$), because I'm planning to do the following adjustment: I plan to wrap around the first $k-1$ and last $k-1$ control points to form a closed curve.
Meaning, given $n$ points $P_0,P_1,...,P_n$, I will add another $k-1$ points: $P_{n+1},P_{n+2},...,P_{n+k-1}$ and set them to be: $P_{n+1}:=P_0,P_{n+2}:=P_1,...,P_{n+k-1}:=P_{k-2}$, and this, hopefully, will give me a closed curve.

My question is this: What should the knot vector be, in order for me to get a B-Spline that does not pass through the first and last points?
In other words, what values should I assign to $t=(t_1,t_2,...,t_n+k)$ in order for the curve to be Uniform B-Spline curve? and when I say Uniform B-Spline curve I mean that in the same sense that this professor means here, because something tells me - and please correct me if I'm wrong - that Uniform B-Spline curve (again - in the sense that he means. I feel the need to emphasize this to avoid ambiguity - I found several definitions online), is exactly what I need to make the adjustment mentioned above.

This is very important to me, any help would be greatly appreciated!


If you insist using uniform knot sequence (which is how you obtain a uniform B-spline curve), then as long as the number of knot values follow the rule: number of knots = number of control points + order, then you should get a closed curve. Note that the number of control points should include those repeated (k-1) control points.

For example, if you have a cubic B-spline curve with 7 control points $P_0$, $P_1$,...,$P_6$ where $P_4=P_0$, $P_5=P_1$ and $P_6=P_2$, the knot sequence can be (-0.75, -0.5, -0.25, 0.0, 0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75). Please note that the knot sequence is defined in this way (with negative knots) so that the valid range of the B-spline curve is still [0,1].

If you do not want to use uniform knot sequence, then the knot sequence still needs to follow a specific pattern in order for the curve to become periodic (i.e., closed with certain continuity at the joint). I will not elaborate on this topic here as you do not really need it.

  • $\begingroup$ Thank you @fang! One last question: In what way does the choice of knot values determines the range of the BSpline? For example, you said: "Please note that the knot sequence is defined in this way (with negative knots) so that the valid range of the B-spline curve is still [0,1]." How did you know that this is the range that will be defined by those knots values? $\endgroup$ – so.very.tired May 25 '15 at 18:32
  • 1
    $\begingroup$ @OP: For any given knot sequence knot[i] where i is from 0 ~ (n-1), the valid range is always from knot[degree] to knot[n-order]. $\endgroup$ – fang May 25 '15 at 20:06
  • $\begingroup$ Thank you! that was very helpful! $\endgroup$ – so.very.tired May 26 '15 at 9:04

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.