C3D Toolkit  Kernel - 117978, Vision - 2.9.1.5

Bezier spline in two-dimensional space. More...

#include <cur_bezier.h>

+ Inheritance diagram for MbBezier:
+ Collaboration diagram for MbBezier:

Public Member Functions

DEPRECATE_DECLARE MbBezier (bool closed, const SArray< MbCartPoint > &points)
 Constructor by array of all points. More...
 
DEPRECATE_DECLARE MbBezier (const SArray< MbCartPoint > &initList, bool cls, int initForm=0)
 Constructor by poles. More...
 
virtual ~MbBezier ()
 Destructor.
 
Common functions of a geometric object.
MbePlaneType IsA () const override
 Get the object type.
 
bool SetEqual (const MbPlaneItem &) override
 Make the objects equal. More...
 
bool IsSame (const MbPlaneItem &other, double accuracy=LENGTH_EPSILON) const override
 Determine whether objects are equal. More...
 
void Transform (const MbMatrix &matr, MbRegTransform *ireg=nullptr, const MbSurface *newSurface=nullptr) override
 Transform according to the matrix. More...
 
void Move (const MbVector &to, MbRegTransform *=nullptr, const MbSurface *newSurface=nullptr) override
 Translate along a vector. More...
 
void Rotate (const MbCartPoint &pnt, const MbDirection &angle, MbRegTransform *=nullptr, const MbSurface *newSurface=nullptr) override
 Rotate about a point. More...
 
MbPlaneItemDuplicate (MbRegDuplicate *=nullptr) const override
 Create a copy. More...
 
Spline initialization functions.
void Init (const SArray< MbCartPoint > &initList, bool cls)
 Initialize a curve by poles and closedness. More...
 
void Init (const MbBezier &initCurve)
 Initialize a curve by a given Bezier curve. More...
 
void Init (const MbArc &arc)
 Initialize a curve by a circle arc. More...
 
void InitCtrlPoints (const SArray< MbCartPoint > &initList)
 Initialize a curve by control points. More...
 
Functions for curve domain description.
double GetTMin () const override
 Get the minimum value of parameter.
 
double GetTMax () const override
 Get the maximum value of parameter.
 
Functions for working in the domain of a curve.

Functions: PointOn, FirstDer, SecondDer, ThirdDer,... correct parameter when it is outside domain.

void PointOn (double &t, MbCartPoint &p) const override
 Calculate a point on the curve. More...
 
void FirstDer (double &t, MbVector &fd) const override
 Calculate first derivative.
 
void SecondDer (double &t, MbVector &sd) const override
 Calculate second derivative.
 
void ThirdDer (double &t, MbVector &td) const override
 Calculate third derivative.
 
Functions for get of the group of data inside and outside the curve's domain of parameter.
void Explore (double &t, bool ext, MbCartPoint &pnt, MbVector &fir, MbVector *sec, MbVector *thir) const override
 Calculate point and derivatives of object for given parameter. More...
 
Functions of the motion along the curve
double Step (double t, double sag) const override
 Calculate parameter step. More...
 
double DeviationStep (double t, double angle) const override
 Calculate parameter step. More...
 
Common functions of curve
MbNurbsNurbsCurve (const MbCurveIntoNurbsInfo &) const override
 Construct a NURBS copy of a curve. More...
 
MbCurveNurbsCurve (const MbNurbsParameters &) const override
 Construct a NURBS copy of a curve. More...
 
MbCurveTrimmed (double t1, double t2, int sense, const MbDimAccuracy &xyEps, bool saveParamLenAndLaw) const override
 Construct a trimmed curve with the given two-dimensional accuracy. More...
 
MbContourNurbsContour () const override
 Approximate of a curve by the contour from NURBS curves.
 
void Inverse (MbRegTransform *iReg=nullptr) override
 Set the opposite direction of curve.
 
void GetProperties (MbProperties &properties) override
 Get properties of the object. More...
 
void SetProperties (const MbProperties &properties) override
 Change properties of the object. More...
 
void GetAnalyticalFunctionsBounds (std::vector< double > &params) const override
 Get the boundaries of the curve sections that are described by one analytical function.
 
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...
 
Common functions of a polygonal curve
size_t GetPointsCount () const override
 Return the number of non-coincedent control points.
 
void GetPoint (ptrdiff_t index, MbCartPoint &pnt) const override
 Get control point. More...
 
