C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2

Curve in two-dimensional space. More...

#include <curve.h>

+ Inheritance diagram for MbCurve:
+ Collaboration diagram for MbCurve:

Public Member Functions

virtual ~MbCurve ()
 Destructor.
 
MbePlaneType Type () const override
 Get the group type of the object.
 
MbePlaneType Family () const override
 Get family of object.
 
void Refresh () override
 Set all temporary (mutable) data of object to undefined (initial) state.
 
virtual void PrepareIntegralData (const bool forced) const
 Calculate temporary (mutable) data of an object. More...
 
size_t size () const
 Number of objects if object is interpreted as vector of objects.
 
const MbCurveoperator[] (size_t) const
 An access operator.
 
virtual MbResultType Extend (const MbCurveExtensionParameters &parameters, c3d::PlaneCurveSPtr &resCurve) const
 Extend the curve. More...
 
Common functions of two-dimensional object.
virtual void AddYourGabaritMtr (MbRect &rect, const MbMatrix &matr) const
 Add a bounding box to rectangle. More...
 
virtual void CalculateGabarit (MbRect &) const
 Detect the bounding box of a curve. More...
 
virtual void CalculateLocalGabarit (const MbMatrix &into, MbRect &local) const
 Calculate bounding box in the local coordinate system. More...
 
bool IsVisibleInRect (const MbRect &rect, bool exact=false) const override
 Determine visibility of an object in rectangle. More...
 
virtual bool IsCompleteInRect (const MbRect &rect) const
 Determine whether an object is fully visible in rectangle. More...
 
double DistanceToPoint (const MbCartPoint &toP) const override
 Calculate the distance to a point.
 
bool DistanceToPointIfLess (const MbCartPoint &toP, double &d) const override
 Calculate the distance to a point. More...
 
Functions for curve domain description.
virtual double GetTMax () const =0
 Get the maximum value of parameter.
 
virtual double GetTMin () const =0
 Get the minimum value of parameter.
 
virtual bool IsClosed () const =0
 Define whether the curve is periodic. More...
 
virtual double GetPeriod () const
 Return period. More...
 
virtual bool IsPeriodic () const
 Define whether the curve is periodic. More...
 
bool IsTouch (double eps=Math::LengthEps) const
 Determine whether a curve is closed regardless of the smoothness of the closure. More...
 
Functions for working in the curve's domain.

Functions PointOn, FirstDer, SecondDer, ThirdDer,... correct parameter when it is out of domain bounds. The exception is MbLine (line).

virtual void PointOn (double &t, MbCartPoint &p) const =0
 Calculate a point on the curve. More...
 
virtual void FirstDer (double &t, MbVector &v) const =0
 Calculate first derivative.
 
virtual void SecondDer (double &t, MbVector &v) const =0
 Calculate second derivative.
 
virtual void ThirdDer (double &t, MbVector &v) const =0
 Calculate third derivative.
 
void Tangent (double &t, MbVector &v) const
 Calculate tangent vector (normalized).
 
void Tangent (double &t, MbDirection &d) const
 Calculate tangent vector (normalized).
 
void Normal (double &t, MbVector &v) const
 Calculate main normal vector (normalized).
 
void Normal (double &t, MbDirection &d) const
 Calculate main normal vector (normalized).
 
Functions for working inside and outside the curve's domain.

Functions _PointOn, _FirstDer, _SecondDer, _ThirdDer,... do not correct parameter when it is out of domain bounds. When parameter is out of domain bounds, an unclosed curve is extended by tangent vector at corresponding end point in general case. The exceptions are arcs of ellipse and arcs of circle - they are extended according to their equations.

virtual void _PointOn (double t, MbCartPoint &p) const
 Calculate point at curve and its extension. More...
 
virtual void _FirstDer (double t, MbVector &v) const
 Calculate first derivative at curve and its extension.
 
virtual void _SecondDer (double t, MbVector &v) const
 Calculate second derivative at curve and its extension.
 
virtual void _ThirdDer (double t, MbVector &v) const
 Calculate third derivative at curve and its extension.
 
void _Tangent (double t, MbVector &v) const
 Calculate tangent vector (normalized).
 
void _Tangent (double t, MbDirection &d) const
 Calculate tangent vector (normalized).
 
void _Normal (double t, MbVector &v) const
 Calculate main normal vector (normalized) at curve and its extension.
 
void _Normal (double t, MbDirection &d) const
 Calculate main normal vector (normalized) at curve and its extension.
 
virtual void Explore (double &t, bool ext, MbCartPoint &pnt, MbVector &fir, MbVector *sec, MbVector *thir) const
 Calculate point and derivatives of object for given parameter. More...
 
Function of moving by curve
virtual double Step (double t, double sag) const
 Calculate parameter step. More...
 
virtual double DeviationStep (double t, double ang) const
 Calculate parameter step. More...
 
Common function of curve.
virtual double Curvature (double t) const
 Calculate curvature of curve.
 
double CurvatureDerive (double t) const
 Calculate derivative of curvature by parameter.
 
double CurvatureRadius (double t) const
 Calculate radius of curve with a sign.
 
virtual bool HasLength (double &length) const =0
 Calculate the metric length of a curve. More...
 
virtual bool IsBounded () const
 Define whether the curve is bounded.
 
virtual bool IsStraight (bool ignoreParams=false) const
 Define whether the curve is rectilinear..
 
virtual bool IsDegenerate (double eps=Math::LengthEps) const
 Define whether the curve is degenerate..
 
virtual bool IsSmoothConnected (double angleEps) const
 Define whether joints of contour/curve are smooth.
 
double GetParamLength () const
 Calculate the parametric length of a curve.
 
virtual double CalculateMetricLength () const
 Calculate the metric length of a curve.
 
virtual double CalculateLength (double t1, double t2) const
 Calculate the metric length of a curve. More...
 
virtual double GetMetricLength () const =0
 Calculate the metric length of a curve. More...
 
virtual bool DistanceAlong (double &t, double len, int curveDir, double eps=Math::LengthEps, VERSION version=Math::DefaultMathVersion()) const
 Translate parameter along the curve. More...
 
virtual void ResetTCalc () const
 Reset the current value of parameter.
 
virtual void Inverse (MbRegTransform *iReg=nullptr)=0
 Set the opposite direction of curve.
 
virtual MbCurveOffset (double rad) const
 Construct the equidistant curve which is shifted by the given value.
 
virtual bool BeginApprox (double sag, double &tbeg, double &tend, MbCartPoint &pnt, bool &existNextPoint) const
 Start approximation for the drawing. More...
 
virtual bool GetNextPoint (double sag, double tend, double &tcur, MbCartPoint &pnt) const
 Calculate the next point. More...
 
virtual void CalculatePolygon (double sag, MbPolygon &poligon) const
 Calculate an array of points for drawing. More...
 
MbNurbsNurbsCurve (const MbCurveIntoNurbsInfo *nInfo=nullptr) const
 Construct a NURBS copy of a curve. More...
 
virtual MbNurbsNurbsCurve (const MbCurveIntoNurbsInfo &nInfo) const =0
 Construct a NURBS copy of a curve. More...
 
virtual MbCurveNurbsCurve (const MbNurbsParameters &tParameters) const
 Construct a NURBS copy of a curve. More...
 
virtual MbCurveTrimmed (double t1, double t2, int sense, bool saveParamLenAndLaw=false) const
 Construct a trimmed curve. More...
 
virtual MbCurveTrimmed (double t1, double t2, int sense, const MbDimAccuracy &xyEps, bool saveParamLenAndLaw) const =0
 Construct a trimmed curve with the given two-dimensional accuracy. More...
 
virtual MbContourNurbsContour () const
 Approximate of a curve by the contour from NURBS curves.
 
virtual MbeState Deformation (const MbRect &rect, const MbMatrix &matr)
 Deform the curve. More...
 
virtual bool IsInRectForDeform (const MbRect &) const
 Determine visibility of a curve in rectangle.
 
virtual MbeState DeletePart (double t1, double t2, MbCurve *&part2)=0
 Delete the piece of a curve. More...
 
