C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2
+ Collaboration diagram for Base Algorithms:

Classes

class  MbRegDuplicate
 Registrator of copied objects. More...
 
class  MbAutoRegDuplicate
 Auto-registrator of duplication. More...
 
class  MbRegTransform
 Registrator of transformable objects. More...
 
class  MbAutoRegTransform
 Auto-registrator of transformation. More...
 

Macros

#define __REG_DUPLICATE_IMPL(__CLASS)
 Create a copy of the object using the registrator of duplicated objects. More...
 

Functions

double & c3d::NormalizeAngle (double &angle, double angleEpsilon=Math::AngleEps)
 Normalize an angle. More...
 
template<class Type >
double c3d::AngleBetweenVectors (const Type &v1, const Type &v2)
 Calculate the angle between two-dimensional vectors. More...
 
template<class ParamsVector >
bool c3d::ArFind (const ParamsVector &arParam, double t, ptrdiff_t &id)
 Find a parameter in the array. More...
 
bool c3d::InRange (double x1, double x2, double x)
 Check if the number is in range [x1, x2]. More...
 
bool c3d::IsParamOn (double tmin, double tmax, double t, double treg)
 Check if parameter is in the range of the curve. More...
 
bool c3d::InRangePlus (double x1, double x, double eps=FLT_EPSILON)
 Check if the number is in range [0, x1). More...
 
template<class TypeVector >
bool c3d::IsMonotonic (const TypeVector &items, bool isAscending, bool allowEqual=false)
 Whether vector of objects is ascending or descending. More...
 
template<class Point , class Vector , class PointsVector >
bool c3d::ArePointsOnLine (const PointsVector &pnts, double metricEps=METRIC_EPSILON)
 Whether points lie on the line. More...
 
template<class SpacePointsVector >
bool c3d::IsPlanar (const SpacePointsVector &pnts, MbPlacement3D *place, double mEps=METRIC_EPSILON)
 Whether the set of points lies on plane. More...
 
template<class Point >
bool c3d::IsPlanar2 (const Array2< Point > &pnts, MbPlacement3D *place, double mEps=METRIC_EPSILON)
 Whether the set of points lies on plane. More...
 
template<class PointsVector , class BBox >
bool c3d::CalculateBoundingBox (const PointsVector &pnts, BBox &bbox)
 Calculate points bounding box. More...
 
template<class Point , class BBox >
bool c3d::CalculateBoundingBox2 (const Array2< Point > &pnts, BBox &bbox)
 Calculate points bounding box. More...
 
template<class DoubleVector >
void c3d::SetLimitParam (DoubleVector &tarr, double tmin, double tmax, double teps=Math::paramEpsilon)
 Set the range of parameter. More...
 
template<class DoubleParamsVector >
bool SortSynchroArrays (DoubleParamsVector &tt0, DoubleParamsVector &tt2, double eps, bool checkCoincidentParams)
 Sort the array. More...
 
template<class DoubleParamsVector >
void SortArray (DoubleParamsVector &tt0, double eps, bool checkCoincidentParams)
 Sort the array. More...
 
bool CorrectCiclicParameter (double period, double p0, double &p)
 Re-roll the parameter for a period. More...
 
void CorrectParameter (bool pext, bool pc, double pmin, double pmax, double &p, double eps=Math::paramRegion)
 Refine the parameter. More...
 
bool CorrectCheckNearParameter (const double &tmin, const double &tmax, const double &tPeriod, const bool &ext, const double &tRegion, double &t)
 Correction of parameter with validation. More...
 
bool MatrixRoughInverse (const MbPlacement3D &place3D, const MbDirection *pDir, const MbVector3D &seeY, const MbVector3D &seeZ, MbMatrix &matrix)
 Determine the inversion matrix of roughness symbol. More...
 
bool MatrixTextInverse (const MbPlacement3D &place3D, const MbDirection *pDir, const MbVector3D &seeY, const MbVector3D &seeZ, MbMatrix &matrix)
 Determine the inversion matrix of text. More...
 
bool RoundedValue (double &value, uint8 n)
 The value is rounded to n significant digits. More...
 
int QuadraticEquation (double a, double b, double c, double &d, std::pair< double, double > &res)
 Solve a quadratic equation of the form a * x ^ 2 + b * x + c = 0 without external tolerance control. More...
 
int QuadraticEquation (double a, double b, double c, double &x1, double &x2, double epsilon=Math::paramEpsilon)
 Solve a quadratic equation of the form a * x ^ 2 + b * x + c = 0. More...
 
int QubicEquation (double a, double b, double c, double d, double *x, double epsilon)
 Solve a cubic equation of the form a * x^3 + b * x^2 + c * x + d = 0. More...
 
int CubicEquation (double i1, double i2, double i3, double *x, double epsilon)
 Solve a cubic equation of the form x^3 - i1 * x^2 + i2 * x - i3 = 0. More...
 
int Degree4Equation (double a, double b, double c, double d, double e, double *x, double epsilon)
 Solve a quartic equation of the form a * x^4 + b * x^3 + с * x^2 + d * x + e = 0. More...
 
