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