# An Observation about NURBS

Given that the reader probably understands more about the Math of NURBS than I do, the reader will also understand that in general, true NURBS Curves will not touch their control-points. My own earlier misperception of that subject came through the use of the (now-defunct) application ‘TrueSpace’, which arbitrarily labeled objects as NURBS, which were really not that.

It should also be understood, that classic cubic (Bézier) splines were not NURBS either. According to my own understanding, a classical, cubic Bézier spline had as basis-function:


v = ( 1 - u )
a = a30u3 + 3a21u2v + 3a12uv2 + a03v3




This is different from the basis-function of a NURBS Curve. But for certain types of 3D graphics, an exact curvature and therefore basis function, is not needed(, and the two ways of formulating this curve may even have the same result – which I could not prove).

Given this understanding, a question might arise as to why the actual application “Ayam” is capable of taking an arbitrary CSG-primitive, and converting that into a NURBS-Patch.

And there are really several separate cases, in which this is possible:

(Last Updated 12/02/2017, 13h10 : )

1. The Order of the NURBS may only be 2, given that the application in question has fully-general Math to work with NURBS. In that case, by default, the position of 1 point along a curve will be determined by 2 adjacent Control-Points, and at one exact parameter-value, will be controlled by only 1 Control-Point. This is a simpler type of NURBS, which will show as straight lines between the CPs, and which touches each CP. It’s useful to convert a Cube.
2. True NURBS have a Knot-Vector, which states possible repetitions (“Multiplicity”), and Which the application in question does implement. When the Knot has a Multiplicity equal to the Order of the NURBS Curve, it takes over the position of the Curve completely. However, a given set of three NURBS Control Points can form a linear, equidistant sequence, with one Knot having a Multiplicity equal to the Order minus one. The two NURBS CPs that form the endpoints (of this sequence) can correspond to the ICurve Handles, while the NURBS CP in the middle can correspond to the ICurve CP. What will happen is that the NURBS Curve will touch the CP in the middle, but not the ones at the ends. This is similar to how a circle is formed, with an Order of 3.
3. As an example of the type of spline described in item (2) above, if the Order is 4 – implying a cubic spline – and if it has its minimum of 4 ICurve Control Points, then the corresponding NURBS Curve will have 10 Control Points, and a Knot-Vector of { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3 } . Please bear in mind that in general, the Knot-Vector may be scalar-multiplied by an arbitrary constant, and have the same meaning. ‘Ayam’ tends to scale its -Vectors such, that their range is [ 0.0 … 1.0 ] . Either way, the range corresponds to the range, which the continuous parameter needs to traverse, until the entire Curve is drawn.
4. A NURBS-Surface – i.e., a -Patch – is a special case derived from a Curve, that has the two parameters U and V, where a Curve only used to have one parameter. The CPs are sometimes conceived to form a grid with rectangular topology. It seems entirely plausible to me, that the Order along U may be different from the Order along V, and then having a linear Order along one parameter, may be the correct way to convert a Cylinder or a Cone. In that case, a Disk may simply be a special case of a Cone, where one parameter forms a circle, and the other, linear parameter defines either the radius or the height – with a single CP defining either the center or the vertex.
5. Most plausibly, if the NURBS-Patch is to have a different Order along U from its Order along V, it should also have two separate Knot Vectors.
6. It was a convention of certain software in the past, that a Control-Point which the curve is actually supposed to touch, simply continue to be named a ‘Control-Point’, but that the Control-Points which define the derivative with which the curve passes through these Control-Points, be named ‘Handles’. Certain other references define the CPs which the curve is supposed to touch, as the ‘End-Points’, even if they get reused by two segments of the Spline. In reality, when dealing with NURBS, all forms of such points are still ‘Control-Points’, but in this posting I’ve chosen to name the CPs which the curve is not supposed to touch, ‘Handles’, in keeping with software-conventions I’m familiar with.

‘Ayam’ is an application that will allow its users to edit the Knot-Vector manually, if we switch to the “Custom” Knot-Type. However, if we’re experimenting with this randomly, we may easily create Knot-Vectors which the Ayam can’t render, thereby resulting in some error messages. Finally, I was able to implement my above idea in full:

This screen-shot actually reveals that ‘Ayam’ is not always able to determine what the correct increment is, of its parameter, for the Curve always to appear smooth. However, because this application’s preview panels are just that, and because final rendering is meant to be performed by an external renderer, I don’t mind.

The WiKiPedia article explains, that in order for a 3rd-order NURBS Curve to form a circle, its Knot-Vector should be:

But the same article also explains,