ptrdiff_t GetNearPointIndex (const MbCartPoint &pnt) const override
 Get the point index which is nearest to the given.
 
void GetRuleInterval (ptrdiff_t index, double &t1, double &t2) const override
 Get the range of influence of point of the curve. More...
 
void Rebuild () override
 Rebuild curve.
 
void SetClosed (bool cls) override
 Set attribute of closedness.
 
void LtSetClosed (bool cls)
 
void RemovePoint (ptrdiff_t index) override
 Remove control point with given index.
 
void RemovePoints () override
 Remove all points.
 
void AddPoint (const MbCartPoint &pnt) override
 Add point to the end of the array of control points.
 
void InsertPoint (ptrdiff_t index, const MbCartPoint &pnt) override
 Insert a point to the array of control points. More...
 
void InsertPoint (double t, const MbCartPoint &pnt, double xEps, double yEps) override
 Insert a point to the array of control points. More...
 
void InsertPolePoints (size_t index, const MbCartPoint &leftPnt, const MbCartPoint &basePnt, const MbCartPoint &rightPnt)
 Insert a pole, specified by three pointss, by index. No recalculation of derivatives at the poles. More...
 
void ChangePole (ptrdiff_t index, const MbCartPoint &pnt) override
 Replace the pole. More...
 
void ChangePoint (ptrdiff_t index, const MbCartPoint &pnt) override
 Replace a point. More...
 
bool CheckParam (double &t, ptrdiff_t &i0, ptrdiff_t &i1, double &t0, double &t1) const override
 Drive a parameter into the curve domain. More...
 
double GetParam (ptrdiff_t i) const override
 Get parameter corresponding to the point with specified index.
 
size_t GetParamsCount () const override
 Get count of parameters.
 
void GetTList (SArray< double > &params) const override
 
void CalculateGabarit (MbRect &) const override
 Detect the bounding box of a curve. More...
 
MbeState DeletePart (double t1, double t2, MbCurve *&part2) override
 Delete the piece of a curve. More...
 
MbeState TrimmPart (double t1, double t2, MbCurve *&part2) override
 Keep the piece 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.
 
void TangentPoint (const MbCartPoint &pnt, SArray< double > &tFind) const override
 Find tangents to a curve. More...
 
void AddPoint (MbCartPoint &pnt, double dl, double dr, double angle)
 Add point and derivatives to the end of array. More...
 
void ConvexHull (ptrdiff_t seg, SArray< MbCartPoint > &poly) const
 Determine the convex hull of the curve segment. More...
 
void OffsetCuspPoint (SArray< double > &tCusps, double dist) const override
 Determination of singular points of the offset curve.
 
void GetSegments (RPArray< MbBezier > &segments) const
 Return an array of separate segments of the Bezier-curve.
 
void ExeptEqualPoints ()
 Delete coincident points.
 
bool IsDegenerate (double eps=Math::LengthEps) const override
 Define whether the curve is degenerate..
 
MbContourCreateContour () const
 Create a contour from the NURBS curve.
 
bool Break (MbBezier &trimPart, double t1, double t2, const MbDimAccuracy &xyEps=MbDimAccuracy::twoDimAcc) const
 Allocate a part of the Bezier curve. More...
 
void SetBezierSplines ()
 Calculate parameters of the Bezier curve.
 
int GetFormType () const
 Return the spline shape.
 
void SetFormType (int newForm)
 Set the spline shape.
 
ptrdiff_t GetSplinesCount () const
 The number of splines.
 
void Trimm (MbBezier &trimm, double t1, double t2, int sense) const
 Break a part of the Bezier curve. More...
 
bool DistanceToPointIfLess (const MbCartPoint &to, double &d) const override
 Calculate the distance to a point. More...
 
bool BasicFunctions (double &t, CcArray< double > &values, ptrdiff_t &left) const
 Calculate all base functions in the point. More...
 
double CalculateMetricLength () const override
 Calculate the metric length of a curve.
 
bool DistanceAlong (double &t, double len, int curveDir, double eps=Math::LengthEps, VERSION version=Math::DefaultMathVersion()) const override
 Translate parameter along the curve. More...
 
bool IsContinuousDerivative (bool &contLength, bool &contDirect, c3d::DoubleVector *params=nullptr, double epsilon=EPSILON) const override
 Get properties of the object. More...
 