void EigenVector (double a[c3d::SPACE_DIM][c3d::SPACE_DIM], MbVector3D &vect)
 Determine the eigenvector of 3 x 3 matrix. More...
 
template<class Point >
bool c3d::EqualPoints (const Point &p1, const Point &p2, double eps)
 Check points for equality. More...
 
template<class Vector >
bool c3d::EqualVectors (const Vector &p1, const Vector &p2, double eps)
 Check equality of vectors with given tolerance. More...
 
template<class Matrix >
bool c3d::EqualMatrices (const Matrix &m1, const Matrix &m2, double accuracy)
 Compare matrices. More...
 
void c3d::GetCosSin (const double &tt, double &cosT, double &sinT)
 Calculation of the cosine and sine. More...
 
template<class Type >
double GetParamDistance (const Type &p1, const Type &p2, MbeSplineParamType spType)
 Get a measure of the distance. More...
 
bool IsValidNurbsParams (size_t degree, bool closed, size_t pcnt)
 Check initialization parameters of a nurbs-object. More...
 
bool IsValidNurbsParams (size_t degree, bool closed, size_t pcnt, size_t wcnt)
 Check initialization parameters of a nurbs-object. More...
 
bool IsValidNurbsParams (size_t degree, bool closed, size_t pcnt, size_t wcnt, size_t kcnt)
 Check initialization parameters of a nurbs-object. More...
 
template<class KnotsVector >
bool IsValidNurbsParamsExt (size_t degree, bool closed, size_t pcnt, const KnotsVector &knots)
 Check initialization parameters of a nurbs-curve. More...
 
template<class PointVector , class DoubleVector >
bool IsValidNurbsParamsExt (size_t degree, bool closed, const PointVector &pnts, const DoubleVector *wts, const DoubleVector *knots=nullptr)
 Check initialization parameters of a nurbs-curve. More...
 
template<class KnotsVector >
bool IsValidNurbsKnots (const KnotsVector &knots, double eps=EXTENT_EPSILON)
 Check knots vector of a nurbs-object. More...
 
template<class KnotsVector >
bool RestoreClippedKnots (size_t degree, bool closed, size_t pointsCnt, KnotsVector &knots)
 Check and try to restore knots vector of a nurbs-object. More...
 
template<class KnotsVector >
ptrdiff_t KnotIndex (size_t degree, const KnotsVector &knots, double &t)
 Definition of "left" knot index for the first non-zero function. More...
 
template<class KnotsVector >
ptrdiff_t DefineKnotsVector (ptrdiff_t degree, bool closed, ptrdiff_t uppPointsIndex, KnotsVector &knots)
 Define knot vector (uniform parameterization). More...
 
template<class ParamsVector , class KnotsVector >
bool DefineKnotsVector (size_t degree, bool closed, size_t count, const ParamsVector *paramsPtr, size_t kMode, KnotsVector &knots)
 Define knot vector. More...
 
template<class PointsVector , class ParamsVector >
bool DefineThroughPointsParams (const PointsVector &points, MbeSplineParamType spType, bool closed, ParamsVector &params)
 Define parametric distribution of points. More...
 
template<class KnotsVector , class DoubleVector >
bool BasisFuns (ptrdiff_t i, double t, ptrdiff_t p, const KnotsVector &knots, DoubleVector &nsplines, DoubleVector &lrVect)
 The calculation of B - basis ("degree" - order of B-spline, p = (degree - 1) - the degree of the polynomial (B-spline)). More...
 
template<class DoubleVector >
bool CalcBsplvb (const DoubleVector &knots, double t, ptrdiff_t leftIndex, ptrdiff_t degree, DoubleVector &biatx, DoubleVector &lrVect)
 Calculate basic spline by "t" parameter and knots vector. More...
 
template<class Point , class NurbsVector , class KnotsVector >
void CurveDeriveCpts (ptrdiff_t p, const KnotsVector &U, const Point *P, const double *W, size_t pointCount, const NurbsVector *PW, ptrdiff_t d, ptrdiff_t r1, ptrdiff_t r2, NurbsVector *PK)
 Calculate all difference forms of curve. More...
 
template<class Point , class NurbsVector , class KnotsVector >
void CurveDeriveCpts (ptrdiff_t p, const KnotsVector &U, const Point *P, const double w, size_t pointCount, const NurbsVector *PW, ptrdiff_t d, ptrdiff_t r1, ptrdiff_t r2, NurbsVector *PK)
 Calculate all difference forms of curve. More...
 
template<class Point , class NurbsVector , class KnotsVector , class DoubleTriple >
void CurveDeriveCpts (ptrdiff_t p, const KnotsVector &U, const Point *P, const double *W, size_t pointCount, const NurbsVector *PW, ptrdiff_t d, ptrdiff_t r1, ptrdiff_t r2, DoubleTriple **DT, double **WT)
 Calculate all difference forms of curve. More...
 
template<class Point , class NurbsVector , class KnotsVector , class DoubleTriple >
void CurveDeriveCpts (ptrdiff_t p, const KnotsVector &U, const Point *P, const double w, size_t pointCount, const NurbsVector *PW, ptrdiff_t d, ptrdiff_t r1, ptrdiff_t r2, DoubleTriple **DT, double **WT)
 Calculate all difference forms of curve. More...
 