“For the purposes of representing shapes, however, only the ratios of the difference between the knot values matter; in that case, the knot vectors (0, 0, 1, 2, 3, 3) and (0, 0, 2, 4, 6, 6) produce the same curve.” (Both quotations from 08/29/2017. )

So while it may have been important to prove the above Knot-Vector, in ways that involve the constant π, according to the same reference, the entire Knot can be multiplied by ( 1 / 2π ), revealing a linear spacing between Knot-Values.

In my own example with 4th-order NURBS Curves, my only aim was that the handles around each control-point, that would have corresponded to a12 and a21 in the case of a Bézier spline above, and which I tend to denote with the character H, form working handles around each control point, which I tend to denote with the character P. I never aimed to prove that the resulting NURBS Curve forms an exact geometry.

Dirk

A way to compute single, shared Handles (commonly used with quadratic splines) automatically could be:

H2- = P2 – (1/2)( P3 – P1 )

Hn-1+ = Pn-1 + (1/2)( Pn – Pn-2 )

If each ICurve CP is to have two Handles unto itself (as commonly used with cubic splines), a way to compute those automatically could be:

H2- = P2 – (1/6)( P3 – P1 )

H2+ = P2 + (1/6)( P3 – P1 )

? H0+ = P0 + (1/3)( P1 – (1/2)( P0 + P2 ) )

? Hn- = Pn + (1/3)( Pn-1 – (1/2)( Pn-2 + Pn ) )

(Comment Inserted 08/27/2017,

Deleted again 12/02/2017 . )

And so, when using the application “Ayam”, to Skin several ICurves together, the reader might ask himself,  ‘ I’ve connected two curves already, but don’t see a fully-smoothed surface result. I only see a straight connection between two curves. ‘

• The way the program works isn’t magic. It assumes that each Curve has the same number of Control Points, as well as a 1:1 correspondence between the NURBS Control-Points in each Curve. It then adds to the existing, assumed U-parameter, a derived V-parameter, so that the NURBS-Patch can exist along both parameters.
• Just as it was with the ICurve, at least 4 visible CPs were needed, before that Curve could become curved. With NURBS in general, the minimum number of CPs a Curve needs, equals the Order of the NURBS. If the NURBS-Curve is to have only 2 CPs, then its maximum Order can be 2, which results in a linear interpolation.
• By skinning only 2 ICurves, we would be constructing a NURBS-Patch, the maximum Order of which along the V-parameter is 2, resulting in a linear interpolation between both Curves, regardless of what the Order of each Curve was along the U-parameter. This is allowed, but may not be what the user wanted.
• In order to obtain better, ‘more-curvy’ interpolation along the newly-created, V-parameter, we need to skin together at least either 3 or 4 Curves, depending on whether the V-Order is next expected to be 3 or 4.
• With an Order of 4, an ‘Ayam’ ICurve is allowed to have more than 4 CPs. And likewise, the Surface is allowed to be formed from more than 4 Curves – in one operation.
• In order for the newly-created surface to become an ICurve along the newly-defined V-parameter, ‘Ayam’ would need to be computing more Handles, as it did with the 1-parameter ICurve. If find this to be unlikely, thinking instead that the application makes some simplifications, such as just to down-convert the ICurve’s into a standard NURBS-Patch, which will therefore also have a much-simpler Knot-Vector, especially along the V-parameter. I suppose that If the application is extremely sophisticated on the Mathematics-end, it could keep the complicated Knot-Vector which was already defined along the U-parameter, but only add to that a simple, basic Knot-Vector for the newly-defined V-parameter. But I haven’t actually tested the presence of this feature in any meaningful way.
• In addition to the ‘Skin’ (GUI) tool, ‘Ayam’ possesses several others, that can be used to create a Surface from a number of Curves, and that the user doesn’t need to understand the Math of, in order to use. Those include not 1 but 2 ‘Birail’ tools, plus a ‘Sweep’ tool.
• The idea behind ‘Sweep’ is, than one curve defines a circumference-to-be, while a second Curve defines the path in 3D, along which this first Curve is to be swept, to define a new Surface. As far as the Knot-Vector goes, this poses no controversy, as the 1st and 2nd Curve need to have been defined by the user, prior to using this tool, and the GUI tools for generating Curves have already given each of them a suitable Knot-Vector. In that case, the application can simply keep both the Knot-Vector and the Order of each Curve as-is, and define the new, V-parameter, as required by the tool. In the case of Sweep, this will create a new instance of Curve 1, according to every NURBS CP belonging to Curve 2, but I repeat, the Knot-Vector and Order of Curve 2 can then simply be copied by the Surface-Creation tool…