bool SetContinuousDerivativeLength (VERSION version, double epsilon=EPSILON) override
 Eliminate the discontinuities of the first derivative at length. More...
 
- Public Member Functions inherited from MbPolyCurve
virtual ~MbPolyCurve ()
 Destructor.
 
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...
 
bool IsClosed () const override
 Define whether the curve is periodic. More...
 
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.
 
virtual void SetBegEndDerivesEqual ()
 Set equal derivatives at the ends.
 
virtual void ClosedBreak ()
 Make curve open, keeping coincidence of the beginning and the end.
 
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 (double t, const MbCartPoint &pnt, const MbVector &v, double xEps, double yEps)
 Insert a point to the array of control points. More...
 
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 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 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...
 
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 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 IsSmoothConnected (double angleEps) const
 Define whether joints of contour/curve are smooth.
 
double GetParamLength () const
 Calculate the parametric length of a curve.
 
virtual double CalculateLength (double t1, double t2) const
 Calculate the metric length of a curve. More...
 
virtual void ResetTCalc () const
 Reset the current value of parameter.
 
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 MbCurveTrimmed (double t1, double t2, int sense, bool saveParamLenAndLaw=false) const
 Construct a trimmed 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 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 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 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.
 
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 void Rotate (const MbCartPoint &pnt, double angle, MbRegTransform *iReg=nullptr, const MbSurface *newSurface=nullptr)
 Rotate about a point. More...
 
virtual bool IsSimilar (const MbPlaneItem &item) const
 Determine whether the objects are similar. 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.
 

Static Public Member Functions

static MbBezierCreate (const MbBezier &other)
 Create copy of spline. More...
 
static MbBezierCreate (const SArray< MbCartPoint > &initList)
 Create spline by four points. More...
 
static MbBezierCreate (bool closed, const SArray< MbCartPoint > &points)
 Create spline by array of all points. More...
 
static MbBezierCreate (const MbBezier &pCurve, ptrdiff_t iseg)
 Create spline by segment of Bezier curve. More...
 
static MbBezierCreate (const SArray< MbCartPoint > &initList, bool cls, int initForm=0)
 Create spline by poles. More...
 
static MbBezierCreate (const MbArc &arc)
 Create spline by circle arc. More...
 

Protected Member Functions

 MbBezier (const MbBezier &pCurve)
 Copy-constructor.
 
 MbBezier (const SArray< MbCartPoint > &initList)
 Constructor by four points. More...
 
 MbBezier (const MbBezier &pCurve, ptrdiff_t iseg)
 Constructor by segment of Bezier curve. More...
 
 MbBezier (const MbArc &arc)
 Constructor by circle arc. More...
 
bool CanChangeClosed () const override
 Determine whether it is possible to change an attribute of closedness.
 
- Protected Member Functions inherited from MbPolyCurve
 MbPolyCurve ()
 Default constructor.
 
 MbPolyCurve (const MbPolyCurve &pCurve)
 Copy-constructor.
 
- 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.
 

Additional Inherited Members

- Protected Attributes inherited from MbPolyCurve
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

Bezier spline in two-dimensional space.

Bezier spline in two-dimensional space is defined by control points pointList.
Bezier spline is composite curve formed by connected among themselves Bezier curves with third degree. Each third-degree Bezier curve is constructed by four adjacent control points pointList. First and last control point from pointList for unclosed Bezier spline are not used Thus Bezier spline passes through each control point with index 3n+1, where n is integer. The value of parameter along each third-degree Bezier curve is incremented. The parameter of Bezier spline changes from zero to k, where k is the number of tree-degree Bezier curves which form spline. In general case the first derivative of Bezier spline can be discontinuous by length and direction.

Constructor & Destructor Documentation

◆ MbBezier() [1/5]

DEPRECATE_DECLARE MbBezier::MbBezier ( bool  closed,
const SArray< MbCartPoint > &  points 
)

Constructor by array of all points.

Constructor by array of all points(poles and rockers), for creation from three-dimensional curve MbBezier3D.

Deprecated:
The method is deprecated.
Parameters
[in]closed- Is curve closed?
[in]points- An array of points. It must be obtained from point array of three-dimensional curve MbBezier3D which is planar, by projecting them onto the plane of the curve. The number of points must be multiple of three. The minimal number of points is six.

◆ MbBezier() [2/5]