virtual MbeState TrimmPart (double t1, double t2, MbCurve *&part2)=0
 Keep the piece of a curve. More...
 
virtual MbeItemLocation PointRelative (const MbCartPoint &pnt, double eps=Math::LengthEps) const
 Define the point position relative to the curve. More...
 
virtual MbeLocation PointLocation (const MbCartPoint &pnt, double eps=Math::LengthEps) const
 The point position relative to the curve.
 
virtual double PointProjection (const MbCartPoint &pnt) const
 Calculate the point projection to the curve. More...
 
MbeNewtonResult PointProjectionNewton (const MbCartPoint &p, double xEpsilon, double yEpsilon, size_t iterLimit, double &t, bool ext) const
 Find the point projection to the curve. More...
 
virtual bool NearPointProjection (const MbCartPoint &pnt, double xEpsilon, double yEpsilon, double &t, bool ext, MbRect1D *tRange=nullptr) const
 Find the point projection to the curve. More...
 
void PointProjection (const MbCartPoint &pnt, MbCartPoint &on) const
 Calculate the point projection to the curve. More...
 
void BasePointProjection (const MbCartPoint &pnt, MbCartPoint &on) const
 Calculate the point projection to the curve. More...
 
void PointProjectionAndAngle (MbCartPoint &on, double &angle) const
 Calculate the point projection to the curve. More...
 
bool DirectPointProjection (const MbCartPoint &pnt, const MbDirection &dir, MbCartPoint &pp) const
 Calculate the point projection to the curve. More...
 
virtual bool SmallestPerpendicular (const MbCartPoint &pnt, double &tProj) const
 Find the nearest perpendicular to the curve. More...
 
virtual void TangentPoint (const MbCartPoint &pnt, SArray< double > &tFind) const
 Find tangents to a curve. More...
 
virtual void PerpendicularPoint (const MbCartPoint &pnt, SArray< double > &tFind) const
 Find perpendiculars to a curve. More...
 
virtual void IntersectHorizontal (double y, SArray< double > &cross) const
 Find intersections of a curve with horizontal line. More...
 
virtual void IntersectVertical (double x, SArray< double > &cross) const
 Find intersections of a curve with vertical line. More...
 
virtual void Isoclinal (const MbVector &angle, SArray< double > &tFind) const
 Construct isoclines. More...
 
void HorzIsoclinal (SArray< double > &tFind) const
 Construct horizontal isoclines. More...
 
void VertIsoclinal (SArray< double > &tFind) const
 Construct vertical isoclines. More...
 
void LowestPoint (MbCartPoint &lowestPoint, double &tLowest) const
 Find the lowest point of a curve and the corresponding parameter.
 
virtual void SelfIntersect (SArray< MbCrossPoint > &, double metricEps=Math::LengthEps) const
 Find self-intersections of curve. More...
 
virtual void OffsetCuspPoint (SArray< double > &tCusps, double dist) const
 Find the special points of an offset curve. More...
 
virtual bool GoThroughPoint (MbCartPoint &pnt)
 Create a curve through a point. More...
 
virtual bool GetMiddlePoint (MbCartPoint &) const
 Calculate a middle point of a curve.
 
virtual void GetStartPoint (MbCartPoint &) const
 Calculate a start point of a curve.
 
virtual void GetEndPoint (MbCartPoint &) const
 Calculate an end point of a curve.
 
virtual bool GetCentre (MbCartPoint &) const
 Calculate a center of curve.
 
virtual double GetRadius (double accuracy=PARAM_REGION) const
 Get the physical radius of the curve or zero if it impossible. More...
 
virtual bool GetAxisPoint (MbCartPoint &p) const
 Calculate a point to construct an axis. More...
 
virtual bool IsSimilarToCurve (const MbCurve &curve, double precision=PARAM_PRECISION) const
 Define whether the curves are similar for the merge.
 
virtual size_t GetCount () const
 Define the number of splittings for one passage in operations.
 
void GetPointsByEvenParamDelta (size_t n, std::vector< MbCartPoint > &pnts) const
 Get n points of a curve with equal intervals by parameter.
 
void GetPointsByEvenParamDelta (size_t n, SArray< MbCartPoint > &pnts) const
 
virtual void GetPointsByEvenLengthDelta (size_t n, std::vector< MbCartPoint > &pnts) const
 Get n points of a curve with equal intervals by arc length.
 
void GetPointsByEvenLengthDelta (size_t n, SArray< MbCartPoint > &pnts) const
 
virtual double LengthBetween2Points (MbCartPoint &p1, MbCartPoint &p2, MbCartPoint *pc=nullptr) const
 Calculate minimal length of a curve between two points on it. More...
 
virtual bool GetWeightCentre (MbCartPoint &) const
 Calculate the center of gravity of a curve.
 
bool IsPointOn (const MbCartPoint &, double eps=Math::LengthEps) const
 Check whether the point is on a curve with the tolerance eps.
 
bool IsParamOn (double t, double eps=Math::paramEpsilon) const
 Check whether the parameter is inside a range with the tolerance eps.
 
void CorrectCyclicParameter (double &t, double eps=Math::paramRegion) const
 Correct parameter for closed curves. More...
 
void CorrectParameter (double &t) const
 Correct parameter. More...
 
MbCurveInverseDuplicate () const
 Create a copy with changed direction.
 
bool IsInverseSame (const MbCurve &curve, double accuracy=LENGTH_EPSILON) const
 Define whether an inversed curve is the same.
 
virtual bool IsReparamSame (const MbCurve &curve, double &factor) const
 Define whether a reparameterized curve is the same. More...
 
MbCartPoint GetLimitPoint (ptrdiff_t number) const
 Calculate the boundary point. More...
 
void GetLimitPoint (ptrdiff_t number, MbCartPoint &pnt) const
 Calculate the boundary point. More...
 
void GetLimitTangent (ptrdiff_t number, MbVector &v) const
 Calculate a tangent vector to the boundary point. More...
 
void GetLimitPointAndTangent (ptrdiff_t number, MbCartPoint &pnt, MbVector &v) const
 Calculate a tangent vector and point at the end of a curve. More...
 
bool AreLimitPointsEqual () const
 Are boundary points equal? More...
 
virtual bool GetSpecificPoint (const MbCartPoint &from, double &dmax, MbCartPoint &pnt) const
 Return a specific point of a curve. More...
 
virtual const MbCurveGetBasisCurve () const
 Returns the base curve if exists or itself.
 
virtual MbCurveSetBasisCurve ()
 Returns the base curve if exists or itself.
 
virtual double GetParamDelta () const
 Return an indent by parameter of a curve.
 
virtual const MbCurveGetSubstrate () const
 Get a substrate or itself.
 
virtual MbCurveSetSubstrate ()
 Get a substrate or itself.
 
virtual int SubstrateCurveDirection () const
 Return direction of a substrate relative to a curve or vice versa.
 
virtual void SubstrateToCurve (double &) const
 Transform a substrate parameter to the curve parameter.
 
virtual void CurveToSubstrate (double &) const
 Transform a curve parameter to the substrate parameter.
 
virtual double GetLengthEvaluation () const
 Calculate the metric length of a curve. More...
 
virtual double GetParamToUnit () const
 Return increment of parameter, corresponding to the unit length in space.
 
virtual double GetParamToUnit (double t) const
 Return increment of parameter, corresponding to the unit length in space according to parameter.
 
virtual double GetTEpsilon (double epsilon) const
 Return the minimal discernible value of parameter with the given tolerance.
 
virtual double GetTEpsilon (double t, double epsilon) const
 Return the minimal discernible value of parameter with the given tolerance according to parameter.
 
virtual double GetTRegion (double epsilon) const
 Return the minimal discernible value of parameter with the given tolerance.
 
virtual double GetTRegion (double t, double epsilon) const
 Return the minimal discernible value of parameter with the given tolerance according to parameter.
 
virtual double GetTRegion (double t, const MbDimAccuracy &xyEps) const
 Return the minimal discernible value of parameter with the given two-dimensinal accuracy according to parameter. The method takes into account the direction of the curve at a point.
 
double GetTMid () const
 Return the middle of parametric range of a curve.
 