template<class Point , class Homogeneous >
void CurveDeriveCpts (ptrdiff_t p, const double *U, const Point *P, const double *W, size_t pointCount, ptrdiff_t r1, ptrdiff_t r2, Homogeneous *H0, Homogeneous *H1, Homogeneous *H2, Homogeneous *H3)
 Calculate all difference forms of curve. More...
 
void CheckParam (const double &tMin, const double &tMax, bool closed, double &t)
 Reduce "t" to parameter in the parametric domain of the curve. More...
 
template<class KnotsVector , class DoubleVector1 , class DoubleVector2 >
ptrdiff_t CalculateSplines (size_t degree, const KnotsVector &knots, bool closed, double &t, DoubleVector1 &nsplines, DoubleVector2 &lrVect)
 Calculate non-zero splines with a given parameter. More...
 
template<class Type >
void Swap (Type *arr, size_t ind1, size_t ind2)
 Swapping of 2 elements in the array. More...
 
template<class Type , class Type2 , class Type3 >
void InsertSort (Type *base, size_t num, KsQSortCompFunc compareFunc, Type2 *base2=nullptr, Type3 *base3=nullptr)
 An array sorting with an ability of synchronous rearrangement in two other specified arrays. Effective for small arrays. More...
 
template<class Type , class Type2 , class Type3 >
void QuickSort (Type *base, size_t num, KsQSortCompFunc compareFunc, Type2 *base2=nullptr, Type3 *base3=nullptr)
 An array sorting with an ability of synchronous rearrangement in two other specified arrays. Works with arrays of elements which support assignment operators. Not guarantees preserving of the order of equal elements. More...
 

Detailed Description

Macro Definition Documentation

◆ __REG_DUPLICATE_IMPL

#define __REG_DUPLICATE_IMPL (   __CLASS)
Value:
MbRefItem * copyItem = nullptr; \
if ( iReg == nullptr || !iReg->IsReg( this, copyItem ) ) { \
copyItem = new __CLASS; \
if ( iReg != nullptr ) \
iReg->SetReg( this, copyItem ); \
}
Reference-counted object.
Definition: reference_item.h:91

Create a copy of the object using the registrator of duplicated objects.

Create a copy of the object using the registrator of duplicated objects. If a copy of the object is already registered then get it from the registrator.

Function Documentation

◆ NormalizeAngle()

double& c3d::NormalizeAngle ( double &  angle,
double  angleEpsilon = Math::AngleEps 
)
inline

Normalize an angle.

Draw the source angle in range [0, 2*M_PI) if necessary.

Parameters
[out]angle- The source angle to normalize.
[in]angleEpsilon- Angular tolerance.

◆ AngleBetweenVectors()

template<class Type >
double c3d::AngleBetweenVectors ( const Type &  v1,
const Type &  v2 
)

Calculate the angle between two-dimensional vectors.

Calculate the angle between two-dimensional vectors.

Parameters
[in]v1- The first vector.
[in]v2- The second vector.
Returns
The angle.

◆ ArFind()

template<class ParamsVector >
bool c3d::ArFind ( const ParamsVector &  arParam,
double  t,
ptrdiff_t &  id 
)

Find a parameter in the array.

Locating the index of a given parameter in the array. Input array is to be sorted in ascending order. If the initial value of the index is set to be close to the expected location of the sought parameter, the search will be faster. If there is no parameter in the array equal to the given one, then the first parameter in the array greater than the given one will be chosen. If there is only 1 element in the array, then it will be considered as equal to the given one.

Parameters
[in]arParam- An array of parameters.
[in]t- The parameter value to be found in the array.
[in,out]id- The index of the parameter found in the array.
Returns
- true, if there are elements in the array,
otherwise false

◆ InRange()

bool c3d::InRange ( double  x1,
double  x2,
double  x 
)
inline

Check if the number is in range [x1, x2].

x1 can be both the start and the end of the range, just as x2.

Parameters
[in]x1- The start or the end of the source range.
[in]x2- The start or the end of the source range.
[in]x- The input number which should be checked.
Returns
True if x lies inside range,
otherwise false.

◆ IsParamOn()

bool c3d::IsParamOn ( double  tmin,
double  tmax,
double  t,
double  treg 
)
inline

Check if parameter is in the range of the curve.

Range of the curve is given by domain of curve parameters [tmin, tmax].

Parameters
[in]tmin- Minimal value of parameter.
[in]tmax- Maximal value of parameter.
[in]t- Source parameter
[in]treg- Accuracy of parameter.
Returns
True if t lies inside the range [tmin, tmax],
otherwise false.

◆ InRangePlus()

bool c3d::InRangePlus ( double  x1,
double  x,
double  eps = FLT_EPSILON 
)
inline

Check if the number is in range [0, x1).

x1 >= 0

Parameters
[in]x1- End of the source range.
[in]x- The input number which should be checked.
[in]eps- Tolerance.
Returns
True if x lies inside range,
otherwise false.

◆ IsMonotonic()

template<class TypeVector >
bool c3d::IsMonotonic ( const TypeVector &  items,
bool  isAscending,
bool  allowEqual = false 
)