DEPRECATE_DECLARE MbBezier::MbBezier ( const SArray< MbCartPoint > &  initList,
bool  cls,
int  initForm = 0 
)

Constructor by poles.

Constructor by poles. initList array contains only poles.

Deprecated:
The method is deprecated.
Parameters
[in]initList- An array of curve poles. Minimal number of points in array equals two.
[in]cls- A curve closedness.
[in]initForm- The shape of spline. Possible values:
0 - The standard form. 1 - More convex form of curve.

◆ MbBezier() [3/5]

MbBezier::MbBezier ( const SArray< MbCartPoint > &  initList)
protected

Constructor by four points.

Constructor by four points.

Parameters
[in]initList- An array of points. Number of points must be equal to four. When number of points is more then four classical cubic bezier is created for each sequential four points. The smoothness of result curve can be broken.

◆ MbBezier() [4/5]

MbBezier::MbBezier ( const MbBezier pCurve,
ptrdiff_t  iseg 
)
protected

Constructor by segment of Bezier curve.

Constructor by segment of a given Bezier curve.

Parameters
[in]pCurve- A given curve.
[in]iseg- A number of curve segment.

◆ MbBezier() [5/5]

MbBezier::MbBezier ( const MbArc arc)
protected

Constructor by circle arc.

There was constructed a Bezier curve which approximates a given arc of a circle.

Parameters
[in]arc- Circle arc.

Member Function Documentation

◆ Create() [1/6]

static MbBezier* MbBezier::Create ( const MbBezier other)
static

Create copy of spline.

Create copy of spline.

Returns
Returns pointer to the created object or null pointer in case of failure.

◆ Create() [2/6]

static MbBezier* MbBezier::Create ( const SArray< MbCartPoint > &  initList)
static

Create spline by four points.

Create spline by four points.

Parameters
[in]initList- An array of points. Number of points must be equal to four. When number of points is more then four classical cubic bezier is created for each sequential four points. The smoothness of result curve can be broken.
Returns
Returns pointer to the created object or null pointer in case of failure.

◆ Create() [3/6]

static MbBezier* MbBezier::Create ( bool  closed,
const SArray< MbCartPoint > &  points 
)
static

Create spline by array of all points.

Create spline by array of all points(poles and rockers), for creation from three-dimensional curve MbBezier3D.

Parameters
[in]closed- Is curve closed?
[in]points- An array of points. It must be obtained from point array of three-dimensional curve MbBezier3D which is planar, by projecting them onto the plane of the curve. The number of points must be multiple of three. The minimal number of points is six.
Returns
Returns pointer to the created object or null pointer in case of failure.

◆ Create() [4/6]

static MbBezier* MbBezier::Create ( const MbBezier pCurve,
ptrdiff_t  iseg 
)
static

Create spline by segment of Bezier curve.

Create spline by segment of a given Bezier curve.

Parameters
[in]pCurve- A given curve.
[in]iseg- A number of curve segment.
Returns
Returns pointer to the created object or null pointer in case of failure.

◆ Create() [5/6]

static MbBezier* MbBezier::Create ( const SArray< MbCartPoint > &  initList,
bool  cls,
int  initForm = 0 
)
static

Create spline by poles.

Create spline by poles. initList array contains only poles.

Parameters
[in]initList- An array of curve poles. Minimal number of points in array equals two.
[in]cls- A curve closedness.
[in]initForm- The shape of spline. Possible values:
0 - The standard form.
1 - More convex form of curve.
Returns
Returns pointer to the created object or null pointer in case of failure.

◆ Create() [6/6]

static MbBezier* MbBezier::Create ( const MbArc arc)
static

Create spline by circle arc.

There was constructed a Bezier curve which approximates a given arc of a circle.

Parameters
[in]arc- Circle arc.
Returns
Returns pointer to the created object or null pointer in case of failure.

◆ SetEqual()

bool MbBezier::SetEqual ( const MbPlaneItem item)
overridevirtual

Make the objects equal.

It is possible to make equal only similar objects. Similar object is equated to a given one by changing of numerical data.

Parameters
[in]item- Object for initialization.
Returns
Whether the object is made equal to the given one.

Implements MbPlaneItem.

◆ IsSame()

bool MbBezier::IsSame ( const MbPlaneItem item,
double  accuracy = LENGTH_EPSILON 
) const
overridevirtual

Determine whether objects are equal.