double GetTRange () const
 Return the parametric length of a curve.
 
MbCartPoint PointOn (double &t) const
 Calculate point on the curve.
 
MbVector FirstDer (double &t) const
 Calculate first derivative.
 
MbDirection Tangent (double &t) const
 Calculate tangent vector (normalized).
 
MbDirection Normal (double &t) const
 Calculate the normal vector.
 
double DerLength (double &t) const
 Calculate the length of derivative vector.
 
virtual void GetAnalyticalFunctionsBounds (std::vector< double > &params) const
 Get the boundaries of the curve sections that are described by one analytical function. More...
 
virtual void BreakPoints (std::vector< double > &vBreaks, double precision=ANGLE_REGION) const
 \ ru Определение точек излома кривой. The determination of curve smoothness break points.
 
MbPropertyCreateProperty (MbePrompt name) const override
 Create a custom property.
 
virtual bool IsContinuousDerivative (bool &contLength, bool &contDirect, c3d::DoubleVector *params=nullptr, double epsilon=EPSILON) const
 Get properties of the object. More...
 
virtual bool SetContinuousDerivativeLength (VERSION version, double epsilon=EPSILON)
 Eliminate the discontinuities of the first derivative at length. More...
 
bool IsSpaceNear (const MbCurve &curve, double eps, bool ext, double devSag=5.0 *Math::deviateSag) const
 Check whether the two curves are metrically close. More...
 
bool IsSpaceNear (const MbCurve &curve, double xEps, double yEps, bool ext, double xNear, double yNear, double devSag=5.0 *Math::deviateSag) const
 Check whether the two curves are metrically close. More...
 
SimpleName GetCurveName () const
 A curve name.
 
void SetCurveName (SimpleName newName)
 Set a curve name.
 
- Public Member Functions inherited from MbPlaneItem
virtual ~MbPlaneItem ()
 Destructor.
 
void PrepareWrite () const
 Object registration. More...
 
MbeRefType RefType () const override
 Get the registration type (for copying, duplication).
 
virtual MbePlaneType IsA () const =0
 Get the object type.
 
virtual MbPlaneItemDuplicate (MbRegDuplicate *iReg=nullptr) const =0
 Create a copy. More...
 
virtual void Transform (const MbMatrix &matr, MbRegTransform *iReg=nullptr, const MbSurface *newSurface=nullptr)=0
 Transform according to the matrix. More...
 
virtual void Move (const MbVector &to, MbRegTransform *iReg=nullptr, const MbSurface *newSurface=nullptr)=0
 Translate along a vector. More...
 
virtual void Rotate (const MbCartPoint &pnt, const MbDirection &angle, MbRegTransform *iReg=nullptr, const MbSurface *newSurface=nullptr)=0
 Rotate about a point. More...
 
virtual void Rotate (const MbCartPoint &pnt, double angle, MbRegTransform *iReg=nullptr, const MbSurface *newSurface=nullptr)
 Rotate about a point. More...
 
virtual bool IsSame (const MbPlaneItem &item, double accuracy=LENGTH_EPSILON) const =0
 Determine whether objects are equal. More...
 
virtual bool IsSimilar (const MbPlaneItem &item) const
 Determine whether the objects are similar. More...
 
virtual bool SetEqual (const MbPlaneItem &item)=0
 Make the objects equal. More...
 
virtual void AddYourGabaritTo (MbRect &r) const =0
 Extend the given bounding rectangle so that it encloses this object.
 
virtual void GetProperties (MbProperties &properties)=0
 Get properties of the object. More...
 
virtual void SetProperties (const MbProperties &properties)=0
 Change properties of the object. More...
 
virtual void GetBasisPoints (MbControlData &) const =0
 Get control points of object.
 
virtual void SetBasisPoints (const MbControlData &)=0
 Change the object by control points.
 
- Public Member Functions inherited from TapeBase
 TapeBase (RegistrableRec regs=noRegistrable)
 Constructor.
 
 TapeBase (const TapeBase &)
 Copy-constructor.
 
virtual ~TapeBase ()
 Destructor.
 
RegistrableRec GetRegistrable () const
 Whether the stream class is registrable.
 
void SetRegistrable (RegistrableRec regs=registrable) const
 Set the state of registration of the stream class.
 
virtual const char * GetPureName (const VersionContainer &) const
 Get the class name.
 
virtual bool IsFamilyRegistrable () const
 Whether the object belongs to a registrable family.
 
- Public Member Functions inherited from MbRefItem
refcount_t GetUseCount () const
 Get count of references (get count of owners of an object).
 
refcount_t AddRef () const
 Increase count of references by one.
 
refcount_t DecRef () const
 Decrease count of references by one.
 
refcount_t Release () const
 Decrease count of references by one and if count of references became zero, then remove itself.
 
- Public Member Functions inherited from MbNestSyncItem
void Lock () const
 Switch lock on (locking happens only in parallel region).
 
void Unlock () const
 Switch lock off if locking has been set.
 
CommonRecursiveMutexGetLock () const
 Get a pointer to the mutex object. Return nullptr if no parallelism. For use in ScopedLock.
 

Protected Member Functions

 MbCurve ()
 Default constructor.
 
 MbCurve (const MbCurve &other)
 Copy-constructor.
 
- Protected Member Functions inherited from MbPlaneItem
 MbPlaneItem ()
 Constructor.
 
- Protected Member Functions inherited from MbRefItem
 MbRefItem ()
 Constructor without parameters.
 

Protected Attributes

SimpleName name
 A curve name. The object data is temporary and used internally.
 

Detailed Description

Curve in two-dimensional space.

A curve in two-dimensional space is a vector function of a scalar parameter, given on a finite one-dimensional space. A curve is continuous mapping of some piece of numeric axis to two-dimensional space.
Two-dimensional curve is used:
for planar modeling,
for description of surface parameters domain,
for construction of curves on surfaces,
for constructing of surfaces intersection curves.
Normal vector to a curve is perpendicular to tangent.
To calculate the direction of normal according curvature, multiply this normal vector by the curvature sign.

Member Function Documentation

◆ PrepareIntegralData()

virtual void MbCurve::PrepareIntegralData ( const bool  forced) const
virtual

Calculate temporary (mutable) data of an object.

Calculate the temporary data of an object depending of the "forced" parameter. Calculate only data that was not calculated earlier if parameter "forced" is equal false. Recalculate all temporary data of an object if parameter "forced" is equal true.

Parameters
[in]forced- Forced recalculation.

Reimplemented in MbTrimmedCurve, MbReparamCurve, MbProjCurve, MbPolyCurve, MbOffsetCurve, MbCosinusoid, MbContour, MbCharacterCurve, and MbArc.

◆ AddYourGabaritMtr()

virtual void MbCurve::AddYourGabaritMtr ( MbRect rect,
const MbMatrix matr 
) const
virtual

Add a bounding box to rectangle.

Add a bounding box to rectangle with taking into account of transformation matrix. If the transformation matrix is not an identity matrix then there is performed a transformation of object's copy by the matrix and after that a bounding box of the transformed object is added to rectangle. A copy is destroyed after using.

Parameters
[out]rect- A rectangle with information about bounds.
[in]matr- Transformation matrix.

Reimplemented in MbLine.

◆ CalculateGabarit()

virtual void MbCurve::CalculateGabarit ( MbRect ) const
virtual

Detect the bounding box of a curve.

The sent rectangle becomes empty for getting a bounding box. Then bounding boxes of an object are calculated and saved into a rectangle 'rect'.

Reimplemented in MbHermit, MbCosinusoid, MbArc, MbTrimmedCurve, MbReparamCurve, MbProjCurve, MbPolyline, MbOffsetCurve, MbNurbs, MbLineSegment, MbLine, MbContour, MbCharacterCurve, and MbBezier.

◆ CalculateLocalGabarit()

virtual void MbCurve::CalculateLocalGabarit ( const MbMatrix into,
MbRect local 
) const
virtual

Calculate bounding box in the local coordinate system.

For getting a bounding box of an object relatively to the local coordinate system, a sent rectangle becomes empty. After that bounding boxes of an object in the local coordinate system are calculated and saved in a rectangle 'rect'.