Whether vector of objects is ascending or descending.

Whether vector of items are ascending or descending.

Parameters
[in]items- Vector of objects.
[in]isAscending- Check for ascending.
[in]allowEqual- Allow for equality of objects.
Returns
True if vector is ascending (descending),
otherwise false.

◆ ArePointsOnLine()

template<class Point , class Vector , class PointsVector >
bool c3d::ArePointsOnLine ( const PointsVector &  pnts,
double  metricEps = METRIC_EPSILON 
)

Whether points lie on the line.

Whether points lie on the line (improved variant of IsPointOnLine).

Parameters
[in]pnts- Point set.
[in]metricEps- Check accuracy.
Returns
True if points lie on line,
otherwise false.

◆ IsPlanar()

template<class SpacePointsVector >
bool c3d::IsPlanar ( const SpacePointsVector pnts,
MbPlacement3D place,
double  mEps = METRIC_EPSILON 
)

Whether the set of points lies on plane.

Whether the set of points lies on plane.

Parameters
[in]pnts- Point set.
[in,out]place- Points coordinate system.
[in]mEps- Check accuracy.
Returns
True if points lie on plane,
otherwise false.

◆ IsPlanar2()

template<class Point >
bool c3d::IsPlanar2 ( const Array2< Point > &  pnts,
MbPlacement3D place,
double  mEps = METRIC_EPSILON 
)

Whether the set of points lies on plane.

Whether set of points lies on plane.

Parameters
[in]pnts- Point set.
[in,out]place- Points coordinate system.
[in]mEps- Check accuracy.
Returns
True if points lie on plane,
otherwise false.

◆ CalculateBoundingBox()

template<class PointsVector , class BBox >
bool c3d::CalculateBoundingBox ( const PointsVector &  pnts,
BBox &  bbox 
)

Calculate points bounding box.

Calculate points bounding box.

Parameters
[in]pnts- Point set.
[out]bbox- Bounding box.
Returns
True if bounding box was calculated,
otherwise false.

◆ CalculateBoundingBox2()

template<class Point , class BBox >
bool c3d::CalculateBoundingBox2 ( const Array2< Point > &  pnts,
BBox &  bbox 
)

Calculate points bounding box.

Calculate points bounding box.

Parameters
[in]pnts- Point set.
[out]bbox- Bounding box.
Returns
True if bounding box was calculated,
otherwise false.

◆ SetLimitParam()

template<class DoubleVector >
void c3d::SetLimitParam ( DoubleVector tarr,
double  tmin,
double  tmax,
double  teps = Math::paramEpsilon 
)

Set the range of parameter.

Set (reparametrize) range of parameter in the array.

Parameters
[in,out]tarr- The array of parameters sorted in ascending order.
[in]tmin- Minimal value of parameter.
[in]tmax- Maximal value of parameter.

◆ SortSynchroArrays()

template<class DoubleParamsVector >
bool SortSynchroArrays ( DoubleParamsVector &  tt0,
DoubleParamsVector &  tt2,
double  eps,
bool  checkCoincidentParams 
)

Sort the array.

First array is sorted in ascending order. Elements of the second array are rearranged synchronously with elements of the first one. If the corresponding flag is set, then the array is checked for duplications. If they exist, then only one of them is kept with the corresponding parameter in tt2. Meanwhile, the parameter is kept in tt0, which correspondence in tt2 has the minimal value.

Parameters
[out]tt0- Source array of first parameters to sort.
[out]tt2- Source array of second parameters to sort synchronously with tt0.
[in]eps- Parameters comparison tolerance.
[in]checkCoincidentParams- Flag for checking of duplicate parameters.

◆ SortArray()

template<class DoubleParamsVector >
void SortArray ( DoubleParamsVector &  tt0,
double  eps,
bool  checkCoincidentParams 
)

Sort the array.

Sort the array in ascending order. If the corresponding flag is set, then the check for duplicate parameters is to be performed. If they exist, then only one of them is kept.

Parameters
[out]tt0- Source array of parameters to sort.
[in]eps- Parameters comparison tolerance.
[in]checkCoincidentParams- Flag for checking of duplicate parameters.

◆ CorrectCiclicParameter()

bool CorrectCiclicParameter ( double  period,
double  p0,
double &  p 
)

Re-roll the parameter for a period.

Re-roll the parameter for a period. The transfer occurs towards the initial approximation.

Parameters
[in]period- Period.
[in]p0- Initial approximation of the parameter.
[in,out]p- The parameter to refine.
Returns
True if a parameter was changed,
otherwise - false.

◆ CorrectParameter()

void CorrectParameter ( bool  pext,
bool  pc,
double  pmin,
double  pmax,
double &  p,
double  eps = Math::paramRegion 
)

Refine the parameter.

If parameter is closed or must not be in the extension of parametric region, then it drawn inside region [pmin, pmax] if necessary.

Parameters
[in]pext- Whether extension of parametric region is used.
[in]pc- Closedness of parameter domain.
[in]pmin- The minimal value of parameter.
[in]pmax- The maximal value of parameter.
[out]p- The parameter to refine.
[in]eps- Computational tolerance.

◆ CorrectCheckNearParameter()