Objects of the same types with similar (equal) data are considered to be equal.

Parameters
[in]item- Object for comparison.
[in]accuracy- The accuracy.
Returns
Whether the objects are equal.

Implements MbPlaneItem.

◆ Transform()

void MbBezier::Transform ( const MbMatrix matr,
MbRegTransform iReg = nullptr,
const MbSurface newSurface = nullptr 
)
overridevirtual

Transform according to the matrix.

Transform the initial object according to the matrix using the registrator. If the object contains references to the other geometric objects, then the nested objects are transformed according to the matrix. The registrator is used for preventing multiple transformation of the object. The function can be used without the registrator to transform a single object. The registrator must be used to transform a set of interdependent objects to prevent repeated transformation of the nested objects, since it is not ruled out that several objects from the set contain references to one or several common objects subject to transformation.

Parameters
[in]matr- A transformation matrix.
[in]iReg- Registrator.
[in]surface- New base surface of object provided that 'matr' is a transformation matrix from the old surface to a new one. For transformation of projection curve. It isn't considered if the surface is planar.

Implements MbPlaneItem.

◆ Move()

void MbBezier::Move ( const MbVector to,
MbRegTransform iReg = nullptr,
const MbSurface newSurface = nullptr 
)
overridevirtual

Translate along a vector.

Translate a geometric object along the vector using the registrator. If the object contains references to the other objects, then the translation operation is applied to the nested objects. The registrator is used for preventing multiple transformation of the object. The function can be used without the registrator to transform a single object. The registrator must be used to transform a set of interdependent objects to prevent repeated transformation of the nested objects, since it is not ruled out that several objects from the set contain references to one or several common objects subject to translation.

Parameters
[in]to- Translation vector.
[in]iReg- Registrator.
[in]surface- New base surface of object provided that 'matr' is a transformation matrix from the old surface to a new one. For transformation of projection curve. It isn't considered if the surface is planar.

Implements MbPlaneItem.

◆ Rotate()

void MbBezier::Rotate ( const MbCartPoint pnt,
const MbDirection angle,
MbRegTransform iReg = nullptr,
const MbSurface newSurface = nullptr 
)
overridevirtual

Rotate about a point.

Rotate an object about a point by the given angle using the registrator. If the object contains references to the other geometric objects, then the rotation operation is applied to the nested objects too. The registrator is used for preventing multiple transformation of the object. The function can be used without the registrator to transform a single object. The registrator must be used to transform a set of interdependent objects to prevent repeated transformation of the nested objects, since it is not ruled out that several objects from the set contain references to one or several common objects subject to rotation.

Parameters
[in]pnt- Fixed point.
[in]angle- The rotation angle.
[in]iReg- Registrator.
[in]surface- New base surface of object provided that 'matr' is a transformation matrix from the old surface to a new one. For transformation of projection curve. It isn't considered if the surface is planar.

Implements MbPlaneItem.

◆ Duplicate()

MbPlaneItem& MbBezier::Duplicate ( MbRegDuplicate iReg = nullptr) const
overridevirtual

Create a copy.

Create a copy of the object using the registrator. The registrator is used for preventing multiple copying of an object. If the object contains references to other objects, then the included objects are copied too. It is allowed not to pass the registrator to a function. Then the new copy of the object will be created. It is allowed not to use the registrator while copying a single object or a set of disconnected objects. The registrator must be used to copy several correlated objects successively. It is possible that the objects' connection means that the objects contain references to the common objects. Then, while copying without using the registrator, one can get a set of copies which contain references to the different copies of a single included object, what leads to loss of connection between the copies.

Parameters
[in]iReg- Registrator.
Returns
Copy of the object.

Implements MbPlaneItem.

◆ Init() [1/3]

void MbBezier::Init ( const SArray< MbCartPoint > &  initList,
bool  cls 
)

Initialize a curve by poles and closedness.

Initialize a curve by poles and closedness. initList array contains only poles.

Parameters
[in]initList- An array of curve poles.
[in]cls- A curve closedness.

◆ Init() [2/3]

void MbBezier::Init ( const MbBezier initCurve)

Initialize a curve by a given Bezier curve.

Initialize a curve by a given Bezier curve.

Parameters
[in]initCurve- A given curve.

◆ Init() [3/3]

void MbBezier::Init ( const MbArc arc)

Initialize a curve by a circle arc.

