# B-Spline: How to generate a closed curve using Uniform B-Spline curve?

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}$$

and:

$$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!

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