.. role:: blue :class: blue Constructing a Compound Curve ============================= .. _Compound_Curve_Construction_: .. kernel version: 118054 The function .. code-block:: cpp MbResultType CreateContour( MbCurve3D & curve, MbContour3D *& result ) constructs a compound curve based on a single source curve. The input parameter of the function is the source curve **curve**. If successful, the function returns :blue:`rt_Success`, otherwise it returns an error code from the enumeration :ref:`MbResultType `. The output parameter of the function is the constructed compound curve (contour) **result**. If successful, **result** returns a pointer to a new :blue:`MbContour3D` object; the caller is responsible for deleting this object. The function is declared in the *action_curve3d.h* file. The function creates the compound curve **result** based on the source curve **curve**. If the source curve **curve** is a compound curve, the constituent elements of the source curve are placed into the curve **result**. A compound curve is described in subsection :ref:`Contour MbContour3D `. The function .. code-block:: cpp MbResultType AddCurveToContour( MbCurve3D & curve, MbCurve3D & contour, bool toEnd ) modifies a compound curve by adding a curve. The input parameters of the function are: - **curve** is the curve to be added; - **contour** is the compound curve to be modified; - **toEnd** is a flag that specifies where to add the curve. The output parameter of the function is the modified curve **contour**. If successful, the function returns :blue:`rt_Success`; otherwise, it returns an error code from the enumeration :ref:`MbResultType `. The function is declared in the *action_curve3d.h* file. The function modifies the compound curve **contour** by adding the curve **curve** to the beginning or to the end of the compound curve. If **toEnd** = *true*, the curve **curve** is added to the end of the compound curve **contour**; if **toEnd** = *false*, the curve **curve** is added to the beginning of the compound curve **contour**. The joint points of the curve being modified and the curve being added must coincide, see Fig. 1: .. figure:: /MODELER/CURVE_CONSTRUCTION_METHODS/pictures/M.4.7.1.png :width: 9cm :align: center Fig. 1 If the curve **curve** being added is a compound curve, the constituent elements of the curve being added are added to the curve **contour**. The function .. code-block:: cpp MbResultType CreateContours( RPArray & curves, double metricEps, RPArray & result, bool onlySmoothConnected = false, VERSION version = Math::DefaultMathVersion() ) constructs compound curves from a set of source curves (original curves). The input parameters of the function are: - **curves** is a set of source curves; - **metricEps** is a capture radius for joining the source curves; - **onlySmoothConnected** is a flag to use smooth joining of the source curves; - **version** is an operation version. The output parameter of the function is a set of constructed compound curves **result**. If successful, the function returns :blue:`rt_Success`, otherwise it returns an error code from the enumeration :ref:`MbResultType `. The function is declared in the *action_curve3d.h* file. The function creates compound curves based on the source curves **curves** and stores them in the set **result**. If the flag **onlySmoothConnected** = *true*, all the constructed compound curves are smooth, that is, the curves have equally directed tangents at the joint points, but the derivative length at the joint points may change abruptly. If any source curve in the set **curves** is a compound curve, the constituent elements of such a source curve are added to a compound curve. Degenerate curves, null-pointer curves and duplicate curves are removed from the input array if they have no owner. The function .. code-block:: cpp MbResultType CreateContours( RPArray & curves, double metricAcc, bool onlySmoothConnected = false, VERSION version = Math::DefaultMathVersion() ) constructs contours from a set of curves with removal of degenerate curves (on original curves). The input parameters of the function are: - **curves** is the set of source curves (it is modified); - **metricAcc** is the capture radius for joining the source curves; - **onlySmoothConnected** is a flag that specifies that only smoothly joined segments are used in a contour; - **version** is the operation version. The output parameter of the function is the set **curves**, which, after the execution, contains the constructed compound curves. If successful, the function returns :blue:`rt_Success`, otherwise it returns an error code from the enumeration :ref:`MbResultType `. The function is declared in the *action_curve3d.h* file. The function automatically removes from the array **curves** all degenerate curves (with zero length or with coincident start and end points for non-closed curves), null-pointer curves and duplicate curves that have no owner. The resulting compound curves are stored back into the array **curves**, replacing the original elements.