.. role:: code :class: code Two-Dimensional Contour MbContour ================================= .. _MbContour_Two-Dimensional_Contour_: .. kernel version: 118065 The :code:`MbContour` class is declared in the *cur_contour.h* file. The two-dimensional contour :code:`MbContour` is described by a set of RPArray<:ref:`MbCurve `> **segments** of curves joined to each other and by the curve closedness attribute **closed**. A two-dimensional contour is a composite curve. Unlike other curves, a contour can have breaks. The curves forming a contour will be called **segments**. The following conditions are satisfied for contour segments: the beginning of each subsequent segment coincides with the end of the previous segment. For a periodic contour, the beginning of the first segment coincides with the end of the last segment. If a contour contains only one segment of one of the following types, it is considered nonperiodic: :code:`MbLine`, :code:`MbLineSegment`, :code:`MbCosinusoid`. To check the closedness and continuity of contour points with a specified tolerance, use the :code:`IsClosedContinuousC0`\() method. The method checks the coincidence of the first and last contour points, as well as the coincidence of the end of each segment with the beginning of the next one. The check does not require smooth joining of segments. By default, the tolerance :code:`5.0 * PARAM_NEAR` is used. The initial value of the contour parameter is zero: *t*\ :subscript:`min` = 0. The parametric length of a contour is equal to the sum of the parametric lengths of its constituent segments: .. math:: t_{\text{max}} = \sum\left( w_{i\text{max}} - w_{i\text{min}} \right), where *w*\ :subscript:`i min` and *w*\ :subscript:`i max` are the minimum and maximum parameter values of the *i*-th segment. When calculating the radius-vector of a contour point, the working segment and the value of its local parameter are first determined from the parameter value. Then, the radius-vector of the working segment is calculated, which serves as the contour radius-vector. In the method .. code-block:: cpp PointOn( double & t, MbCartPoint & r ) the curve radius-vector **r** is described by the vector function .. math:: \mathbf{r}(\mathit{t}) = \mathbf{segments}[k](w_{k}), where **segments**\[*k*\]\( *w*\ :subscript:`k` ) is the working contour segment with index *k*, and *w*\ :subscript:`k` is the working segment parameter equal to .. math:: w_{k} = w_{k\text{min}} + t - \sum\limits_{i = 0}^{k - 1} \left( w_{i\text{max}} - w_{i\text{min}} \right). The segment with index *k* is determined from the contour parameter *t* according to the condition .. math:: \sum\limits_{i = 0}^{k - 1} \left( w_{i\text{max}} - w_{i\text{min}} \right) \leq t < \sum\limits_{i = 0}^{k} \left( w_{i\text{max}} - w_{i\text{min}} \right), where *w*\ :subscript:`i min` and *w*\ :subscript:`i max` are the minimum and maximum parameter values of the *i*-th segment. The contour is shown in the figure: .. figure:: ../../pictures/O.3.17.1.png :width: 12cm :align: center Other two-dimensional contours must not be used as segments of a two-dimensional contour. If a contour needs to be constructed based on other contours, the latter must be considered as a set of their constituent curves rather than as individual curves.