C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2

Curve in two-dimensional space, defined by points. More...

#include <cur_polycurve.h>

+ Inheritance diagram for MbPolyCurve:
+ Collaboration diagram for MbPolyCurve:

Public Member Functions

virtual ~MbPolyCurve ()
 Destructor.
 
Common functions of a geometric object.
MbePlaneType Type () const override
 Get the group type of the object.
 
void AddYourGabaritTo (MbRect &r) const override
 Extend the given bounding rectangle so that it encloses this object.
 
void Refresh () override
 Set all temporary (mutable) data of object to undefined (initial) state.
 
void PrepareIntegralData (const bool forced) const override
 Calculate temporary (mutable) data of an object. More...
 
Functions for description of a curve domain.
bool IsClosed () const override
 Define whether the curve is periodic. More...
 
Common functions of curve
bool IsStraight (bool ignoreParams=false) const override
 Define whether the curve is rectilinear..
 
bool HasLength (double &length) const override
 Calculate the metric length of a curve. More...
 
MbeState Deformation (const MbRect &, const MbMatrix &) override
 Deform the curve. More...
 
bool IsInRectForDeform (const MbRect &r) const override
 Determine visibility of a curve in rectangle.
 
size_t GetCount () const override
 Define the number of splittings for one passage in operations.
 
double GetMetricLength () const override
 Calculate the metric length of a curve. More...
 
double GetLengthEvaluation () const override
 Calculate the metric length of a curve. More...
 
bool GetSpecificPoint (const MbCartPoint &from, double &dmax, MbCartPoint &pnt) const override
 Return a specific point of a curve. More...
 
void GetBasisPoints (MbControlData &) const override
 Get control points of object.
 
void SetBasisPoints (const MbControlData &) override
 Change the object by control points.
 
Common functions of polygonal curve
virtual size_t GetPointsCount () const
 Get count of control points.
 
virtual void GetPoint (ptrdiff_t index, MbCartPoint &pnt) const
 Get control point. More...
 
virtual ptrdiff_t GetNearPointIndex (const MbCartPoint &pnt) const
 Get index of the point nearest to the given one.
 
virtual void GetRuleInterval (ptrdiff_t index, double &t1, double &t2) const =0
 Get the range of influence of point of the curve. More...
 
virtual void Rebuild ()=0
 Rebuild curve.
 
virtual void SetClosed (bool cls)
 Set attribute of closedness.
 
virtual void SetBegEndDerivesEqual ()
 Set equal derivatives at the ends.
 
virtual void ClosedBreak ()
 Make curve open, keeping coincidence of the beginning and the end.
 
virtual void RemovePoint (ptrdiff_t index)
 Remove control point with given index.
 
virtual void RemovePoints ()
 Remove all points.
 
virtual void AddPoint (const MbCartPoint &pnt)
 Add point to the end of the array of control points.
 
virtual bool ChangePointsValue (const SArray< MbCartPoint > &pntList)
 Change control points. More...
 
virtual void AddAfter (const MbCartPoint &pnt, ptrdiff_t index)
 Insert a point to the array of control points. More...
 
virtual void InsertPoint (ptrdiff_t index, const MbCartPoint &pnt)=0
 Insert a point to the array of control points. More...
 
virtual void InsertPoint (double t, const MbCartPoint &pnt, double xEps, double yEps)=0
 Insert a point to the array of control points. More...
 
virtual void InsertPoint (double t, const MbCartPoint &pnt, const MbVector &v, double xEps, double yEps)
 Insert a point to the array of control points. More...
 
virtual void ChangePole (ptrdiff_t index, const MbCartPoint &pnt)
 Replace a pole. More...
 
virtual void ChangePoint (ptrdiff_t index, const MbCartPoint &pnt)
 Replace a point. More...
 
virtual bool CheckParam (double &t, ptrdiff_t &i0, ptrdiff_t &i1, double &t0, double &t1) const =0
 Drive a parameter into the curve domain. More...
 
virtual double GetParam (ptrdiff_t i) const =0
 Get parameter corresponding to the point with specified index.
 
virtual size_t GetParamsCount () const =0
 Get count of parameters.
 
virtual void GetTList (SArray< double > &params) const
 
size_t GetPointListCount () const
 Get count of control points.
 
ptrdiff_t GetPointListMaxIndex () const
 Get maximal index of array of control points.
 
template<class PointsVector >
void GetPoints (PointsVector &pnts) const
 Get array of control points.

 
void GetPointList (SArray< MbCartPoint > &pnts) const
 Get array of control points.
 
void GetPointList (c3d::ParamPointsVector &pnts) const
 Get array of control points.
 
bool ReplacePoints (const SArray< MbCartPoint > &pnts)
 Replace the set of control points.
 
bool ReplacePoints (const std::vector< MbCartPoint > &pnts)
 Replace the set of control points.
 