Parameters
[in]matr- A transition matrix from the current coordinate system of the object to the local coordinate system.
[out]rect- A rectangle with information about bounds.

Reimplemented in MbPolyline, MbPointCurve, MbLineSegment, MbLine, MbContour, and MbProjCurve.

◆ IsVisibleInRect()

bool MbCurve::IsVisibleInRect ( const MbRect rect,
bool  exact = false 
) const
overridevirtual

Determine visibility of an object in rectangle.

Determine whether an object is visible in the given rectangle. There is a possibility to perform a fast check or more thorough check when the second parameter has a corresponding value.

Parameters
[in]rect- A given two-dimensional rectangle.
[in]exact- Whether to perform a more thorough check.
Returns
true, if the object is fully or partially contained in the rectangle, otherwise false.

Implements MbPlaneItem.

◆ IsCompleteInRect()

virtual bool MbCurve::IsCompleteInRect ( const MbRect rect) const
virtual

Determine whether an object is fully visible in rectangle.

An object is fully contained in the given rectangle if its bounding rectangle is included in the given rectangle.

Parameters
[in]rect- Rectangle to check inclusion to.
Returns
true, if the object is fully contained in the rectangle, otherwise false.

Reimplemented in MbReparamCurve, MbLineSegment, and MbArc.

◆ DistanceToPointIfLess()

bool MbCurve::DistanceToPointIfLess ( const MbCartPoint to,
double &  d 
) const
overridevirtual

Calculate the distance to a point.

Calculate distance to object from a given point near the object. Distance is calculated and stored to 'd' variable if it is less then initial value of 'd'. There can be performance benefit in comparison with DistanceToPoint function due to primarily checking the distance from point to bounding box and performing the further calculations only if this distance is not greater than the given one.

Parameters
[in]to- Point.
[in,out]d- Specified distance from object on input. Distance from point to object on output if operation succeeded.
Returns
True if distance from point to the object is less than the given one, otherwise false. Calculate the distance from a point and change the given value of distance if the distance is less than the given one.

Implements MbPlaneItem.

◆ IsClosed()

virtual bool MbCurve::IsClosed ( ) const
pure virtual

Define whether the curve is periodic.

Define whether the curve is periodic.
A periodic curve is closed. A curve is considered as periodic if:

  • start point is coincident with end point;
  • derivatives in start point and end point coincide;
    if there are breaks at curve (in cases when a curve is contour or polyline), then derivatives may not coincide; in Bezier curve derivatives should coincide by direction, but they may differ by absolute value.
    Curves:
  • MbLine,
  • MbLineSegment,
  • MbCosinusoid,
  • MbContour (if it contains only a single segment of one of the listed types)
    are not considered periodic when the start and end points coincide. The IsClosed() method always returns false for them.
    Returns
    True if a curve is closed.

Implemented in MbTrimmedCurve, MbReparamCurve, MbProjCurve, MbPolyCurve, MbPointCurve, MbOffsetCurve, MbNurbs, MbLineSegment, MbLine, MbCosinusoid, MbContour, MbCharacterCurve, and MbArc.

◆ GetPeriod()

virtual double MbCurve::GetPeriod ( ) const
virtual

Return period.

Return the period value if a curve can be closed. Let unclosed curve return null.

Returns
The value of period for a closed curve or null - for unclosed curve.

Reimplemented in MbTrimmedCurve, MbReparamCurve, MbProjCurve, MbOffsetCurve, and MbArc.

◆ IsPeriodic()

virtual bool MbCurve::IsPeriodic ( ) const
virtual

Define whether the curve is periodic.

Define whether the curve is periodic.
A curve is considered as periodic if:

  • start point is coincident with end point;
  • derivatives in start point and end point coincide;
    if there are breaks at curve (in cases when a curve is contour or polyline), then derivatives may not coincide; in Bezier curve derivatives should coincide by direction, but they may differ by absolute value.
    Curves:
  • MbLine,
  • MbLineSegment,
  • MbCosinusoid,
  • MbContour (if it contains only a single segment of one of the listed types)
    are not considered periodic when the start and end points coincide. The IsPeriodic() method always returns false for them.
    Returns
    True if a curve is closed.

Reimplemented in MbNurbs.

◆ IsTouch()

bool MbCurve::IsTouch ( double  eps = Math::LengthEps) const
inline

Determine whether a curve is closed regardless of the smoothness of the closure.

Determine whether a curve is actually closed regardless of the smoothness of the closure.

◆ Step()

virtual double MbCurve::Step ( double  t,
double  sag 
) const
virtual

Calculate parameter step.

Calculate parameter step for the curve's approximation by its sag value. Calculation of the step is performed with consideration of curvature radius. A step of curve's approximation is chosen in such way, that the deviation of a curve from its polygon does not exceed the given sag value.

Parameters
[in]t- A parameter defining the point on a curve, at which a step should be calculated.
[in]sag- Maximum feasible sag value.
Returns
A sag value by parameter at given point.

Reimplemented in MbTrimmedCurve, MbReparamCurve, MbProjCurve, MbPolyline, MbPointCurve, MbOffsetCurve, MbNurbs, MbLineSegment, MbLine, MbHermit, MbCubicSpline, MbCosinusoid, MbContour, MbCharacterCurve, MbBezier, and MbArc.

◆ DeviationStep()

virtual double MbCurve::DeviationStep ( double  t,
double  ang 
) const
virtual

Calculate parameter step.

Calculate parameter step for the curve's approximation by the deviation angle of the tangent vector. A step of curve's approximation is chosen in such way, that angular deviation of the tangent curve at the next point does not exceed the given value ang.

Parameters
[in]t- A parameter defining the point on a curve, at which a step should be calculated.
[in]ang- The maximum feasible deviation angle of tangent.
Returns
A sag value by parameter at given point.

Reimplemented in MbTrimmedCurve, MbProjCurve, MbPolyline, MbPointCurve, MbOffsetCurve, MbNurbs, MbLineSegment, MbLine, MbHermit, MbCubicSpline, MbCosinusoid, MbContour, MbBezier, MbArc, MbCharacterCurve, and MbReparamCurve.

◆ HasLength()

virtual bool MbCurve::HasLength ( double &  length) const
pure virtual

Calculate the metric length of a curve.

Calculate the metric length of a curve and save the result in the variable 'length'.

Parameters
[in,out]length- Calculated length of a curve.
Returns
True - if the length of a curve differs from null. Otherwise returns false.

Implemented in MbTrimmedCurve, MbReparamCurve, MbPolyCurve, MbPointCurve, MbOffsetCurve, MbLineSegment, MbCosinusoid, MbCharacterCurve, MbArc, MbProjCurve, MbLine, and MbContour.

◆ CalculateLength()

virtual double MbCurve::CalculateLength ( double  t1,
double  t2 
) const
virtual

Calculate the metric length of a curve.

Calculate the metric length of unclosed curve from parameter t1 to parameter t2. The condition t1 < t2 should satisfied.

Parameters
[in]t1- Start parameter of a curve section.
[in]t2- End parameter of a curve section.
Returns
Length of a curve.

Reimplemented in MbReparamCurve, MbProjCurve, MbPolyline, MbNurbs, MbLineSegment, MbContour, and MbArc.

◆ GetMetricLength()

virtual double MbCurve::GetMetricLength ( ) const
pure virtual

Calculate the metric length of a curve.

If a length of a curve is already calculated and saved in the object then this function returns the existing result, without repeating of calculations. Otherwise the length is calculated by the function CalculateMetricLength().

Returns
Length of a curve.

Implemented in MbTrimmedCurve, MbReparamCurve, MbProjCurve, MbPolyCurve, MbPointCurve, MbOffsetCurve, MbLineSegment, MbLine, MbCosinusoid, MbContour, MbCharacterCurve, and MbArc.

◆ DistanceAlong()

virtual bool MbCurve::DistanceAlong ( double &  t,
double  len,
int  curveDir,
double  eps = Math::LengthEps,
VERSION  version = Math::DefaultMathVersion() 
) const
virtual

