# NURBS Question: a way to get continuity of NURBS

Maybe stupid question, but, is there a way to evaluate the continuity of a NURBS curve by just having its control points, knot vector and weights, programmatically?

Without having to create the curve in Rhino and call functions on the created curve?

Is there some analytical approach to do that?

In principle yes, but it may get a bit complicated.

Continuity is affected by

• the parameter were continuity is evaluated
• the degree of the curve
• the knot vector; if there are (internal) knot-value repetitions, the continuity is reduced
• overlapping control points, if they overlap, continuity is reduced
• weights may also play a role, but Iâ€™m not sure how
• possibly other things Iâ€™m not aware of

Why do you not want to create a curve object and interrogate it for continuity? What problem are you trying to solve?

This is my case, the knot vector is â€śclampedâ€ť (I hope I use the term right ) the internal vector values are multiplied.
I want to create a polyline if itâ€™s a polyline, a line if itâ€™s a line, not go directly with the NURBS.

There is IsPolyline and IsLInear

??

Thanks @Tom_P ,

but these need me to create the curve first then evaluate, I want to avoid that.
I want evaluation done on the NURBS parameters, not the curve itself.

but this will mean you have to somehow re-implement the entire logic of all those different curve-types. You can only justify this if you have a enormous project that will completely fail because of performance - or you re doing a PhD about Nurbs / parametric Curve descriptions â€¦
And still it is not said, that you will get a better performance with your own implementation.

I would suggest a simple / pragmatic approach:
Write your custom Class / Functions for Curve-CV-Weight-Knot-Analysis.
For a first step - inside this Class build a Curve and use / wrap the given Power of the Rhino API.
At the end of the project do a performance analysis of your code.
If it turns out, that the Curve-â€¦-Analysis is the bottleneck - only then dig deeper.

Thanks for your suggestion @Tom_P , but this simply is not the approach I want.

Letâ€™s say Iâ€™m doing a PhD on NURBS and I donâ€™t want to use RhinoCommon but rather recognize/differentiate the curves by other parametric/analytical/programmatic means.

The NURBS Book
Les Piegl , Wayne Tiller
it got often mentioned as a reference in other topics of this forum
read the book or at least search this forum for the title.

1 Like

Internal continuity of NURBS curves depends on the degree of the curve. It is independent of the weights. Multiknots (multiple knots at the same parameter value) reduce continuity at the multiknot. Control point location does not affect continuity unless two or more control ponts are stacked at the same location.

Note that there are two different types of continuity which can be of interest when working with NURBS.

C continuity is the continuity of curve with respect to the curve parameter.
C0 is value continuity,
C1 is first derivative continuity.
C2 is second derivative continuity, etc.
Control point location including stacking does not affect C continuity.

A NURBS curve has degree-1 continuity at knots unless the knot is a multiknot. Continuity is reduced by 1 for every multiknot.
A degree 3 curve has C2 continuity at regular knots.
A degree 3 curve at a single repeated multiknot has C1 continuity.
A degree 3 curve at a double repeated multiknot has C2 continuity. (A multiknot which is repeated degree-1 times reduces the continuity to C0 and is referered to as a full multiknot.)

There is also G continuity which is geometric continuity.
Usually a curve which has Gn continuity is also Cn continuous.
G0 is position continuity. G0 and C0 are the same.
G1 is tangent continuity. Usually a curve which is C1 is also G1.
G2 is curvature continuity. Usually a curve which is C2 is also G2.
Etc.

The exceptions (reason for the â€śUsuallyâ€ť qualifier in the above statements occur when multiple control points are stacked at the same location. Stacking control points does not affect C continuity but it does affect G continuity at the stacked control point location.

3 Likes

Thank you very much @davidcockey

Question:

What do you mean by `...is repeated degree-1 times` ?
I have nurbs with knot vector like [0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4] what would be the C continuity for this? Assuming, control points do not overlap and the curve is of degree = 3 and all weights are 1.

Update:
Now, I think you are saying â€śdegree (minus) 1â€ťâ€¦ So, in my example above the continuity is C0?

For that degree 3 curve each internal knot is a full mulitknot, and would have C0 continuity.

1 Like

Maybe a more theoretical consideration about stacked control points, weights and G-continuity: what if a control point is stacked, but has weight equal to zero? Is that then even a valid curve? If so, how does that affect G-continuity?

Interesting questions. But first I should note that I strongly recommend not varying control point weights to change the shape of geometry beyond the built-in circles, ellipses, etc when working with geometry for 3D modeling.

Setting a control point weight to zero does affect the shape of a curve; but the location of the control point (x,y,z coordinates) does not affect the shape when the weight is zero. So setting a control point weight to zero does not affect C continuity. If the control point is not stacked G continuity is not affected.

Stacking a single control point with zero weight may or may not affect G continuity depending on the degree of the curve and the number of control points stacked at a single location.

A curve with multiple control points with zero weight may have straight sections depending on which control points have zero weight.

Note that Rhino does not allow setting weights to zero; the smallest weight possible in Rhino appears to be 0.001.

Two pages which mention NURBS with weights equal to zero:
https://pages.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/NURBS/NURBS-property.html
https://pages.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/NURBS/NURBS-mod-weight.html

1 Like