const MbCartPointGetPointList (size_t i) const
 Get control point with the given index.
 
MbCartPointSetPointList (size_t i)
 Get control point with the given index.
 
ptrdiff_t GetUppIndex () const
 Get the maximal index of array of control points.

 
size_t GetSegmentsCount () const
 Get count of ranges.
 
template<class SegmentsVector >
void GetLineSegments (SegmentsVector &segments, double eps=PARAM_PRECISION) const
 Get the array of segments.
 
bool NurbsParam (double epsilon, double &pmin, double &pmax, ptrdiff_t &i1, double &t1, ptrdiff_t &i2, double &t2) const
 Get information for NurbsCurve function. More...
 
- Public Member Functions inherited from MbCurve
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.
 
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...
 
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...
 
virtual double GetTMax () const =0
 Get the maximum value of parameter.
 
virtual double GetTMin () const =0
 Get the minimum value of parameter.
 
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...
 
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).
 
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...
 
virtual double Step (double t, double sag) const
 Calculate parameter step. More...
 
virtual double DeviationStep (double t, double ang) const
 Calculate parameter step. More...
 
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 IsBounded () const
 Define whether the curve is bounded.
 
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 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 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.
 
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 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 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 GetProperties (MbProperties &properties)=0
 Get properties of the object. More...
 
virtual void SetProperties (const MbProperties &properties)=0
 Change properties of the object. More...
 
- 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

 MbPolyCurve ()
 Default constructor.
 
 MbPolyCurve (const MbPolyCurve &pCurve)
 Copy-constructor.
 
virtual bool CanChangeClosed () const
 Determine whether it is possible to change an attribute of closedness.
 
- Protected Member Functions inherited from MbCurve
 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

SArray< MbCartPointpointList
 Set of control points.
 
ptrdiff_t uppIndex
 Count of curve pieces (is equal to count of control points minus one).
 
bool closed
 An attribute of curve closedness.
 
MbRect rect
 Bounding rectangle.
 
atomic_double metricLength
 Metric length of a spline.
 
- Protected Attributes inherited from MbCurve
SimpleName name
 A curve name. The object data is temporary and used internally.
 

Detailed Description

Curve in two-dimensional space, defined by points.

Parent class of curves in two-dimensional space, defined by control points: MbBezier, MbCubicSpline, MbHermit, MbNurbs, MbPolyline.

Member Function Documentation

◆ PrepareIntegralData()

void MbPolyCurve::PrepareIntegralData ( const bool  forced) const
overridevirtual

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 from MbCurve.

◆ IsClosed()

bool MbPolyCurve::IsClosed ( ) const
overridevirtual

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.

Implements MbCurve.

◆ HasLength()

bool MbPolyCurve::HasLength ( double &  length) const
overridevirtual

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.

Implements MbCurve.

◆ Deformation()

MbeState MbPolyCurve::Deformation ( const MbRect rect,
const MbMatrix matr 
)
overridevirtual

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 from MbCurve.

◆ GetMetricLength()

double MbPolyCurve::GetMetricLength ( ) const
overridevirtual

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.

Implements MbCurve.

◆ GetLengthEvaluation()

double MbPolyCurve::GetLengthEvaluation ( ) const
overridevirtual

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 from MbCurve.

Reimplemented in MbPolyline.

◆ GetSpecificPoint()

bool MbPolyCurve::GetSpecificPoint ( const MbCartPoint from,
double &  dmax,
MbCartPoint pnt 
) const
overridevirtual

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 from MbCurve.

◆ GetPoint()

virtual void MbPolyCurve::GetPoint ( ptrdiff_t  index,
MbCartPoint pnt 
) const
virtual

Get control point.

Returns control point of the curve by its index. If the index is negative - returns the first point. If the index is greater than the maximum available, then the last point is returned.

Parameters
[in]index- Index of control point.
[out]pnt- Control point.

Reimplemented in MbBezier.

◆ GetRuleInterval()

virtual void MbPolyCurve::GetRuleInterval ( ptrdiff_t  index,
double &  t1,
double &  t2 
) const
pure virtual

Get the range of influence of point of the curve.

Determines which range of curve parameter will be affected by changing of the control point with 'index' index.

Parameters
[in]index- Index of control point.
[out]t1- Minimal parameter of the range of influence.
[out]t2- Maximal parameter of the range of influence.

Implemented in MbPolyline, MbNurbs, MbHermit, MbCubicSpline, and MbBezier.

◆ ChangePointsValue()

virtual bool MbPolyCurve::ChangePointsValue ( const SArray< MbCartPoint > &  pntList)
virtual

Change control points.

If count of points in the given array is equal to the current count of points, then the array of points is replaced by the new one. If not equal, then the control points are not changed, the function returns false.

Parameters
[in]pntList- The given array of control points.
Returns
True if points have been changed.

Reimplemented in MbNurbs.

◆ AddAfter()