Translate parameter along the curve.

Translate parameter along the curve by the given distance at the given direction. The new value of parameter is saved in the variable t. If the curve is not closed and the length of its part from the point with parameter t to the end at the given direction is less than the required shift, then calculations are performed on extension of the curve, if it possible to construct such extension.

Parameters
[in,out]t- Input - the initial value of parameter. Output - the new value of parameter.
[in]len- The value of shift along the curve.
[in]curveDir- The offset direction. If curveDir is non-negative, then the shift is directed to the side of increasing of parameter. Otherwise - to the side of decreasing of parameter.
[in]eps- Computational tolerance.
[in]version- Version.
Returns
True - if the operation is performed successfully, otherwise false.

Reimplemented in MbOffsetCurve, MbReparamCurve, MbPolyline, MbNurbs, MbLineSegment, MbLine, MbHermit, MbCubicSpline, MbContour, MbBezier, and MbArc.

◆ BeginApprox()

virtual bool MbCurve::BeginApprox ( double  sag,
double &  tbeg,
double &  tend,
MbCartPoint pnt,
bool &  existNextPoint 
) const
virtual

Start approximation for the drawing.

Parameters of start and end of approximated part of a curve are checked and corrected this is necessary. There is calculated a first point corresponding to start parameter. There is defined whether it is possible to calculate the next point. The next points are calculated by the function GetNextPoint.

Parameters
[in]sag- Maximal value of sag.
[in,out]tbeg- Parameter corresponding to start of approximated part of a curve.
[in,out]tend- Parameter corresponding to end of approximated part of a curve.
[in,out]pnt- A calculated point.
[in,out]existNextPoint- Flag showing whether the next point should be calculated (true by default) or calculated point corresponds to the end of approximated curve.
Returns
True - if the operation is performed successfully, otherwise false.

◆ GetNextPoint()

virtual bool MbCurve::GetNextPoint ( double  sag,
double  tend,
double &  tcur,
MbCartPoint pnt 
) const
virtual

Calculate the next point.

This function is used for the calculation of curve's approximation after call of the function BeginApprox. In this function a parameter for calculation of the next point of the polygon is defined, a point is calculated and there is defined whether it is an end point.

Parameters
[in]sag- Maximal value of sag.
[in]tend- Parameter corresponding to end of approximated part of a curve.
[in,out]tcur- Input - the value of parameter at the last calculated point. Output - parameter corresponding to the new calculated point.
[in,out]pnt- A calculated point.
Returns
True - if the further calculations are required. false - if the calculated point corresponds to the end of approximated curve.

◆ CalculatePolygon()

virtual void MbCurve::CalculatePolygon ( double  sag,
MbPolygon poligon 
) const
virtual

Calculate an array of points for drawing.

Get an array of drawn points with a given sag. If the cure is a contour then knots of a contour are duplicated.

Parameters
[in]sag- Maximal value of sag.
[in,out]poligon- A polygon of calculated points on a curve.

Reimplemented in MbNurbs.

◆ NurbsCurve() [1/3]

MbNurbs* MbCurve::NurbsCurve ( const MbCurveIntoNurbsInfo nInfo = nullptr) const

Construct a NURBS copy of a curve.

Constructs a NURBS copy which approximates a given curve. If it is possible, constructs the accurate curve, perhaps with multiple knots. The number of knots for NURBS is defined depending on the curve.

Parameters
[in,out]nurbs- A constructed NURBS-curve.
[in]nInfo- Parameters of conversion of a curve to NURBS.
Returns
The constructed NURBS curve or nullptr in a case of failure.

◆ NurbsCurve() [2/3]

virtual MbNurbs* MbCurve::NurbsCurve ( const MbCurveIntoNurbsInfo nInfo) const
pure virtual

Construct a NURBS copy of a curve.

Constructs a NURBS curve which approximates a given curve inside the range [t1, t2]. with a given direction. If it is possible, constructs the accurate curve, perhaps with multiple knots. The number of knots for NURBS is defined depending on the curve.

Parameters
[in,out]nurbs- A constructed NURBS-curve.
[in]t1- Parameter corresponding to start of approximated part of a curve.
[in]t2- Parameter corresponding to end of approximated part of a curve.
[in]sense- Does the direction of parameter increasing along the NURBS curve coincide with direction of the initial curve. 'sense' > 0 - direction coincide.
[in]nInfo- Parameters of conversion of a curve to NURBS.
Returns
The constructed NURBS curve or nullptr in a case of failure.

Implemented in MbTrimmedCurve, MbReparamCurve, MbProjCurve, MbPolyline, MbPointCurve, MbOffsetCurve, MbNurbs, MbLineSegment, MbLine, MbHermit, MbCubicSpline, MbCosinusoid, MbContour, MbCharacterCurve, MbBezier, and MbArc.

◆ NurbsCurve() [3/3]

virtual MbCurve* MbCurve::NurbsCurve ( const MbNurbsParameters tParameters) const
virtual

Construct a NURBS copy of a curve.

Constructs a NURBS curve which approximates a given curve with the given parameters. In parameters the degree and the number of knots of a spline and the range of curve's parameters changing may be set. If the flag of accurate approximation is not set in parameters then NURBS without multiple knots is constructed.

Parameters
[in]tParameters- Parameters for the construction of a NURBS copy of the curve.
Returns
The constructed NURBS curve or nullptr in a case of failure.

Reimplemented in MbNurbs, MbTrimmedCurve, MbReparamCurve, MbPolyline, MbPointCurve, MbLineSegment, MbLine, MbHermit, MbCubicSpline, MbBezier, and MbArc.

◆ Trimmed() [1/2]

virtual MbCurve* MbCurve::Trimmed ( double  t1,
double  t2,
int  sense,
bool  saveParamLenAndLaw = false 
) const
virtual

Construct a trimmed curve.

Constructs a trimmed curve, a start point of which corresponds to a point with parameter t1 and an end point corresponds to a point with parameter t2. Direction of the constructed curve relative to the initial curve may be changed by the parameter 'sense'. If the curve is closed, then there may be obtained a trimmed curve, passing through the start of a curve.
In a case of closed curve (or for an arc - exception) three parameters 'sense', t1 and t2 clearly define the result. In a case of unclosed curve the parameter 'sense' and parameter of trimming should correspond each other:
1) if sense == 1, then t1 < t2,
2) if sense == -1, then t1 > t2,
If there is a discrepancy between 'sense' and parameters of trimming, then 'sense' parameter has higher priority. If parameters t1 and t2 are equal and the curve is closed, then in result a closed curve should be obtained.

Parameters
[in]t1- Parameter corresponding to start of a trimmed curve.
[in]t2- Parameter corresponding to end of a trimmed curve.
[in]sense- Direction of a trimmed curve in relation to an initial curve. sense = 1 - direction does not change. sense = -1 - direction changes to the opposite value.
[in]saveParLenAndLaw- Save parametric length and law.
Returns
A constructed trimmed curve.

Reimplemented in MbProjCurve.

◆ Trimmed() [2/2]

virtual MbCurve* MbCurve::Trimmed ( double  t1,
double  t2,
int  sense,
const MbDimAccuracy xyEps,
bool  saveParamLenAndLaw 
) const
pure virtual

Construct a trimmed curve with the given two-dimensional accuracy.

Constructs a trimmed curve, a start point of which corresponds to a point with parameter t1 and an end point corresponds to a point with parameter t2. Direction of the constructed curve relative to the initial curve may be changed by the parameter 'sense'. If the curve is closed, then there may be obtained a trimmed curve, passing through the start of a curve.
In a case of closed curve (or for an arc - exception) three parameters 'sense', t1 and t2 clearly define the result. In a case of unclosed curve the parameter 'sense' and parameter of trimming should correspond each other:
1) if sense == 1, then t1 < t2,
2) if sense == -1, then t1 > t2,
If there is a discrepancy between 'sense' and parameters of trimming, then 'sense' parameter has higher priority. If parameters t1 and t2 are equal and the curve is closed, then in result a closed curve should be obtained.