There was constructed a Bezier curve which approximates a given arc of a circle.

Parameters
[in]arc- Circle arc.

◆ InitCtrlPoints()

void MbBezier::InitCtrlPoints ( const SArray< MbCartPoint > &  initList)

Initialize a curve by control points.

Initialize a curve by control points. The array initList contains poles and "rocker arms".

Parameters
[in]initList- An array of control points of curve.

◆ PointOn()

void MbBezier::PointOn ( double &  t,
MbCartPoint p 
) const
overridevirtual

Calculate a point on the curve.

Correct parameter when getting out of domain bounds and calculate a point on the curve.

Parameters
[in]t- Curve parameter.
[out]p- A point on the curve.

Implements MbCurve.

◆ Explore()

void MbBezier::Explore ( double &  t,
bool  ext,
MbCartPoint pnt,
MbVector fir,
MbVector sec,
MbVector thir 
) const
overridevirtual

Calculate point and derivatives of object for given parameter.

Values of point and derivatives are calculated on parameter area and on extended curve.

Parameters
[in]t- Parameter.
[in]ext- On parameters area (false), on extended curve (true).
[out]pnt- Point.
[out]fir- Derivative with respect to t.
[out]sec- Second derivative with respect to t, if not nullptr.
[out]thir- Third derivative with respect to t, if not nullptr.

Reimplemented from MbCurve.

◆ Step()

double MbBezier::Step ( double  t,
double  sag 
) const
overridevirtual

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

◆ DeviationStep()

double MbBezier::DeviationStep ( double  t,
double  ang 
) const
overridevirtual

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

◆ NurbsCurve() [1/2]

MbNurbs* MbBezier::NurbsCurve ( const MbCurveIntoNurbsInfo nInfo) const
overridevirtual

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.

Implements MbCurve.

◆ NurbsCurve() [2/2]

MbCurve* MbBezier::NurbsCurve ( const MbNurbsParameters tParameters) const
overridevirtual

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

◆ Trimmed() [1/3]

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

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.

Implements MbCurve.

◆ GetProperties()

void MbBezier::GetProperties ( MbProperties properties)
overridevirtual

Get properties of the object.

Get internal data (properties) of an object for viewing and modification.

Parameters
[in]properties- Container for internal data of an object.

Implements MbPlaneItem.

◆ SetProperties()

void MbBezier::SetProperties ( const MbProperties properties)
overridevirtual

Change properties of the object.

Change internal data (properties) of object is performed by copying of corresponding values from the given object.

Parameters
[in]properties- Container for internal data of an object.

Implements MbPlaneItem.

◆ GetPoint()

void MbBezier::GetPoint ( ptrdiff_t  index,
MbCartPoint pnt 
) const
overridevirtual

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

◆ GetRuleInterval()

void MbBezier::GetRuleInterval ( ptrdiff_t  index,
double &  t1,
double &  t2 
) const
overridevirtual

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.

Implements MbPolyCurve.

◆ InsertPoint() [1/2]

void MbBezier::InsertPoint ( ptrdiff_t  index,
const MbCartPoint pnt 
)
overridevirtual

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.

Implements MbPolyCurve.

◆ InsertPoint() [2/2]

void MbBezier::InsertPoint ( double  t,
const MbCartPoint pnt,
double  xEps,
double  yEps 
)
overridevirtual

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.

Implements MbPolyCurve.

◆ InsertPolePoints()

void MbBezier::InsertPolePoints ( size_t  index,
const MbCartPoint leftPnt,
const MbCartPoint basePnt,
const MbCartPoint rightPnt 
)

Insert a pole, specified by three pointss, by index. No recalculation of derivatives at the poles.

#basePnt is the characteristic point. The vector from #basePnt to the left point #leftPnt specifies the derivative to the left of the characteristic point, the vector from #basePnt to the right point #rightPnt specifies the derivative to the right of the characteristic point. To maintain the continuity of the directional derivative, the three specified points must lie on one straight line. To maintain the continuity of the derivative with respect to the magnitude, the distances from the characteristic point to the points on the right and left must be equal.

Parameters
[in]index- Pole index.
[in]leftPnt- Point to the left of the characteristic point.
[in]basePnt- Characteristic point
[in]rightPnt-Point to the right of the characteristic point.

◆ ChangePole()

void MbBezier::ChangePole ( ptrdiff_t  index,
const MbCartPoint pnt 
)
overridevirtual