bool CorrectCheckNearParameter ( const double &  tmin,
const double &  tmax,
const double &  tPeriod,
const bool &  ext,
const double &  tRegion,
double &  t 
)

Correction of parameter with validation.

If the parameter is not in range [tmin, tmax] after correction, and flag of use of parameter on extension of parametric region is false, then parameter equates to tmin or tmax, according to which bound it get out from range [tmin, tmax].

Parameters
[in]tmin- Minimal value of parameter.
[in]tmax- Maximal value of parameter.
[in]tPeriod- Period.
[in]ext- Whether extension of parametric region is used.
[in]tRegion- Accuracy of parameter.
[out]t- The parameter to refine.
Returns
True if there was no parameter out of range [tmin, tmax] after correction,
otherwise false.

◆ MatrixRoughInverse()

bool MatrixRoughInverse ( const MbPlacement3D place3D,
const MbDirection pDir,
const MbVector3D seeY,
const MbVector3D seeZ,
MbMatrix matrix 
)

Determine the inversion matrix of roughness symbol.

Calculating the inversion matrix in three-dimensional space.

Parameters
[in]place3D- Local coordinate system.
[in]pDir- Direction.
[in]seeY- Screen Y-axis.
[in]seeZ- Screen Z-axis.
[out]matrix- Inversion matrix.
Returns
True if the matrix was found,
otherwise false

◆ MatrixTextInverse()

bool MatrixTextInverse ( const MbPlacement3D place3D,
const MbDirection pDir,
const MbVector3D seeY,
const MbVector3D seeZ,
MbMatrix matrix 
)

Determine the inversion matrix of text.

Calculating the inversion matrix in three-dimensional space.

Parameters
[in]place3D- Local coordinate system.
[in]pDir- Direction.
[in]seeY- Screen Y-axis.
[in]seeZ- Screen Z-axis.
[out]matrix- Inversion matrix.
Returns
True if the matrix was found,
otherwise false

◆ RoundedValue()

bool RoundedValue ( double &  value,
uint8  n 
)

The value is rounded to n significant digits.

The value is rounded to n significant digits.

Parameters
[in,out]value- The value.
[in]n- Number of significant digits.
Returns
true, if value is rounded, otherwise false.

◆ QuadraticEquation() [1/2]

int QuadraticEquation ( double  a,
double  b,
double  c,
double &  d,
std::pair< double, double > &  res 
)

Solve a quadratic equation of the form a * x ^ 2 + b * x + c = 0 without external tolerance control.

Solve a quadratic equation of the form a * x ^ 2 + b * x + c = 0 without external tolerance control.

Parameters
[in]a- The second-degree term coefficient.
[in]b- The first-degree term coefficient.
[in]c- The constant term coefficient.
[out]d- The discriminant of equation.
[out]res- Roots of equation.
Returns
Number of real roots and discriminant of equation.

◆ QuadraticEquation() [2/2]

int QuadraticEquation ( double  a,
double  b,
double  c,
double &  x1,
double &  x2,
double  epsilon = Math::paramEpsilon 
)

Solve a quadratic equation of the form a * x ^ 2 + b * x + c = 0.

Solve a quadratic equation of the form a * x ^ 2 + b * x + c = 0.

Parameters
[in]a- The second-degree term coefficient.
[in]b- The first-degree term coefficient.
[in]c- The constant term coefficient.
[out]x1- The first root of equation.
[out]x2- The second root of equation.
[in]epsilon- Solution tolerance.
Returns
Number of real roots.

◆ QubicEquation()

int QubicEquation ( double  a,
double  b,
double  c,
double  d,
double *  x,
double  epsilon 
)

Solve a cubic equation of the form a * x^3 + b * x^2 + c * x + d = 0.

Solve a cubic equation of the form a * x^3 + b * x^2 + c * x + d = 0.

Parameters
[in]a- The third-degree term coefficient.
[in]b- The second-degree term coefficient.
[in]c- The first-degree term coefficient.
[in]d- The constant term coefficient.
[out]x- Roots of equation.
[in]epsilon- Solution tolerance.
Returns
Number of real roots.

◆ CubicEquation()

int CubicEquation ( double  i1,
double  i2,
double  i3,
double *  x,
double  epsilon 
)

Solve a cubic equation of the form x^3 - i1 * x^2 + i2 * x - i3 = 0.

Solve a cubic equation of the form x^3 - i1 * x^2 + i2 * x - i3 = 0.

Parameters
[in]i1- The second-degree term coefficient.
[in]i2- The first-degree term coefficient.
[in]i3- The constant term coefficient.
[out]x- Roots of equation.
[in]epsilon- Solution tolerance.
Returns
Number of real roots.

◆ Degree4Equation()

int Degree4Equation ( double  a,
double  b,
double  c,
double  d,
double  e,
double *  x,
double  epsilon 
)

Solve a quartic equation of the form a * x^4 + b * x^3 + с * x^2 + d * x + e = 0.

Solve a cubic equation of the form a * x^4 + b * x^3 + с * x^2 + d * x + e = 0.

