Non-uniform rational B-spline (NURBS) Basics I'm trying to understand NURBS curves (surfaces later!) but I have some trouble understanding the very basics of its inner workings. Could someone please explain a few things to me? As I come from Bezier curves, a comparison between these two would be especially useful.


The "rational basis function" looks a tiny bit like Bernstein polynomial of (rational) Bezier curve. Does the parameter u also go from 0 to 1?
How to "add detail" to a curve? I mean, with Beziers if I needed to describe a more complicated shape I would simply "stitch" several Beziers together. Or less often, increase the degree. I understand I can increase the degree of NURBS as well and put several NURBS curves side-by-side, but is this how it should be done?
The Wikipedia article, at least to me, seems not very clear about this "knot vector". What is it anyway?
B-Splines and Beziers are parallel inventions of more or less the same thing. Where Beziers try to start from the idea of fitting tangents. B-Splines start with the idea of basis functions. NURB Splines (or the rational part in fact) are just generalizations of B-Splines so you can describe accurate conic sections*, as they are of special interest in engineering.

First let us start with a simple NURB Spline terminology. The rationale of these curves is a bit different than for Beziers. First there is the concept of a span. A span would roughly be equivalent to a whole Bezier spline except in nurbs you can have any number of spans. 



Image 1: One cubic NURBS span. This is a bit atypical in formulation

Each span is formed by the curve degree + 1  control points**. Each curve can consist of any number of points. Each consecutive span reuses the points form previous span by dropping one point and taking one point more in the list. So making more complex curves is as easy as just appending more points to the curve.

NOTE: The images curves are a bit atypically parametrized, ill explain what this means in the next section. When i take the concept of knots up. This is just a easier way to explain how the curves glue together.



Image 2: 2 cubic spans after each other, each span uses 4 points. together they form one curve. They share most points with each other.

By now we have probably answered the 2 question about adding complexity. But I would like to add that this scheme ensures better continuity than a bezier curve. Additionally you can make the point array that forms the hull cyclic. Forming a closed curve.



Image 3: A closed cubic NURBS surface has as many spans as it has points. Each color is one span.

Parametrization

Up until this point one could just say that the stringing together the spans is a trick just as "sewing" the Bezier curves. But there is a difference. The curve is parametrisized along its length. So the curves are not separate they do not interpolate form 0 to 1 on each span like Beziers do. Instead the underlying curve has a cusomizable parameter range. The parameter is stored in something called a knot, and each knot can have a arbitrary increasing value in the sequence. So you can parametrize the entire curves u range to 0 - 1 or 0 to 12. The parametrization also does not have to be uniform.

This parametrization changes how the curve is shaped. Why would this be useful? Well you can adjust the tension along the curve for one. Or you could encode the length of the curve into to the U parameter. One peculiar use is to make the NURBS curve act like a Bezier curve either fully or just partially (bezier like in the ends but not in the middle for example).



Image 4: Same points different knot sequences. The green NURBS curve corresponds to a Bezier curve that has a parameter range of 0-2 instead of 0-1

Ok so what are the knots? They are simply the ranges of the basis functions. Since the cubic b-spline with 4 points has 4 interpolating functions it needs 8 knots. Only areas where 3 functions overlap and sum up to 1.0 can a line be drawn.



Image 5: 2 different basis functions, a bezier like and a uniform segment parametrisation, spread to 0-1 range. 

And now we have mostly described the answer to question 1. The range is not defined you can stretch the basis functions as you see fit. And finally the knot vector simply produces the parameter ranges for the basis functions. Theres still one more thing that governs the shape of the curve and that is the weight vector. But that another story to be told elsewhere.



* This rational in this case means that a NURBS curve does not have to be a polynomial, as you cant describe a circle with polynomials. 

** One can define other types of points.