Parameters
[in]t1- Parameter corresponding to start of a trimmed curve.
[in]t2- Parameter corresponding to end of a trimmed curve.
[in]sense- Direction of a trimmed curve in relation to an initial curve. sense = 1 - direction does not change. sense = -1 - direction changes to the opposite value.
[in]xyEps- Two-dimensional accuracy. It is used for estimations near the points corresponding to the parameters t1 and t2.
[in]saveParLenAndLaw- Save parametric length and law.
Returns
A constructed trimmed curve.
Warning
Under development.

Implemented in MbTrimmedCurve, MbReparamCurve, MbProjCurve, MbPolyline, MbPointCurve, MbOffsetCurve, MbNurbs, MbLineSegment, MbLine, MbHermit, MbCubicSpline, MbCosinusoid, MbContour, MbCharacterCurve, MbBezier, and MbArc.

◆ Deformation()

virtual MbeState MbCurve::Deformation ( const MbRect rect,
const MbMatrix matr 
)
virtual

Deform the curve.

If the bounding rectangle of a curve intersects the given one, then the curve is transformed according to the matrix with a help of 'Transform' function.

Parameters
[in]rect- A rectangle, in which the visibility of a curve is checked.
[in]matr- A deformation matrix.
Returns
A state of a curve after deformation.

Reimplemented in MbReparamCurve, MbPolyCurve, MbOffsetCurve, MbNurbs, MbLineSegment, MbContour, MbBezier, and MbArc.

◆ DeletePart()

virtual MbeState MbCurve::DeletePart ( double  t1,
double  t2,
MbCurve *&  part2 
)
pure virtual

Delete the piece of a curve.

Delete a part of a curve between parameters t1 and t2. If the curve is split into two parts after deletion, then the initial object corresponds to the start part of a curve, and parameter 'part2' contains the end part of a curve. If the curve remained simply connected, then only the initial object changes.

Parameters
[in]t1- Start parameter of trimming.
[in]t2- End parameter of trimming.
[in,out]part2- The end part of a curve after deletion, if an initial curve is split into parts. It may be the only part after deletions, \ if the curve did not change (e. g. for a curve of MbLine type), in this case the returned value is dp_Degenerated.
Returns
A state of a curve after modification.

Implemented in MbCubicSpline, MbTrimmedCurve, MbReparamCurve, MbProjCurve, MbPolyline, MbPointCurve, MbOffsetCurve, MbNurbs, MbLineSegment, MbLine, MbHermit, MbCosinusoid, MbContour, MbCharacterCurve, MbBezier, and MbArc.

◆ TrimmPart()

virtual MbeState MbCurve::TrimmPart ( double  t1,
double  t2,
MbCurve *&  part2 
)
pure virtual

Keep the piece of a curve.

Leave a part of a curve between parameters t1 and t2.
In a case of success the returned value equals dp_Changed and a curve satisfies to the next conditions:

  • if an initial curve is closed then the start point of a trimmed curve should correspond to the parameter t1, the end point - to the parameter t2,
  • if an initial curve is not closed then the start point of a trimmed curve should correspond to the minimum parameter from t1 and t2, the end point - to the maximum one.
    Parameters
    [in]t1- Start parameter of trimming.
    [in]t2- End parameter of trimming.
    [in,out]part2- This may be filled by a result of trimming if the curve was not changed. In this case the returned value is dp_Degenerated. Otherwise nullptr is returned.
    Returns
    A state of a curve after modification:
    dp_Degenerated - the curve is degenerated and there are possible three cases: the curve was not changed, because it would degenerate in a result of transformation, or it it was not changed and the result of trimming is 'part2',
    dp_NoChanged - the curve was not changes,
    dp_Changed - the curve is changed.
    Warning
    The function is designed for internal use only.

Implemented in MbCubicSpline, MbTrimmedCurve, MbReparamCurve, MbProjCurve, MbPolyline, MbPointCurve, MbOffsetCurve, MbNurbs, MbLineSegment, MbLine, MbHermit, MbCosinusoid, MbContour, MbCharacterCurve, MbBezier, and MbArc.

◆ PointRelative()

virtual MbeItemLocation MbCurve::PointRelative ( const MbCartPoint pnt,
double  eps = Math::LengthEps 
) const
virtual

Define the point position relative to the curve.

There is defined on which side from a curve the point is located, by the positive direction of a curve.

Parameters
[in]pnt- A given point.
[in]eps- A tolerance of detection.
Returns
Iloc_InItem = 1 - if the point is on the left from a curve,
iloc_OnItem = 0 - if the point is on a curve,
iloc_OutOfItem = 1 - if the point is on the right from a curve.

Reimplemented in MbTrimmedCurve, MbReparamCurve, MbPolyline, MbPointCurve, MbLineSegment, MbContour, MbArc, and MbLine.

◆ PointProjection() [1/2]

virtual double MbCurve::PointProjection ( const MbCartPoint pnt) const
virtual

Calculate the point projection to the curve.

Calculate the parameter of the curve corresponding to the projection of the given point on this curve.
This function does not allow the parameter to go beyond the parametric domain of the definition of an unclosed curve, unlike the NearPointProjection function.

Parameters
[in]pnt- A given point.
Returns
The found parameter for the projection of a point onto the curve.

Reimplemented in MbCubicSpline, MbTrimmedCurve, MbProjCurve, MbPointCurve, MbNurbs, MbLineSegment, MbHermit, MbCosinusoid, MbArc, MbReparamCurve, MbPolyline, MbLine, and MbContour.

◆ PointProjectionNewton()

MbeNewtonResult MbCurve::PointProjectionNewton ( const MbCartPoint p,
double  xEpsilon,
double  yEpsilon,
size_t  iterLimit,
double &  t,
bool  ext 
) const

Find the point projection to the curve.

Find the point projection to the curve or its extension by the Newton method with the given initial approximation.

Parameters
[in]p- A given point.
[in]xEpsilon- A tolerance of detection of the projection by x axis.
[in]yEpsilon- A tolerance of detection of the projection by y axis.
[in]iterLimit- The maximum number of iterations.
[in]t- Input - initial approximation, output - parameter of a curve, corresponding to the nearest projection.
[in]ext- A flag defining whether to seek projection on the extension of the curve.
Returns
The result of the iterative method.

◆ NearPointProjection()

virtual bool MbCurve::NearPointProjection ( const MbCartPoint pnt,
double  xEpsilon,
double  yEpsilon,
double &  t,
bool  ext,
MbRect1D tRange = nullptr 
) const
virtual

Find the point projection to the curve.

Find the nearest projection of a point on a curve (in the range of the curve) or on its continuation by the given initial approximation. If the parameter ext = true, then also search for a projection on the continuation of the curve. If the range of change of the 'tRange' parameter is specified, then find the projection in the specified range. A range of parameter may not belong to the domain of a curve. The Newton method is used.

Note
Mathematical kernel provides a thread-safe function implementation for its objects.
Parameters
[in]pnt- A given point.
[in]xEpsilon- A tolerance of detection of the projection by x axis.
[in]yEpsilon- A tolerance of detection of the projection by y axis.
[in,out]t- Input - initial approximation, output - parameter of a curve corresponding to the nearest projection.
[in]ext- A flag defining whether to seek projection on the extension of the curve.
[in]tRange- A range of parameter changing in which the solution should be found.
Returns
Returns true if the found parameter is in a valid range (according to the given ext, tRange parameters), or false - otherwise.

Reimplemented in MbReparamCurve, MbProjCurve, MbPointCurve, MbNurbs, MbLineSegment, MbLine, MbHermit, MbCosinusoid, MbArc, and MbContour.

◆ PointProjection() [2/2]

void MbCurve::PointProjection ( const MbCartPoint pnt,
MbCartPoint on 
) const
inline

Calculate the point projection to the curve.

Calculate the point on the curve corresponding to the projection of the given point on this curve.

Parameters
[in]pnt- A given point.
[in,out]on- The required point - projection.

◆ BasePointProjection()

void MbCurve::BasePointProjection ( const MbCartPoint pnt,
MbCartPoint on 
) const

Calculate the point projection to the curve.

