.. role:: blue :class: blue MbSplineSurface NURBS Surface ============================= .. _MbSplineSurface_NURBS_Surface_: .. версия ядра: 1180ХХ Class :blue:`MbSplineSurface` is declared in the *surf\_spline\_surface.h* file. The NURBS surface (NonUniform Rational B-Spline surface) :blue:`MbSplineSurface` is defined by control points SArray<:blue:`MbCartPoint3D`> **points**\[*i*]\[*j*], *i* = 0, 1, ..., *vcount* − 1, *j* = 0, 1, ..., *ucount* − 1, conventionally located at the nodes of a rectangular grid with *ucount* columns and *vcount* rows, by the weights of the control points given in the table *weight*\[*i*]\[*j*], by the order of B-splines along the first surface parameter *udegree*, by the order of B-splines along the second surface parameter *vdegree*, by the knot vector along the first parameter *uknots*, by the knot vector along the second parameter *vknots*, and by the flags of the surface periodicity in the first and second parameters *uclosed* and *vclosed*. The surface also has some additional data that is optional and is used to speed up the surface methods. The order of B-splines along the surface parameters coincides with the order of the divided difference used to compute the corresponding B-splines. The knot vectors *uknots* and *vknots* are nondecreasing sequences of real numbers and define the domain of the surface parameters and its shape. Let the knot vector *uknots* contain *uknotsCount* elements, and let the number of points in each row of the rectangular grid be equal to *ucount*. For a NURBS surface that is nonperiodic in the first parameter, the numbers of elements in the sets are related by the equality *ucount* + *degree* = *uknotsCount*. For a periodic NURBS surface, the numbers of elements in the sets are related by the equality *knotsCount* + 2 *degree* − 1 = *knotsCount*. In the :blue:`PointOn`\( double *u*, double *v*, :ref:`MbCartPoint3D ` & **s** ) method, the radius vector of the surface **s** is described by the vector function .. math:: r(u, v) = \frac{\sum\limits_{i = 0}^{\mathit{\text{vcount}} - 1}{\sum\limits_{j = 0}^{\mathit{\text{ucount}} - 1}{N_i^{vdegree}(v) N_j^{udegree}(u) \mathit{\text{weight}}\lbrack i\rbrack\lbrack j\rbrack \mathbf{\text{points}}\lbrack i\rbrack\lbrack j\rbrack}}}{\sum\limits_{i = 0}^{\mathit{\text{vcount}} - 1}{\sum\limits_{j = 0}^{\mathit{\text{ucount}} - 1}{N_i^{vdegree}(v) N_j^{udegree}(u) \mathit{\text{weight}}\lbrack i\rbrack\lbrack j\rbrack}}}, where :math:`N_i^{vdegree}(v)` and :math:`N_j^{udegree}(u)` are B-splines. Fig. 1 shows segments connecting neighboring control points **points**\[*i*]\[*j*]. .. figure:: /MODELER/SURFACES/pictures/O.5.22.1.png :width: 12cm :align: center Fig. 1 Fig. 1 illustrates the conventional arrangement of the control points at the nodes of a rectangular grid. The NURBS surface constructed on the same control points is shown in Fig. 2: .. figure:: /MODELER/SURFACES/pictures/O.5.22.2.png :width: 12cm :align: center Fig. 2 The curves on the surface **s**\(*const*, *v*) and **s**\(*u*, *const*) with parameters *u* = const or *v* = const are B-curves of degree *udegree* and *vdegree* respectively. In the first parameter, the surface has order *udegree*, and in the second parameter, the surface has order *vdegree*. The domain of the parameters of a nonperiodic NURBS surface is a rectangle: *uknots*\[*udegree* − 1] ≤ *u* ≤ *uknots*\[*ucount*], *vknots*\[*vdegree* − 1] ≤ *v* ≤ *vknots*\[*vcount*]. The surface can be periodic both in the first parameter and in the second parameter. For a periodically closed surface, the knot vectors *uknots* and *vknots* have *udegree* − 1 and *vdegree* − 1 additional elements respectively. The domain of the parameters of a NURBS surface that is periodic in both parameters is a rectangle: *uknots*\[*udegree* − 1] ≤ *u* ≤ *uknots*\[*ucount* + *udegree* − 1], *vknots*\[*vdegree* − 1] ≤ *v* ≤ *vknots*\[*vcount* + *vdegree* − 1]. Each surface can construct its NURBS copy by the virtual method :blue:`NurbsSurface`\( const MbNurbsParameters & *uParam*, const MbNurbsParameters & *vParam* ).