G0 ; G1 ; G2 ???

 From:  Michael Gibson
290.8 In reply to 290.5 
> Very often I see mention of a degree for NURBS. Could you explain what that is ?

This one is a bit more difficult to explain.

Basically, the math behind NURBS curves uses a type of polynomial equation to blend between control points.

The way curves work, a point on the curve is calculated by blending together the values of a set of control points.

So for example the curve above is what is called a degree 2 or "quadratic" bezier curve.

Every point on this curve is calculated by a blending equation that takes in all 3 points as part of the equation and produces a point on the curve. But the blending is continuously shifting as you slide along the curve - at the very beginning of the curve the second and third points are contributing 0 (this is why the curve touches the first point), but as you move towards the middle of the curve, the blending is more of an average of all 3 points, then shifting to finally only the 3rd point at the end.

Anyway, I mention this blending-together of points because the degree of a curve has to do with how many points are used to calculate one section of the curve.

A degree 1 curve (linear) blends together 2 points.

A degree 2 curve (quadratic) blends together 3 points.

A degree 3 curve (cubic) blends together 4 points.


That's how bezier equations work. NURBS are similar, except NURBS provides a way to have a curve with more than just degree+1 points in it. Your curve is still made up of different sections, but each shares an overlapping set of points with each other. This sharing provides smoothness between each section.

Here is a cubic (degree 3) NURBS curve with 6 control points. This makes a curve that actually has 3 internal segments to it - every 4 points defines a segment which I have illustrated here:

So a higher degree means that more points are used to make a single polynomial segment of the curve.

> Is there a relation between the "G value" of a curve and its degree or is this
> totally different stuff ?

There is a relation because the degree determines how many internal segments the curve will have, and there is a G value where segments meet (just as there is where 2 separate curves meet). Also the degree of the curve can limit the maximum G value - for instance the common cubic curve will only have inherently G2 smoothness, but if you go to a higher degree curve it means that there are a larger number of points shared in common between different sections and this means that there is a higher amount of built-in continuity between the segments (the segments are often referred to as "spans" of a curve).

There are some other effects of high degree - the greater averaging makes a kind of slightly more melted effect. By which I mean that a higher degree curve kind of gradually melts a bit farther and farther away from its control points as you go to higher and higher degree.

Some specialized applications want to reduce the number of internal spans to a curve, which is one effect of increasing the degree.

I have thought a little bit about maybe changing the curve tool to draw curves of degree 5 instead of degree 3 as it currently does - the slightly-more-melty effect of degree 5 is kind of nice.

It's not too practical to go too high in degree since a lot of processes go through loops of work depending on the degree, so there is also an increased calculation time issue with very high degree - that's why everything doesn't just go up to degree 100 or something like that.

- Michael