Calculate the point on the curve corresponding to the projection of the given point on this curve. If a curve is trimmed then a projection to the base curve is calculated.

Parameters
[in]pnt- A given point.
[in,out]on- The required point - projection.

◆ PointProjectionAndAngle()

void MbCurve::PointProjectionAndAngle ( MbCartPoint on,
double &  angle 
) const
inline

Calculate the point projection to the curve.

Calculate the point on the curve corresponding to the projection of the given point on this curve. Additionally returns an inclination angle of a tangent to the axis OX at the point of projection.

Parameters
[in,out]on- Input - an initial point. Output - a projection point on a curve.
[in,out]angle- A calculated inclination angle of a curve to the axis OX.

◆ DirectPointProjection()

bool MbCurve::DirectPointProjection ( const MbCartPoint pnt,
const MbDirection dir,
MbCartPoint pp 
) const

Calculate the point projection to the curve.

Calculate the nearest point of intersection between a curve and a ray from the given point 'pntp by the direction 'dir'. We consider the points lying over the starting point pnt beam at a distance exceeding Math :: paramEpsilon.

Parameters
[in]pnt- A given point.
[in]dir- A given direction.
[in,out]pp- Required point on the curve.

◆ SmallestPerpendicular()

virtual bool MbCurve::SmallestPerpendicular ( const MbCartPoint pnt,
double &  tProj 
) const
virtual

Find the nearest perpendicular to the curve.

Find the nearest perpendicular to the curve from the given point. In this function perpendiculars to an extension of a curve are not considered.

Parameters
[in]pnt- A given point.
[in,out]tProj- Parameter on a curve, corresponding to the point on a curve, which the perpendicular is passed through.
Returns
True if the required perpendicular is constructed.

Reimplemented in MbReparamCurve, and MbArc.

◆ TangentPoint()

virtual void MbCurve::TangentPoint ( const MbCartPoint pnt,
SArray< double > &  tFind 
) const
virtual

Find tangents to a curve.

Find all tangents to a curve from the given point. A point may belong to a curve. In this function a curve without extensions is considered.

Parameters
[in]pnt- A given point.
[in,out]tFind- An array of parameters of a curve, corresponding to the tangent points.

Reimplemented in MbReparamCurve, MbNurbs, MbBezier, MbArc, and MbContour.

◆ PerpendicularPoint()

virtual void MbCurve::PerpendicularPoint ( const MbCartPoint pnt,
SArray< double > &  tFind 
) const
virtual

Find perpendiculars to a curve.

Find all perpendiculars to a curve from the given point. In this function a curve without extensions is considered.

Parameters
[in]pnt- A given point.
[in,out]tFind- An array of parameter on a curve, corresponding to the points on a curve, which the perpendiculars are passed through.

Reimplemented in MbReparamCurve, MbLineSegment, MbLine, MbArc, and MbContour.

◆ IntersectHorizontal()

virtual void MbCurve::IntersectHorizontal ( double  y,
SArray< double > &  cross 
) const
virtual

Find intersections of a curve with horizontal line.

Find intersections of a curve with horizontal line.

Parameters
[in]y- An ordinate of points of a horizontal line.
[in,out]cross- An array of parameters of a curve corresponding to the intersection points.

Reimplemented in MbPointCurve, MbLineSegment, MbLine, MbCosinusoid, MbArc, MbReparamCurve, MbPolyline, MbHermit, MbCubicSpline, and MbContour.

◆ IntersectVertical()

virtual void MbCurve::IntersectVertical ( double  x,
SArray< double > &  cross 
) const
virtual

Find intersections of a curve with vertical line.

Find intersections of a curve with vertical line.

Parameters
[in]x- An abscissa of points of a vertical line.
[in,out]cross- An array of parameters of a curve corresponding to the intersection points.

Reimplemented in MbPointCurve, MbLineSegment, MbLine, MbCosinusoid, MbArc, MbReparamCurve, MbPolyline, MbHermit, MbCubicSpline, and MbContour.

◆ Isoclinal()

virtual void MbCurve::Isoclinal ( const MbVector angle,
SArray< double > &  tFind 
) const
virtual

Construct isoclines.

Construct lines at an angle to the axis OX and tangent to the curve.

Parameters
[in]angle- A vector defining an inclination angle of line to the axis OX.
[in,out]tFind- An array of parameters of a curve, corresponding to the tangent points.

Reimplemented in MbTrimmedCurve, MbPolyline, and MbArc.

◆ HorzIsoclinal()

void MbCurve::HorzIsoclinal ( SArray< double > &  tFind) const

Construct horizontal isoclines.

Construct horizontal lines tangent to the curve.

Parameters
[in,out]tFind- An array of parameters of a curve, corresponding to the tangent points.

◆ VertIsoclinal()

void MbCurve::VertIsoclinal ( SArray< double > &  tFind) const

Construct vertical isoclines.

Construct vertical lines tangent to the curve.

Parameters
[in,out]tFind- An array of parameters of a curve, corresponding to the tangent points.

◆ SelfIntersect()

virtual void MbCurve::SelfIntersect ( SArray< MbCrossPoint > &  ,
double  metricEps = Math::LengthEps 
) const
virtual

Find self-intersections of curve.

Find the points of self-intersection of a curve and the corresponding parameters.

Parameters
[in,out]crossPnt- An array of points of self-intersection.

Reimplemented in MbReparamCurve, MbPolyline, and MbContour.

◆ OffsetCuspPoint()

virtual void MbCurve::OffsetCuspPoint ( SArray< double > &  tCusps,
double  dist 
) const
virtual

Find the special points of an offset curve.

Special points of an offset curve are the points where the curvature radius of the initial curve equals to the value of shift of an offset curve.

Parameters
[in,out]tCusps- An array of parameters of special points.
[in]dist- Shift of the offset curve.

Reimplemented in MbReparamCurve, MbOffsetCurve, MbNurbs, MbContour, and MbBezier.

◆ GoThroughPoint()

virtual bool MbCurve::GoThroughPoint ( MbCartPoint pnt)
virtual

Create a curve through a point.

Change a curve such that it passes through the given point. Changes should not affect the whole curve. If the curve has any base objects, then the connection with them should not be modified. If the curve cannot be constructed, then the initial curve will not change, false is returned.

Parameters
[in]pnt- A given point.
Returns
True - if the modification is performed, otherwise - false.

Reimplemented in MbReparamCurve, MbNurbs, and MbPolyline.

◆ GetRadius()

virtual double MbCurve::GetRadius ( double  accuracy = PARAM_REGION) const
virtual

Get the physical radius of the curve or zero if it impossible.

Generally returns 0. A non-zero value may be obtained only when the curve is an arc or is equal to an arc with the set precision (PARAM_REGION by default). \params[in] accuracy - The maximum curve deviation from an arc (PARAM_REGION by default).

Returns
Radius value if it can be obtained or 0.0.

Reimplemented in MbTrimmedCurve, MbReparamCurve, MbProjCurve, MbNurbs, MbContour, and MbArc.

◆ GetAxisPoint()

virtual bool MbCurve::GetAxisPoint ( MbCartPoint p) const
virtual

Calculate a point to construct an axis.

Calculates a point to construct an axis, if a curve may be constructed by rotation of a point around an axis.

Returns
true, if such axis exists.

Reimplemented in MbTrimmedCurve, MbOffsetCurve, MbNurbs, MbArc, MbReparamCurve, MbProjCurve, and MbContour.

◆ LengthBetween2Points()

virtual double MbCurve::LengthBetween2Points ( MbCartPoint p1,
MbCartPoint p2,
MbCartPoint pc = nullptr 
) const
virtual

Calculate minimal length of a curve between two points on it.

If a curve is not closed, then the length between points is clearly defined. If a curve is closed, then there is chosen the shortest path from the two possible paths. For a closed curve the desired part may be defined by the control points pc. In this case the such part of a curve is chosen, which is closer to a control point.

Parameters
[in]p1- The first point.
[in]p2- The second point
[in]pc- A control point
Returns
A length of a curve between points.

Reimplemented in MbReparamCurve, MbLineSegment, and MbLine.

◆ CorrectCyclicParameter()