Replace the pole.

Replaces characteristic point with a given index.

Parameters
[in]index- An index of changed point.
[in]pnt- A given point.

Reimplemented from MbPolyCurve.

◆ ChangePoint()

void MbBezier::ChangePoint ( ptrdiff_t  index,
const MbCartPoint pnt 
)
overridevirtual

Replace a point.

Replace a point.

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

Reimplemented from MbPolyCurve.

◆ CheckParam()

bool MbBezier::CheckParam ( double &  t,
ptrdiff_t &  i0,
ptrdiff_t &  i1,
double &  t0,
double &  t1 
) const
overridevirtual

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.

Implements MbPolyCurve.

◆ CalculateGabarit()

void MbBezier::CalculateGabarit ( MbRect ) const
overridevirtual

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

◆ DeletePart()

MbeState MbBezier::DeletePart ( double  t1,
double  t2,
MbCurve *&  part2 
)
overridevirtual

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.

Implements MbCurve.

◆ TrimmPart()

MbeState MbBezier::TrimmPart ( double  t1,
double  t2,
MbCurve *&  part2 
)
overridevirtual

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.

Implements MbCurve.

◆ Deformation()

MbeState MbBezier::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.

◆ TangentPoint()

void MbBezier::TangentPoint ( const MbCartPoint pnt,
SArray< double > &  tFind 
) const
overridevirtual

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

◆ AddPoint()

void MbBezier::AddPoint ( MbCartPoint pnt,
double  dl,
double  dr,
double  angle 
)

Add point and derivatives to the end of array.

Add pole to the end of curve, and the movement of neighboring points (no poles), to ensure the direction of the tangent to the curve at the pole and derivatives lengths in the pole.

Parameters
[in]pnt- A given point.
[in]dl- Derivative length in pole on the left.
[in]dr- Derivative length in pole on the right.
[in]angle- The angle between the direction of the tangent and the OX-axis of the current coordinate system.

◆ ConvexHull()

void MbBezier::ConvexHull ( ptrdiff_t  seg,
SArray< MbCartPoint > &  poly 
) const

Determine the convex hull of the curve segment.

Determine the convex hull of the curve segment.

Parameters
[in]seg- A number of curve segment.
[out]poly- Array of points which constitute the convex hull of the segment.

◆ Break()

bool MbBezier::Break ( MbBezier trimPart,
double  t1,
double  t2,
const MbDimAccuracy xyEps = MbDimAccuracy::twoDimAcc 
) const

Allocate a part of the Bezier curve.

The new curve is created - a part of the Bezier curve between t1 and t2 parameters.

Parameters
[out]trimPart- Created curve.
[in]t1- A beginning parameter.
[in]t2- An end parameter.
[in]xyEps- The xyEps.x component corresponds to x-axis accuracy, xyEps.y corresponds to y-axis accuracy.
Returns
True - if construction has been successfully.

◆ Trimm()

void MbBezier::Trimm ( MbBezier trimm,
double  t1,
double  t2,
int  sense 
) const

Break a part of the Bezier curve.

The new curve is created - a part of the Bezier curve between t1 and t2 parameters.

Parameters
[out]trimm- Created curve.
[in]t1- A beginning parameter.
[in]t2- An end parameter.
[in]sense- Whether the direction of the resulting curve coincides with the direction of the original curve.

◆ DistanceToPointIfLess()

bool MbBezier::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.

◆ BasicFunctions()

bool MbBezier::BasicFunctions ( double &  t,
CcArray< double > &  values,
ptrdiff_t &  left 
) const

Calculate all base functions in the point.

For a given parameter, are calculated all base functions of the spline and the index of the first characteristic point which determines the behavior of the spline at a given parameter.

Parameters
[in]t- A parameter.
[out]values- An array with values of base functions in the point.
[in]left- An index of characteristic point.
Returns
True - if operation has been successfully.

◆ DistanceAlong()

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

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

◆ IsContinuousDerivative()

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

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

◆ SetContinuousDerivativeLength()

bool MbBezier::SetContinuousDerivativeLength ( VERSION  version,
double  epsilon = EPSILON 
)
overridevirtual

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

◆ Trimmed() [2/3]

virtual MbCurve* MbCurve::Trimmed

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.

◆ Trimmed() [3/3]

virtual MbCurve* MbCurve::Trimmed

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.

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