virtual void MbPolyCurve::AddAfter ( const MbCartPoint pnt,
ptrdiff_t  index 
)
virtual

Insert a point to the array of control points.

Insert the given point after the point with 'index' index. Correctness of the index isn't checked in the function. It is necessary to make sure in advance that the given index is less than the count of points in array.

Parameters
[in]pnt- A given point.
[in]index- Index of point to insert a point after.

◆ InsertPoint() [1/3]

virtual void MbPolyCurve::InsertPoint ( ptrdiff_t  index,
const MbCartPoint pnt 
)
pure virtual

Insert a point to the array of control points.

Insert the given point by index.

Parameters
[in]pnt- A given point.
[in]index- Index to insert a point by.

Implemented in MbPolyline, MbNurbs, MbHermit, MbBezier, and MbCubicSpline.

◆ InsertPoint() [2/3]

virtual void MbPolyCurve::InsertPoint ( double  t,
const MbCartPoint pnt,
double  xEps,
double  yEps 
)
pure virtual

Insert a point to the array of control points.

Insert a point which corresponds to parameter 't' of the curve. If parameter 't' differs from the parameter of some point less than by the given tolerance, then the new point isn't inserted, already existent point close by parameter is replaced.

Parameters
[in]t- Parameter of the new point.
[in]pnt- A given point.
[in]xEps- Tolerance in x direction.
[in]yEps- Tolerance in y direction.

Implemented in MbPolyline, MbNurbs, MbHermit, MbBezier, and MbCubicSpline.

◆ InsertPoint() [3/3]

virtual void MbPolyCurve::InsertPoint ( double  t,
const MbCartPoint pnt,
const MbVector v,
double  xEps,
double  yEps 
)
virtual

Insert a point to the array of control points.

Insert a point and derivative vector corresponding to it, which will correspond to parameter 't' of the curve. If parameter 't' differs from the parameter of some point less than by the given tolerance, then the new point isn't inserted, already existent point close by parameter is replaced.

Parameters
[in]t- Parameter of the new point.
[in]pnt- A given point.
[in]v- Derivative at the given point.
[in]xEps- Tolerance in x direction.
[in]yEps- Tolerance in y direction.

Reimplemented in MbHermit.

◆ ChangePole()

virtual void MbPolyCurve::ChangePole ( ptrdiff_t  index,
const MbCartPoint pnt 
)
virtual

Replace a pole.

Generally the function is equivalent to ChangePoint() and replaces a control point with the specified index.

Parameters
[in]index- Index of a point to be changed.
[in]pnt- A given point.

Reimplemented in MbBezier.

◆ ChangePoint()

virtual void MbPolyCurve::ChangePoint ( ptrdiff_t  index,
const MbCartPoint pnt 
)
virtual

Replace a point.

Replace a point.

Parameters
[in]index- Index of a point to be changed.
[in]pnt- A given point.

Reimplemented in MbNurbs, MbHermit, MbBezier, and MbCubicSpline.

◆ CheckParam()

virtual bool MbPolyCurve::CheckParam ( double &  t,
ptrdiff_t &  i0,
ptrdiff_t &  i1,
double &  t0,
double &  t1 
) const
pure virtual

Drive a parameter into the curve domain.

Check parameter. If it is out of the range of the curve parameters, then in case of closed curve drive it into the definition domain with changing by period. In case of open curve - make equal to the nearest boundary parameter. Determine indices of control points the given parameter is between, and also determine their parametric values.

Parameters
[in,out]t- On input - the given parameter. On output - parameter in the curve definition domain.
[out]i0- Index of control point to the left of the given parameter.
[out]i1- Index of control point to the right of the given parameter.
[out]t0- Parameter of control point to the left of the given parameter.
[out]t1- Parameter of control point to the right of the given parameter.
Returns
True if the operation succeeded.

Implemented in MbPolyline, MbNurbs, MbHermit, MbCubicSpline, and MbBezier.

◆ NurbsParam()

bool MbPolyCurve::NurbsParam ( double  epsilon,
double &  pmin,
double &  pmax,
ptrdiff_t &  i1,
double &  t1,
ptrdiff_t &  i2,
double &  t2 
) const

Get information for NurbsCurve function.

Get information for NurbsCurve function. If curve segment passes through 'pmin' of a closed curve (for example, [0.2, 1.1] for closed curve with parameterization [0, 1]), then i1, i2 consider it and can be enumerated from GetPointsCount(), i.e. by period, instead of 0.

Parameters
[in]epsilon- Given accuracy.
[in]pmin- Parameter of the beginning of the curve piece being approximated .
[in]pmax- Parameter of the end of a curve piece being approximated.
[in]i1- Index of the parameter value next 'pmin' .
[in]t1- Index of the parameter value preceding 'pmax'.
[in]i2- Parameter of the control point next 'pmin' .
[in]t2- Parameter of the control point preceding 'pmax' .

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