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

1. 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?

2. 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?

3. The Wikipedia article, at least to me, seems not very clear about this "knot vector". What is it anyway?

• This is a bit too much stuff for one question. I can essentially boil down my introductory lecture on the subject in a few hours. Bit going into detail of use of De casteljanu and the de boor's algorithm would take me too much time. – joojaa Aug 25 '15 at 13:42
• So i would like to see questions 3, 5 and possibly 6 split off as separate questions to make answering and understanding more meal sized. – joojaa Aug 25 '15 at 13:51
• @joojaa Sure, I can split the question, just a sec... – Ecir Hana Aug 25 '15 at 14:03
• So the question 3, 5 and 6 were split off to separate questions. – Ecir Hana Aug 25 '15 at 14:11

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.

• regarding (*), Bezier curves have the same problem. The issue there is that the curves (in both cases) are defined as x = f(t), y = f(t). However, you can also define a univariate / explicit / 1 dimensional curve (again, in both cases) as y = f(x), using x in place of t. In the case of rational curves, instead of being able to represent conic sections, you can represent sine and cosine (and more of course). NURBS / b-splines aren't special in that regard. – Alan Wolfe Aug 26 '15 at 14:04
• I think your statement about length is wrong (only works with linear functions?), and not sure how length calculations is supposed to fit in your explanation (good info you gave, just sayin'!) – Alan Wolfe Aug 26 '15 at 14:16
• @AlanWolfe deleted anyway – joojaa Aug 26 '15 at 14:21
• Most awesome! Thanks a lot, very good explanation! – Ecir Hana Aug 26 '15 at 21:28
• Typo perhaps? "Instead the underlying surface has a customizable parameter range. The parameter is stored in something called a knot, and each knot can have a arbitrary value that is bigger than the next." -> "Instead the underlying curve has a customizable parameter range. The parameter is stored in something called a knot, and each knot can have a arbitrary value that is bigger than the previous." Btw., could you please clarify what you mean by "UV range"? "UV" implies 2D..? – Ecir Hana Aug 26 '15 at 21:31