MbCurve Two-Dimensional Curve
The abstract class MbCurve is declared in the file curve.h.
The two-dimensional curve MbCurve is derived from the classes MbPlaneItem and MbNestSyncItem:
The two-dimensional curve is an abstract class. The C3D geometric kernel implements the following two-dimensional curves that are derived from the class MbCurve:
MbLine – two-dimensional straight line;
MbLineSegment – two-dimensional line segment;
MbArc – two-dimensional elliptical arc;
MbPolyline – two-dimensional polyline;
MbNurbs – two-dimensional B-curve (NonUniform Rational B-Spline);
MbBezier – two-dimensional composite Bézier curve;
MbHermit – two-dimensional Hermite curve;
MbCubicSpline – two-dimensional cubic spline;
MbOffsetCurve – two-dimensional offset curve;
MbTrimmedCurve – two-dimensional trimmed curve;
MbReparamCurve – two-dimensional reparameterized curve;
MbCharacterCurve – two-dimensional curve whose coordinate functions are given in a symbolic form;
MbCosinusoid – two-dimensional cosine wave;
MbPointCurve – point curve;
MbProjCurve – projection curve;
MbContour – two-dimensional contour (composite curve);
MbContourWithBreaks – two-dimensional contour with breaks.
The two-dimensional curve MbCurve is a vector function
of a scalar parameter t that takes values on the interval [tmin, tmax]. The curve is a continuous mapping of a certain segment of the numeric axis to a two-dimensional space. The two-dimensional space is the XY-plane of a local three-dimensional coordinate system and the parameter domain of a surface. The parameter domain of a curve is the segment [tmin, tmax] on a one-dimensional space. The coordinates u(t), v(t) of the point curve(t) are single-valued continuous functions of the parameter t.
The boundary values tmin and tmax of the parameter domain are returned by the methods
double GetTMin()
and
double GetTMax(),
respectively.
The methods IsPeriodic() and IsClosed() return true for a periodic curve. The method GetPeriod() for a periodic curve or for 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. Two-dimensional curves of the following types are not considered periodic even if their start and end points coincide, for example, in the case of a degenerate curve. For them, the methods IsClosed() and IsPeriodic() always return false:
MbCosinusoid;
MbContour, when it contains only one segment of one of the types listed above.
The derivatives at the start and end points coincide.
If, by its nature, a curve allows breaks, such as a contour or a polyline, then a mismatch of derivatives is allowed.
For a Bézier curve, the derivatives must coincide in direction but may differ in magnitude.
To check the coincidence of the start and end points of a curve with a given tolerance, use the method IsTouch(), which checks coincidence regardless of the continuity class at closure.
The main method of a curve is
void PointOn( double & t, MbCartPoint & p ).
It returns the radius vector r of a point on the curve for a given parameter t.
The methods
return the first, second, and third derivatives of the radius vector of the curve for the given parameter t, respectively. These methods adjust the parameter of the curve when it goes beyond the parameter domain; the straight line MbLine is an exception. When the parameter t of a curve goes out of the interval [tmin, tmax], a non-periodic curve shifts the parameter t to the nearest boundary tmin or tmax, while a periodic curve adds or subtracts the required number of periods.
The method
void _PointOn( double t, MbCartPoint & p )
returns the radius vector r of a point on the curve for a given parameter t both inside the parameter domain of the curve and outside it. In the general case, a non-periodic curve outside its parameter domain is continued tangentially at the end point. The exceptions are periodic curves, an arc (MbArc), a cosine wave (MbCosinusoid), a symbolic curve (MbCharacterCurve), and a trimmed curve (MbTrimmedCurve) within its base curve. Periodic curves outside their parameter domain are continued cyclically.
The methods
return the first, second, and third derivatives of the radius vector of the curve for the given parameter t both inside the parameter domain of the curve and outside it.
Curves override the following methods of a two-dimensional geometric object:
methods that perform a transformation of the geometric object:
void Move( const MbVector & to,
MbRegTransform * iReg = nullptr,
const MbSurface * newSurface = nullptr );
void Rotate( const MbCartPoint & p,
const MbDirection & angle,
MbRegTransform * iReg = nullptr,
const MbSurface * newSurface = nullptr );
void Transform( const MbMatrix & matr,
MbRegTransform * iReg = nullptr,
const MbSurface * newSurface = nullptr );
methods that provide copying, coincidence check, checking the possibility to make objects coincident, and making objects coincident:
MbPlaneItem & Duplicate( MbRegDuplicate * iReg = nullptr ),
bool IsSame( const MbPlaneItem & item, double accuracy = LENGTH_EPSILON ),
bool IsSimilar( const MbPlaneItem & item ),
bool SetEqual( const MbPlaneItem & item ),
methods that return a type from the enumeration of geometric objects:
MbePlaneType IsA(),
MbePlaneType Type(),
MbePlaneType Family(),
methods that provide access to and editing of internal data of the object:
MbProperty & CreateProperty( MbePrompt name ),
void GetProperties( MbProperties & properties ),
void SetProperties( const MbProperties & properties ).
All curves, except for MbContour and MbContourWithBreaks, as a rule, do not have breaks. MbContour and MbContourWithBreaks are composite curves and can have breaks at the joints of their constituent segments.