Parameters
[in]a- The fourth-degree term coefficient.
[in]b- The third-degree term coefficient.
[in]c- The second-degree term coefficient.
[in]d- The first-degree term coefficient.
[in]e- The constant term coefficient.
[out]x- Roots of equation.
[in]epsilon- Solution tolerance.
Returns
Number of real roots.

◆ EigenVector()

void EigenVector ( double  a[c3d::SPACE_DIM][c3d::SPACE_DIM],
MbVector3D vect 
)

Determine the eigenvector of 3 x 3 matrix.

Determine the eigenvector of 3 x 3 matrix.

Parameters
[in]a- 3 x 3 matrix.
[out]vect- The eigenvector of matrix.

◆ EqualPoints()

template<class Point >
bool c3d::EqualPoints ( const Point &  p1,
const Point &  p2,
double  eps 
)

Check points for equality.

Points are considered as equal if their coordinates differ by a value which doesn't exceed a given tolerance.

Parameters
[in]p1- The first cartesian point.
[in]p2- The second cartesian point.
[in]eps- Metric tolerance of points coincidence.
Returns
True if points coincide,
false otherwise.

◆ EqualVectors()

template<class Vector >
bool c3d::EqualVectors ( const Vector &  p1,
const Vector &  p2,
double  eps 
)

Check equality of vectors with given tolerance.

Check equality of vectors with given tolerance. Vectors are equal if their coordinates differs less than given tolerance.

Parameters
[in]p1- The first vector.
[in]p2- The second vector.
[in]eps- Coordinate tolerance.
Returns
Returns true if the vectors are equal.

◆ EqualMatrices()

template<class Matrix >
bool c3d::EqualMatrices ( const Matrix &  m1,
const Matrix &  m2,
double  accuracy 
)

Compare matrices.

Tolerant comparison of two matrices.

Parameters
[in]m1,m2- Initial matrices.
[in]accuracy- A tolerance.
Returns
Returns true if matrices are equal,
false otherwise.

◆ GetCosSin()

void c3d::GetCosSin ( const double &  tt,
double &  cosT,
double &  sinT 
)
inline

Calculation of the cosine and sine.

1.7 times faster than a single calculation of sin and cos, Tested in release configuration with optimization.

Parameters
[in]tt- Angle (in radians).
[out]cosT- Cosine of the angle tt.
[out]sinT- Sine of the angle tt.

◆ GetParamDistance()

template<class Type >
double GetParamDistance ( const Type &  p1,
const Type &  p2,
MbeSplineParamType  spType 
)

Get a measure of the distance.

Get a measure of the distance.

Parameters
[in]p1,p2- Points between which the distance is computed.
[in]spType- The parametrization type of spline objects.
Returns
Distance.

◆ IsValidNurbsParams() [1/3]

bool IsValidNurbsParams ( size_t  degree,
bool  closed,
size_t  pcnt 
)
inline

Check initialization parameters of a nurbs-object.

Check initialization parameters of a nurbs-object.

Parameters
[in]degree- B-spline degree.
[in]closed- A closedness attribute.
[in]pcnt- Number of points.
Returns
Returns true if parameters are consistent.

◆ IsValidNurbsParams() [2/3]

bool IsValidNurbsParams ( size_t  degree,
bool  closed,
size_t  pcnt,
size_t  wcnt 
)
inline

Check initialization parameters of a nurbs-object.

Check initialization parameters of a nurbs-object.

Parameters
[in]degree- B-spline degree.
[in]closed- A closedness attribute.
[in]pcnt- Number of points.
[in]wcnt- Number of weights.
Returns
Returns true if parameters are consistent.

◆ IsValidNurbsParams() [3/3]

bool IsValidNurbsParams ( size_t  degree,
bool  closed,
size_t  pcnt,
size_t  wcnt,
size_t  kcnt 
)
inline

Check initialization parameters of a nurbs-object.

Check initialization parameters of a nurbs-object.

Parameters
[in]degree- B-spline degree.
[in]closed- A closedness attribute.
[in]pcnt- Number of points.
[in]wcnt- Number of weights.
[in]kcnt- Number of knots.
Returns
Returns true if parameters are consistent.

◆ IsValidNurbsParamsExt() [1/2]

template<class KnotsVector >
bool IsValidNurbsParamsExt ( size_t  degree,
bool  closed,
size_t  pcnt,
const KnotsVector &  knots 
)

Check initialization parameters of a nurbs-curve.

Check initialization parameters of a nurbs-curve.

Parameters
[in]degree- B-spline degree.
[in]closed- A closedness attribute.
[in]pcnt- Number of points.
[in]knots- Knots vector.
Returns
Returns true if parameters are consistent.

◆ IsValidNurbsParamsExt() [2/2]

template<class PointVector , class DoubleVector >
bool IsValidNurbsParamsExt ( size_t  degree,
bool  closed,
const PointVector &  pnts,
const DoubleVector *  wts,
const DoubleVector *  knots = nullptr 
)

Check initialization parameters of a nurbs-curve.

Check initialization parameters of a nurbs-curve.

Parameters
[in]degree- B-spline degree.
[in]closed- A closedness attribute.
[in]pnts- Points vector.
[in]wts- Weights vector.
[in]knots- Knots vector.
Returns
Returns true if parameters are consistent.

◆ IsValidNurbsKnots()

