.. role:: blue :class: blue MbNurbs3D NURBS Curve ===================== .. _MbNurbs3D_NURВS-Curve_: .. kernel version: The :blue:`MbNurbs3D` class is declared in the *cur\_nurbs3d.h* file. The NURBS curve takes its name from the initials of the words NonUniform Rational B-Spline. The curve is derived from the :blue:`MbPolyCurve3D` curve. The curve is defined by the set of control points SArray\<:ref:`MbCartPoint3D `\> **pointList**, the set of weights of the control points *weights*, the knot vector *knots*, the spline order *degree*, the curve form parameter *form*, and the curve periodicity flag *closed*. The curve also has some additional data that are optional and used to speed up the execution of its methods. The curve is constructed based on B-splines. The knot vector *knots* is a nondecreasing sequence of real numbers and defines the domain of the curve parameter and the curve shape. The curve form parameter *form* generally takes the *ncf_Unspecified* value; in special cases it stores information about the original curve from which the NURBS copy was obtained. The NURBS curve order *degree* is equal to the order of divided differences used to compute the B-splines. Let the knot vector contain *knotsCount* elements and the set of control points contain *pointsCount* elements. For a non-periodic NURBS curve, the numbers of elements in the sets are related by *knotsCount* = *pointsCount* + *degree*. For a periodic NURBS curve, the numbers of elements in the sets are related by *knotsCount* = *pointsCount* + 2 *degree* – 1. In the :blue:`PointOn`\( double & *t*, :ref:`MbCartPoint3D ` & **r** ) method, the radius vector of the curve **r** is defined by the vector function .. math:: r(t) = \frac{\sum\limits_{j = 0}^{\mathit{pointsCount} - 1} {N_{j^{\mathit{degree}}}(t)\, \mathit{weight}[j]\, \mathbf{pointList}[j]}} {\sum\limits_{j = 0}^{\mathit{pointsCount} - 1} {N_{j^{\mathit{degree}}}(t)\, \mathit{weight}[j]}}, where :math:`N_{j}^{\mathit{degree}}(t)` are B-splines of order *degree* for the *j*-th control point **pointList**\[*j*\]. The NURBS curve is shown in Fig. 1: .. figure:: /MODELER/CURVES/pictures/O.4.6.1.png :width: 12cm :align: center Fig. 1 The curve parameter *t* takes values on the interval *tmin* ≤ *t* ≤ *tmax*, where *tmin* = *knots* \[*degree* – 1\], *tmax* = *knots* \[*knotsCount* – *degree*\]. The curve may be periodic. A periodic NURBS curve is shown in Fig. 2: .. figure:: /MODELER/CURVES/pictures/O.4.6.2.png :width: 12cm :align: center Fig. 2 The NURBS curve shape depends on the control point locations, the control point weights, and the knot vector values. In the general case, a NURBS curve does not pass through the set of points **pointList**\[i\], *i* = 0,..., **pointsCount** – 1. For an open NURBS curve to pass through the end control points, the first *degree* elements and the last *degree* elements of the knot vector *knots* must coincide. The larger the weight of a control point, the closer the curve passes to this point, all other conditions being equal. Each curve can construct its own NURBS copy using the virtual method :blue:`NurbsCurve`\( const MbNurbsParameters & *tParameters* ).