What is really the knot of a NURBS curve? There is a lot of explanations about it, but I can’t understand it actually in practice usage. So when I’m drawing a curve I intuitively can understand what is the control points and edit points responsible for because I can move them and observe the curve reaction. I don’t use knots when drawing a new curve but can insert/remove them afterward. Why do I need to bother about knot at all? I have readen about knots but it’s a mathematical thing, how I should apply them in practice, what is their practical benefit?
NURBS curves are parametric, that means that a curve has a parameter domain, that is its parameter (often called t) starts at the lower value of the domain and ends at the higher value. As the parameter progresses, the curve is drawn from beginning to end.
More precisely, the parameter describes how the control points are interpolated to form the curve. The knots determine two things, a) the more knots, the more control points giving you finer control over the shape of the curve and b) the value of the knots - knots are just numbers in the domain - how fast the parameter changes as the curve is drawn. As such the knot values have an influence on the final shape of the curve.
Typically, there are a few ways how to make knots. By default rhino uses the distance between control points as knot values, but you can also get uniform knots, that is, they are spaced evenly in the domain.
When you draw control points close together, followed by control points far away, then change the knots spacing to uniform with the MakeUniform command, the change in shape is quite big.
Good questions. Knots can be approached from the mathematical and algorithmic perspective, or from the application and “physical” perspective. I’ll try to follow the second path but a bit of math will still be needed.
“Splines” were originally thin strips of wood or other material which could be bent into arbitrary shapes. To bend a spline to a shape nails or weights are used at several locations along the spline. The locations of the nails or weights are the knots of the spline. The portion of the spline between the knots is a span. In between the knots the spline is smooth with the curvature and the rate of change of the curvature varying continuously. Across a knot the curvature is continuous which means the curvature is the same on either side of the knot. But the rate of change of the curvature will usually be different on either side of the knot so it is not continuous. That means the spline is not quite as smooth across a knot as it is between two knots. Physical splines are still used in boat design and building.
(To be continued)
You’re really getting your ducks in a row…
…assuming there were no knots in the wood spline itself…
(sorry, I couldn’t resist)
B-splines are “stitched” together from Bezier splines. Bezier splines are
“Perfectly smooth” (Mathematically, all derivatives are continuous. Trivially so for higher derivatives that become zero.)
Degree is always 1 less than number of control vertices.
Influence of control vertices over the curve are global; meaning if you move any control vertex, entire curve changes shape.
While (1) is great, (2) and (3) are not always desired. So one way to extend the paradigm is to stitch together multiple Bezier splines to ensure “maximal” smoothness (continuity), but not perfect smoothness, while allowing using an unlimited number of control vertices while keeping degree constant. This also means influence of control vertices does not extend beyond a certain number of control vertices left and right.
Knots are essentially where these Bezier curves are stitched together to form B-Splines. Higher order continuity will eventually break down at knots if you take enough derivatives.
If you want to go one step deeper into the math, the Bezier curves are basically polynomials (in a parameter), and the degree is the highest order power of this polynomial. For instance, Bezier curve with 4 control vertices has the form:
A t^3 + B t^2 + C t + D
and the degree is 3 (highest power of t).
(The reason it’s called Bezier and not just a polynomial is that the A,B,C,D above are not the control vertices, but a certain combination of the 4 control vertices. Algebraically, it’s equivalent, but geometrically, working with the control vertices are much more practical.)
At degree 1, the Bezier spline is a line, with 2 vertices. If you want to add a third vertex while keeping degree 1, you add with 3 points (not necessarily collinear), which is a polyline. A polyline is a degree 1 B-spline, and continuity breaks down at tangency (first “derivative”) at its vertices, which are also its knots. Same pattern continues; degree 2 B-splines are kinky at curvature level (2nd derivative), degree 3 B-splines are kinky at third derivative… etc.
If you want to see how the “stitching” is done, draw a B-spline curve (several extra control vertices than degree), type “convertToBeziers”, and inspect the result. Knots are where the Bezier curves join
- although, technically speaking, knots are not locations in cartesian space but in parameter “space”, and it gets a bit more involved with non-uniformity and rationality, but this should demystify the basic concept.
I have seen this claim before. Knots have a very clear physical meaning in space. They are the points where between individual polynomial (“Bezier”) curves. With a parametric curve there is an associated value of the parameter, which are now also referred to as “knots”. The physical knots exist on splines which are rational and or non-uniform as well as non-ration uniform splines.
(Continuing from post 4)
The shape of a physical spline can be approximated by a parametric, piecewise cubic polynomial, also known as a cubic spline or a degree 3 spline.
Piecewise means that the spline is less continuous at discrete locations along the spline. These discrete locations are the “knots”, directly analogous to the “knots” described in the earlier post for physical splines. For open splines (as opposed to a closed spline) the end points are also knots.
For a cubic / degree 3 spline the rate of change of curvature is continuous in the spans between knots but is discontinuous across knots. Curvature is continuous across knots. It is possible for the continuity across knots to be lower, such as only tangential continuity or position continuity, through the use of repeated knots, also known as multi-knots, in the equations.
“Parametric” means that for each point on the spline there is an associated parameter value, and for every parameter value there is one and only one point on the spline. The parameter is a index for locations along the spline. Each knot has an associated parameter value, and these parameter values are frequently also referred to as knots. A list of the knot parameter values is frequently called the knot vector.
The concept of a mathematical spline can be generalized to any degree, not only degree 3. For example a degree 1 spline is a series of straight line segments joined together, analogous to a string stretch around a series of pins or nails. The locations where the line segments are joined are the knots of a degree 1 spline.
(To be continued)
(Continued from post 10)
Knots and spans are directly related. A span is the portion of a curve between two adjacent knots, and a knot is the point the between two adjacent spans.
So far nothing has been said about “B-splines” or “NURBS” (Non-Uniform Rational B-Splines). B-splines are one method for representing splines with associated algorithms which have advantages for computations and curve manipulation. NURBS are a more generalized form of B-splines with some special properties which can be used to exactly model “conic” shapes. The knot parameter value vector is fundamental to the efficient algorithms commonly us to calculate B-splines and NURBS. This may be the reason many explanations of knots start with B-splines or NURBS, and why the claim is increasingly frequently made that knots are parameter values, not points on a spline . However, as discussed above knots are a property of all spline curves, not only B-splines and NURBS, and knots definitely have geometrical meaning as points on a spline. Historically the use of the term “knots” started with non-parametric splines.
The concept of splines, B-splines and NURBS have been extended directly from curves to surfaces (and to volumes which Rhino does not use). The concept of knots carries over from curves to surfaces. The knots of a spline surface are a set of curves on the surface including the perimeter curves of the untrimmed surface. For parametric surfaces knots are isocurves (constant parameter value curves). Each parametric surface has two sets of knots, one set has corresponding u-values and the other set has corresponding v-values.
To give an example of the influence of knot vector values, we did a study a few years ago on propeller 2D-sections, and the influence of the knot vector values on the curvature. Below you see the same section, but with 4 different choices of knot values. Even though the shape is very similar, it is clear that the curvature is influenced significantly by the knot value choice made.
I assume you were interpolating through a set of points. My experience is the best results when interpolating with splines are usually achieved using chord length parameterization. That makes the parameter intervals between knots equal to the chord length or distance between the input points. In Rhino commands such as CurveThroughPt and InterpCrv this is done with the option Knots=Chord.
Knot parameter values can be viewed using the List command. Rhinoceros Help - What | Rhino 3-D modeling (mcneel.com) I do not know of any Rhino commands which allow direct control over the knot parameter values.
A physical spline can be most closely approximated by a degree 3 parametric spline if the parameterization is based on arc length, the distance along the curve. However that distance is not known until the curve is created so using chord length is a good approximation, and the results are usually close to what would be achieved if arc length was used.
@davidcockey I really need one more clarification then. Why there are both knots and edit points? They look similar, both like the “nail” or “duck” which stick spline in a place, they both can share the same place but some of them don’t, and the number of edit points is bigger by Degree -1 value. Why we just don’t have knots but edit points as well and we don’t move knots directly like moving “duck”, we have to move edit points or control points to change indirectly the position of the knots?
A note about numbers of knots, spans and control points for those interested in details.
For open curves the number of unique knots equals the number of spans plus 1.
For open curves the number of spans equals the number of unique knots minus 1.
For open curves the number of control points equals the number of unique knots plus the degree minus 1.
For open curves the number of unique knots equals the number of control points minus the degree plus 1.
Open curves as implemented in Rhino have additional knots at either end with the same parameter values as the end points. These additional knots are used to simplify the evaluation of splines (calculating the x,y,z coordinates corresponding to a particular parameter value, etc).
There can also be multiple knots with the same parameter value and same coordinates to create kinks and other decreases in continuity.
For closed curves the number of “visible”, unique knots equals the number of spans.
For closed curves the number of spans equals the number of “visible”, unique knots.
For closed curves the number of control points equals the number of “visible”, unique knots plus the degree.
For closed curves the number of “visible”, unique knots equals the number of control points minus the degree.
The above statements consider the knots at the beginning and end of a closed curve as a single, unique knot because the coordinates are identical even though the parameter values will be different. Closed curves as implemented in Rhino have additional knots beyond the curves’ beginnings and ends which are not included in the statements above because they are not visible to users. These additional knots are used to satisfy the continuity conditions across the ends of the closed curves. These additional knots also simplify the evaluation of splines (calculating the x,y,z coordinates corresponding to a particular parameter value, etc).
There can also be multiple knots with the same parameter value and same coordinates to create kinks and other decreases in continuity.
It is possible to “stack” distinct control points at the same x,y,z location which creates knots with different parameter values but the same x,y,z coordinates. The span lengths between these knots is zero. This can cause problems in evaluating splines. If three or more control points are stacked the curvature graph/comb will have spikes. Stacking control points should be avoided unless absolutely necessary.
The brief answer is because in many instances, particularly other than degree 3 curves, calculating a new curve shape after moving edit points works better than after moving knots. The developers of Rhino decided to use edit points.
More information about “edit points” and their relation to knots. Note that this discussion is for curves of degree 2 or greater. For curves of degree 1 edit points, control points and knots coincide.
Rhino allows edit points to be turned on for curves (EditPtOn) and edit points appear to be similar to knots and for in some instances some but not all edit points coincide with knots.
Edit points can be considered as an alternative to control points. Both provide handles for modifying curve handles. The number of edit points equals the number of control points. However there are two significant differences between edit points and control points.
Edit points are on the curve. Control points are usually off the curve other than at the ends of open curves. If an edit point is moved the curve changes shape so that it continues to go through the new edit point location. This can be useful when a curve needs to go through a particular point.
Moving an edit point modifies the entire curve, though the change in the curve shape decreases with distance from the edit point. Moving a control point modifies only a portion of multi-span curve, not the entire curve, except for some control points when the number of spans is less than the degree plus one (or when there are interior multiple knots). This limits the usefulness of edit points because it is not possible to make only a local change on a multi-span curve using edit points.
The locations of each edit point are calculated by averaging the locations of several adjacent knots. If the curve is odd degree (3, 5, 7, etc) and the knots are uniform (equal parameter spacing) then there will be an edit point at each knot location. If the knots are not uniform or the curve is even degree (2, 4, 6, etc) then the edit points will generally not coincide with interior knots.
The reason there are more edit points than knots is because the degrees of freedom of a spline is greater than the number of knots by the curve degree minus 1. This is the number of edit points and control points. This number of edit points provides complete control over the shape of the curve, the same as the number of control points
This interactive explainer has a good section on knots towards the end
let me add my understanding of knots.
from my practical point of view in rhino.
the usefulness of the knots at first sight is to allow to have more points of controls in a curve without the need to increase the degree.
since the disadvantage of high degrees is rigidity.
a low degree curve is more elastic, while a high degree curve is a little more smooth.
so an alternative solution is to add knots to have more point and more control over the curves.
if I need 7 control points in a curve I don’t have to create a degree 6 curve. a degree 3 curve with 3 knots gives me 7 control points.
note that this changes the basic topology of the Bézier curve.
the knots divide the curve into several segments (span) at the same time the nodes ensure the required continuity between these spans.
this mathematically provided continuity depends on two basic factors
1 (degree of the curve).
2 (the multiplicity of the knot)
for the simple knot , the contunuity between the spans is directly related the degree of the curve.
(G0 for degree 1)
(G1 for degree 2)
(G2 for degree 3)
(G3 for degree 4)
and so on, beyond degree 5 the quality of the continuity is too smooth or even indistinguishable to the naked eye.
the cause of the variable continuity of the knots.
is only the story of the number of control points that the knot captures to achieve the collusion and the required continuity between the spans.
these captured points are neither visible nor manipulable separately by the user.
these are the exclusive property of the knot, if I can put it that way.
this property comes to an end if we decompose the curve manually on the places where the knot is located, or with the help of the command (converttobezier).
in this case, the points are released and become visible and maneuverable.
consequently we lose the automatic mathematical control of the continuity between the spans (all simply)
there is still a lot to say about multiple nodes. and uniform and non-uniform knots
I recently had the same question as you and went pretty deep down the rabbit hole. Other’s have given a lot of great technical detail above so I won’t repeat that, however, there were a few things I learned which I had been misunderstanding for years, which might help you and others:
- The knot vector is not refering to a direction vector like I assumed; ‘vector’ is used more in the computer science / engineering sense of the word: a list of numbers. In this case, a list of parameter positions along the curve where separate curve-pieces are ‘joined’ together (bit of a simplification, others have described in better detail above).
- The difference between the InsertKnot and InsertControlPoint commands in rhino. Both of these commands add a knot and a control point to the curve. InsertControlPoint keeps the existing control points in the same place and adds a new one in between, thus changing the shape of the curve slightly. InsertKnot adds a new control point and moves some of the existing ones in such a way as to keep the shape of the curve the same. People often used to tell me to “add a knot” to a curve to give me more control and I was always confused why I wasn’t adding a control point instead. I think this is the thing that has confused me the most about knots over the years. I think InsertKnot could be called InsertControlPoint-PreserveCrvShape, but I’m sure there are reasons for the current naming.
- Rhino largely takes care of knots behind the scenes. There are very few ways to explore/modify them directly in the interface (which is probably for the best!). I ended up using the Nurbs Curve PWK component in grasshopper to play around with different combinations of control points, knots, weights etc and get a more intuitive understanding of it all.