template<class KnotsVector >
bool IsValidNurbsKnots ( const KnotsVector &  knots,
double  eps = EXTENT_EPSILON 
)

Check knots vector of a nurbs-object.

Check knots vector of a nurbs-object.

Parameters
[in]knots- Knots vector.
Returns
Returns true if parameters are consistent.

◆ RestoreClippedKnots()

template<class KnotsVector >
bool RestoreClippedKnots ( size_t  degree,
bool  closed,
size_t  pointsCnt,
KnotsVector &  knots 
)

Check and try to restore knots vector of a nurbs-object.

Check and try to restore knots vector of a nurbs-object.

Parameters
[in]degree- B-spline degree.
[in]closed- A closedness attribute.
[in]pointsCnt- Number of points.
[in,out]knots- Knots vector.
Returns
Returns true if parameters are consistent.

◆ KnotIndex()

template<class KnotsVector >
ptrdiff_t KnotIndex ( size_t  degree,
const KnotsVector &  knots,
double &  t 
)

Definition of "left" knot index for the first non-zero function.

Definition of "left" knot index for the first non-zero function (knots[mid] <= t < knots[mid + 1]).

Parameters
[in]degree- B-spline degree.
[in]knots- Knots.
[in,out]t- A parameter value.
Returns
A knot index.

◆ DefineKnotsVector() [1/2]

template<class KnotsVector >
ptrdiff_t DefineKnotsVector ( ptrdiff_t  degree,
bool  closed,
ptrdiff_t  uppPointsIndex,
KnotsVector &  knots 
)

Define knot vector (uniform parameterization).

Define knot vector (uniform parameterization).

Parameters
[in]degree- B-spline degree.
[in]closed- A closedness attribute.
[in]uppPointsIndex- Last point index.
[in]knots- Knots vector.

◆ DefineKnotsVector() [2/2]

template<class ParamsVector , class KnotsVector >
bool DefineKnotsVector ( size_t  degree,
bool  closed,
size_t  count,
const ParamsVector *  paramsPtr,
size_t  kMode,
KnotsVector &  knots 
)

Define knot vector.

Define knot vector.

Parameters
[in]degree- B-spline degree.
[in]closed- A closedness attribute.
[in]count- Number of points.
[in]params- Points parameters (for closed spline - "count"+1).
[in]kMode- A method for constructing a knot vector in the presence of parameters.
[out]knots- Knots vector.
Returns
Returns true if result is success.

◆ DefineThroughPointsParams()

template<class PointsVector , class ParamsVector >
bool DefineThroughPointsParams ( const PointsVector &  points,
MbeSplineParamType  spType,
bool  closed,
ParamsVector &  params 
)

Define parametric distribution of points.

Define parametric distribution of points.

Parameters
[in]points- Points vector.
[in]spType- The parameterization type of spline objects.
[in]closed- A closedness attribute.
[out]params- Parametric distribution of points.
Returns
Returns true if result is success.

◆ BasisFuns()

template<class KnotsVector , class DoubleVector >
bool BasisFuns ( ptrdiff_t  i,
double  t,
ptrdiff_t  p,
const KnotsVector &  knots,
DoubleVector &  nsplines,
DoubleVector &  lrVect 
)

The calculation of B - basis ("degree" - order of B-spline, p = (degree - 1) - the degree of the polynomial (B-spline)).

The calculation of B - basis ("degree" - order of B-spline, p = (degree - 1) - the degree of the polynomial (B-spline)). To speed up vector lr = { left[p+1], right[p+1] } is used.

Parameters
[in]i- Index of knots vector obtained by the function KnotIndex().
[in]t- Parameter.
[in]p- p = degree - 1, where degree is B-spline degree.
[in]knots- Knots vector.
[out]nsplines- Array of B-spline values.
[in,out]lrVect- Temporary working vector with dimension 2*(p+1) = 2*degree.

◆ CalcBsplvb()

template<class DoubleVector >
bool CalcBsplvb ( const DoubleVector &  knots,
double  t,
ptrdiff_t  leftIndex,
ptrdiff_t  degree,
DoubleVector &  biatx,
DoubleVector &  lrVect 
)

Calculate basic spline by "t" parameter and knots vector.

Calculate basic spline by "t" parameter and knots vector.

◆ CurveDeriveCpts() [1/5]

template<class Point , class NurbsVector , class KnotsVector >
void CurveDeriveCpts ( ptrdiff_t  p,
const KnotsVector &  U,
const Point *  P,
const double *  W,
size_t  pointCount,
const NurbsVector *  PW,
ptrdiff_t  d,
ptrdiff_t  r1,
ptrdiff_t  r2,
NurbsVector *  PK 
)

Calculate all difference forms of curve.

Calculate all (or some, optionally) difference forms of curve (characteristic derivatives).

◆ CurveDeriveCpts() [2/5]

template<class Point , class NurbsVector , class KnotsVector >
void CurveDeriveCpts ( ptrdiff_t  p,
const KnotsVector &  U,
const Point *  P,
const double  w,
size_t  pointCount,
const NurbsVector *  PW,
ptrdiff_t  d,
ptrdiff_t  r1,
ptrdiff_t  r2,
NurbsVector *  PK 
)