void MbCurve::CorrectCyclicParameter ( double &  t,
double  eps = Math::paramRegion 
) const

Correct parameter for closed curves.

If the curve is closed, then the function sets the parameter t to the range of the curve. Besides, if t differs from one of bounding parameters by a value which is less than eps, then it becomes equal to the bounding parameter.

Parameters
[in,out]t- Input - given value of parameter, output - corrected value of parameter.
[in]eps- A tolerance of getting to the bound of the range.

◆ CorrectParameter()

void MbCurve::CorrectParameter ( double &  t) const

Correct parameter.

The function sets the parameter t to the range of the curve.

Parameters
[in,out]t- Input - given value of parameter, output - corrected value of parameter.

◆ IsReparamSame()

virtual bool MbCurve::IsReparamSame ( const MbCurve curve,
double &  factor 
) const
virtual

Define whether a reparameterized curve is the same.

Define whether a reparameterized curve is the same.

Parameters
[in]curve- A curve for comparison.
[out]factor- Coefficient of compression of parametric region at the time of transition to the pointed curve.

Reimplemented in MbNurbs.

◆ GetLimitPoint() [1/2]

MbCartPoint MbCurve::GetLimitPoint ( ptrdiff_t  number) const
inline

Calculate the boundary point.

Calculate the boundary point.

Parameters
[in]number- A number of a boundary point. The value 1 corresponds to the start point of a curve, 2 - to the end point.
Returns
A calculated point.

◆ GetLimitPoint() [2/2]

void MbCurve::GetLimitPoint ( ptrdiff_t  number,
MbCartPoint pnt 
) const
inline

Calculate the boundary point.

Calculate the boundary point.

Parameters
[in]number- A number of a boundary point. The value 1 corresponds to the start point of a curve, 2 - to the end point.
[in,out]pnt- A calculated point.

◆ GetLimitTangent()

void MbCurve::GetLimitTangent ( ptrdiff_t  number,
MbVector v 
) const
inline

Calculate a tangent vector to the boundary point.

Calculate a normalized tangent vector to the boundary point.

Parameters
[in]number- A number of a boundary point. The value 1 corresponds to the start point of a curve, 2 - to the end point.
[in,out]v- Tangent vector

◆ GetLimitPointAndTangent()

void MbCurve::GetLimitPointAndTangent ( ptrdiff_t  number,
MbCartPoint pnt,
MbVector v 
) const
inline

Calculate a tangent vector and point at the end of a curve.

Calculate a normalized tangent vector and point at the end of a curve.

Parameters
[in]number- A number of a boundary point. The value 1 corresponds to the start point of a curve, 2 - to the end point.
[in,out]pnt- A calculated point.
[in,out]v- Tangent vector

◆ AreLimitPointsEqual()

bool MbCurve::AreLimitPointsEqual ( ) const
inline

Are boundary points equal?

Are curve boundary points equal?

Returns
Returns true if points are equal.

◆ GetSpecificPoint()

virtual bool MbCurve::GetSpecificPoint ( const MbCartPoint from,
double &  dmax,
MbCartPoint pnt 
) const
virtual

Return a specific point of a curve.

Return a specific point of a curve if the distance from it to the given point is less than dmax. Specific points of a bounded curve are its start and end points.

Parameters
[in]from- A control point
[in,out]dmax- Input - maximum distance for search of specific point. Output - a distance from the point 'from' to the found specific point.
[in,out]pnt- Tangent vector.
Returns
True - if the specific point is found.

Reimplemented in MbTrimmedCurve, MbReparamCurve, MbPolyCurve, MbLineSegment, MbContour, and MbArc.

◆ GetLengthEvaluation()

virtual double MbCurve::GetLengthEvaluation ( ) const
virtual

Calculate the metric length of a curve.

The length of a curve is inaccurately calculated, by approximation of polyline. If the more accurate curve's length is required, then use the function CalculateMetricLength().

Reimplemented in MbTrimmedCurve, MbReparamCurve, MbProjCurve, MbPolyline, MbPolyCurve, MbOffsetCurve, MbLineSegment, MbContour, MbCharacterCurve, and MbArc.

◆ GetAnalyticalFunctionsBounds()

virtual void MbCurve::GetAnalyticalFunctionsBounds ( std::vector< double > &  params) const
virtual

Get the boundaries of the curve sections that are described by one analytical function.

Get the boundaries of the curve sections that are described by one analytical function.
The function was introduced to optimize the implementation of the function MbCurve3D :: GetCurvatureSpecialPoints, so as not to calculate the break points.

Parameters
[out]params- Curve parameters in which the analytical function changes.

Reimplemented in MbTrimmedCurve, MbReparamCurve, MbNurbs, MbHermit, MbCubicSpline, MbContour, and MbBezier.

◆ IsContinuousDerivative()

virtual bool MbCurve::IsContinuousDerivative ( bool &  contLength,
bool &  contDirect,
c3d::DoubleVector params = nullptr,
double  epsilon = EPSILON 
) const
virtual

Get properties of the object.

Set properties of the object. Get the basis points of the curve.

Have the first derivative of the curve the continuous length and direction?

Are absent any discontinuities at length or at direction of first derivative of the curve?

Parameters
[out]contLength- The length is continuous (true/false).
[out]contDirect- The direction of the first derivative is continuous (true/false).
[out]params- The parameters of the points at which the direction break occurs.
[in]epsilon- The accuracy of the calculation.

Reimplemented in MbReparamCurve, MbPolyline, MbOffsetCurve, MbNurbs, MbContour, and MbBezier.

◆ SetContinuousDerivativeLength()

virtual bool MbCurve::SetContinuousDerivativeLength ( VERSION  version,
double  epsilon = EPSILON 
)
virtual

Eliminate the discontinuities of the first derivative at length.

Eliminate the discontinuities of the first derivatives of the length.

Parameters
[in]epsilon- The accuracy of the calculation.
[in]version- Math version.

Reimplemented in MbReparamCurve, MbPolyline, MbOffsetCurve, MbNurbs, MbContour, and MbBezier.

◆ IsSpaceNear() [1/2]

bool MbCurve::IsSpaceNear ( const MbCurve curve,
double  eps,
bool  ext,
double  devSag = 5.0 *Math::deviateSag 
) const

Check whether the two curves are metrically close.

The proximity of curves is defined by equality of their ends and the distance of an arbitrary point of one curve to another curve. Curves may differ parametrically.

Parameters
[in]curve- A curve to compare with.
[in]eps- The maximum allowed distance between the nearest points of two curves.
[in]ext- A flag defines whether the curve 'curve' may be extended when necessary. If ext = true then the curve may be extended.
[in]devSag- Maximal value of sag.

◆ IsSpaceNear() [2/2]

bool MbCurve::IsSpaceNear ( const MbCurve curve,
double  xEps,
double  yEps,
bool  ext,
double  xNear,
double  yNear,
double  devSag = 5.0 *Math::deviateSag 
) const

Check whether the two curves are metrically close.

The proximity of curves is defined by equality of their ends and the distance of an arbitrary point of one curve to another curve. Curves may differ parametrically.

Parameters
[in]curve- A curve to compare with.
[in]xEps- A tolerance of detection of the projection by x axis.
[in]yEps- A tolerance of detection of the projection by y axis.
[in]ext- A flag defines whether the curve 'curve' may be extended when necessary. If ext = true then the curve may be extended.
[in]xNear- The maximum allowed distance along X between the nearest points of two curves.
[in]yNear- The maximum allowed distance along Y between the nearest points of two curves.
[in]devSag- Maximal value of sag.

◆ Extend()

virtual MbResultType MbCurve::Extend ( const MbCurveExtensionParameters parameters,
c3d::PlaneCurveSPtr resCurve 
) const
virtual

Extend the curve.

Extend the curve according to the given parameters.

Parameters
[in]parameters- Parameters of extension.
[out]resCurve- The extended curve or nullptr if extension is impossible.
Returns
Returns error status or rt_Success if all is OK.

Reimplemented in MbTrimmedCurve, MbNurbs, MbLineSegment, MbContour, and MbArc.


The documentation for this class was generated from the following file: