.. role:: code :class: code MbCurve3D Curve =============== .. _MbCurve3D_Curve_: .. kernel version: 118065 The :code:`MbCurve3D` class is declared in the *curve3d.h* file. The :code:`MbCurve3D` curve is derived from the :ref:`MbSpaceItem ` and :code:`MbNestSyncItem` classes: .. figure:: ../../pictures/O.4.1.1.png :width: 15cm :align: center A curve is an abstract class. The C3D geometric kernel implements the following curves derived from the :code:`MbCurve3D` class: :ref:`MbLine3D ` -- a straight line; :ref:`MbLineSegment3D ` -- a line segment; :ref:`MbArc3D ` -- an elliptical arc; :ref:`MbPolyline3D ` -- a polyline; :ref:`MbNurbs3D ` -- a B-curve (NonUniform Rational B-Spline); :ref:`MbBezier3D ` -- a composite Bezier curve; :ref:`MbHermit3D ` -- a Hermite curve; :ref:`MbCubicSpline3D ` -- a cubic spline; :ref:`MbOffsetCurve3D ` -- an offset curve; :ref:`MbTrimmedCurve3D ` -- a trimmed curve; :ref:`MbReparamCurve3D ` -- a reparameterized curve; :ref:`MbConeSpiral ` -- a conical spiral; :ref:`MbCurveSpiral ` -- a spiral with a straight axis and a variable radius; :ref:`MbCrookedSpiral ` -- a spiral with an axis in the form of a planar curve; :ref:`MbBridgeCurve3D ` -- a Hermite spline joining two curves; :ref:`MbContour3D ` -- a contour (a composite curve); :ref:`MbPlaneCurve ` -- a planar curve in space; :ref:`MbSurfaceCurve ` -- a curve on a surface; :ref:`MbSilhouetteCurve ` -- a surface silhouette curve; :ref:`MbContourOnSurface ` -- a contour on a surface; :ref:`MbContourOnPlane ` -- a contour on a plane; :ref:`MbSurfaceIntersectionCurve ` -- a surface intersection curve. The :code:`MbCurve3D` curve is a vector function .. math:: \mathbf{\text{curve}}(t) = \begin{bmatrix} x(t) & y(t) & z(t) \end{bmatrix} of a scalar parameter *t* taking values within the interval [*t*\ :subscript:`min`, *t*\ :subscript:`max`]. A curve is a continuous mapping of a part of the numerical axis into three-dimensional space. The range of the curve parameter is the interval [*t*\ :subscript:`min`, *t*\ :subscript:`max`] in one-dimensional space. The coordinates *x*\(*t*\), *y*\(*t*\), *z*\(*t*\) of the curve point **curve**\(*t*\) are single-valued continuous functions of the parameter *t*. The boundary values *t*\ :subscript:`min` and *t*\ :subscript:`max` of the parameter domain are returned by the curve methods double :code:`GetTMin`\() and double :code:`GetTMax`\(), respectively. A curve is called periodic if there exists *p* > 0 such that **curve**\(*t* ± *kp*) = **curve**\(*t*\), where *k* is an integer. The methods .. code-block:: cpp bool IsPeriodic() and .. code-block:: cpp bool IsClosed() of a periodic curve return *true*. The method .. code-block:: cpp double GetPeriod() of a periodic curve or a curve that can be extended to a periodic one returns the period *p*. The parameter domain of a periodic curve always lies within a single period. A curve is considered periodic if: - The start and end points of the curve coincide. The following 3D curve types are not considered periodic when their start and end points coincide, for example, in the case of a degenerate curve; the :code:`IsClosed`\() and :code:`IsPeriodic`\() methods always return *false* for them: - :ref:`MbLine3D `; - :ref:`MbLineSegment3D `; - :code:`MbSpiral` and derived classes; - :ref:`MbBridgeCurve3D `; - :ref:`MbContour3D `, if it contains only one segment of one of the types listed above. - The derivatives at the start and end points coincide. If a curve can inherently have breaks (a contour or a polyline), the derivatives are allowed not to coincide. For a Bezier curve, the derivatives must coincide in direction but may differ in magnitude. To check whether the start and end points of a curve coincide with a specified tolerance, use the :code:`IsTouch`\() method, which determines coincidence regardless of the smoothness of the closure. The primary curve method is .. code-block:: cpp void PointOn( double & t, MbCartPoint3D & r ) It returns the radius-vector **r** of the curve point for a given parameter *t*. The methods .. code-block:: cpp void FirstDer( double & t, MbVector3D & rt ) .. code-block:: cpp void SecondDer( double & t, MbVector3D & rtt ) .. code-block:: cpp void ThirdDer( double & t, MbVector3D & rttt ) return the first **r**\ :subscript:`t`, second **r**\ :subscript:`tt`, and third **r**\ :subscript:`ttt` derivatives, respectively, of the curve radius-vector for a given parameter *t*. These methods correct the curve parameter when it is outside the parameter domain (except for the :code:`MbLine3D` line). When the curve parameter *t* is outside the interval [*t*\ :subscript:`min`, *t*\ :subscript:`max`], non-periodic curves shift the parameter *t* to the nearest boundary *t*\ :subscript:`min` or *t*\ :subscript:`max`, while periodic curves add or subtract the required number of periods. The method .. code-block:: cpp void _PointOn( double t, MbCartPoint3D & r ) returns the radius-vector **r** of the curve point for a given parameter *t* both within and outside the curve parameter domain. In the general case, a non-periodic curve outside its parameter domain is extended along the tangent at the boundary point. The exceptions are periodic curves, the :code:`MbArc3D` arc, :code:`MbSpiral` spirals, the :code:`MbCharacterCurve3D` symbolic curve, and the :code:`MbTrimmedCurve3D` trimmed curve within its base curve. Periodic curves outside their parameter domain are extended cyclically. The methods .. code-block:: cpp void _FirstDer( double & t, MbVector3D & rt ) .. code-block:: cpp void _SecondDer( double & t, MbVector3D & rtt ) .. code-block:: cpp void _ThirdDer( double & t, MbVector3D & rttt ) return the first **r**\ :subscript:`t`, second **r**\ :subscript:`tt`, and third **r**\ :subscript:`ttt` derivatives, respectively, of the curve radius-vector for a given parameter *t* both within and outside the curve domain. Curves override the following methods of a three-dimensional geometric object: methods for transforming a geometric object: .. code-block:: cpp void Move( const MbVector3D & to, MbRegTransform * iReg = nullptr ) .. code-block:: cpp void Rotate( const MbAxis3D & axis, double angle, MbRegTransform * iReg = nullptr ) .. code-block:: cpp void Transform( const MbMatrix3D & matr, MbRegTransform * iReg = nullptr ) methods for copying objects, checking equality and similarity, and making objects equal: .. code-block:: cpp MbSpaceItem & Duplicate( MbRegDuplicate * iReg = nullptr ) .. code-block:: cpp bool IsSame( const MbSpaceItem & other, double accuracy = LENGTH_EPSILON ) .. code-block:: cpp bool IsSimilar( const MbSpaceItem & item ) .. code-block:: cpp bool SetEqual( const MbSpaceItem & item ) methods that return a type from the geometric object enumeration: .. code-block:: cpp MbeSpaceType IsA() .. code-block:: cpp MbeSpaceType Type() .. code-block:: cpp MbeSpaceType Family() methods for retrieving and editing the internal object data: .. code-block:: cpp MbProperty & CreateProperty( MbePrompt name ) .. code-block:: cpp void GetProperties( MbProperties & properties ) .. code-block:: cpp void SetProperties( MbProperties & properties ) the method that builds a polygonal copy of a geometric object: .. code-block:: cpp void CalculateMesh( const MbStepData & stepData, const MbFormNote & note, MbMesh & mesh ) const; All curves, except for :ref:`MbContour3D `, :ref:`MbContourOnSurface `, and :ref:`MbContourOnPlane `, usually do not have breaks. :ref:`MbContour3D `, :ref:`MbContourOnSurface `, and :ref:`MbContourOnPlane ` are composite curves and can have breaks at the junctions of their constituent segments.