Calculate all difference forms of curve.

Calculate all (or some, optionally) difference forms of curve (characteristic derivatives).

◆ CurveDeriveCpts() [3/5]

template<class Point , class NurbsVector , class KnotsVector , class DoubleTriple >
void CurveDeriveCpts ( ptrdiff_t  p,
const KnotsVector &  U,
const Point *  P,
const double *  W,
size_t  pointCount,
const NurbsVector *  PW,
ptrdiff_t  d,
ptrdiff_t  r1,
ptrdiff_t  r2,
DoubleTriple **  DT,
double **  WT 
)

Calculate all difference forms of curve.

Calculate all (or some, optionally) difference forms of curve (characteristic derivatives).

◆ CurveDeriveCpts() [4/5]

template<class Point , class NurbsVector , class KnotsVector , class DoubleTriple >
void CurveDeriveCpts ( ptrdiff_t  p,
const KnotsVector &  U,
const Point *  P,
const double  w,
size_t  pointCount,
const NurbsVector *  PW,
ptrdiff_t  d,
ptrdiff_t  r1,
ptrdiff_t  r2,
DoubleTriple **  DT,
double **  WT 
)

Calculate all difference forms of curve.

Calculate all (or some, optionally) difference forms of curve (characteristic derivatives).

◆ CurveDeriveCpts() [5/5]

template<class Point , class Homogeneous >
void CurveDeriveCpts ( ptrdiff_t  p,
const double *  U,
const Point *  P,
const double *  W,
size_t  pointCount,
ptrdiff_t  r1,
ptrdiff_t  r2,
Homogeneous *  H0,
Homogeneous *  H1,
Homogeneous *  H2,
Homogeneous *  H3 
)

Calculate all difference forms of curve.

Calculate all (or some, optionally) difference forms of curve (characteristic derivatives).

◆ CheckParam()

void CheckParam ( const double &  tMin,
const double &  tMax,
bool  closed,
double &  t 
)
inline

Reduce "t" to parameter in the parametric domain of the curve.

Parameters
[in]tMin,tMax- Parameters which define the parametric region of the curve.
[in]closed- An attribute of curve closedness.
[in,out]t- Initial parameter.

◆ CalculateSplines()

template<class KnotsVector , class DoubleVector1 , class DoubleVector2 >
ptrdiff_t CalculateSplines ( size_t  degree,
const KnotsVector &  knots,
bool  closed,
double &  t,
DoubleVector1 &  nsplines,
DoubleVector2 &  lrVect 
)

Calculate non-zero splines with a given parameter.

Parameters
[in]degree- B-spline degree.
[in]knots- Knots.
[in]closed- A closedness attribute.
[in,out]t- A parameter
[out]nsplines- Array (dimension is "degree") is filled by spline values.
[out]lrVect- An assisting array (contains garbage).
Returns
The number of the first non-zero B-spline.

◆ Swap()

template<class Type >
void Swap ( Type *  arr,
size_t  ind1,
size_t  ind2 
)

Swapping of 2 elements in the array.

Swapping of given elements in the array.

Parameters
[out]base- Pointer to the array.
[in]ind1- Index of the first element.
[in]ind2- Index of the second element.

◆ InsertSort()

template<class Type , class Type2 , class Type3 >
void InsertSort ( Type *  base,
size_t  num,
KsQSortCompFunc  compareFunc,
Type2 *  base2 = nullptr,
Type3 *  base3 = nullptr 
)

An array sorting with an ability of synchronous rearrangement in two other specified arrays. Effective for small arrays.

First array is sorted in ascending order. Elements of the second and third arrays are rearranged synchronously with the first one. Assumed that arrays have the same size.

Parameters
[out]base- Pointer to the first array to sort.
[in]num- Number of elements in the array.
[in]compareFunc- Pointer to the comparison function for the elements of the first array. Analog of strcmp for strings, supplied by user for comparing the array elements. Accepts 2 pointers to elements and returns: negative value, if 1<2; 0, if 1=2; positive value, if 1>2.
[out]base2- Pointer to the second array (could be nullptr).
[out]base3- Pointer to the third array (could be nullptr).

◆ QuickSort()

template<class Type , class Type2 , class Type3 >
void QuickSort ( Type *  base,
size_t  num,
KsQSortCompFunc  compareFunc,
Type2 *  base2 = nullptr,
Type3 *  base3 = nullptr 
)

An array sorting with an ability of synchronous rearrangement in two other specified arrays. Works with arrays of elements which support assignment operators. Not guarantees preserving of the order of equal elements.

First array is sorted in ascending order. Elements of the second and third arrays are rearranged synchronously with the first one. Assumed that arrays have the same size.

Parameters
[out]base- Pointer to the first array to sort.
[in]num- Number of elements in the array.
[in]compareFunc- Pointer to the comparison function for the elements of the first array. Analog of strcmp for strings, supplied by user for comparing the array elements. Accepts 2 pointers to elements and returns: negative value, if 1<2; 0, if 1=2, positive value, if 1>2.
[out]base2- Pointer to the second array (could be nullptr).
[out]base3- Pointer to the third array (could be nullptr).