C3D Kernel  104598
Base Algorithms
Geometric Construction Methods
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...

## Defines

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

## Functions

double & c3d::NormalizeAngle (double &angle, double angleEpsilon=Math::AngleEps)
Normalize an angle.
template<class Type >
double c3d::AngleBetweenVectors (const Type &v1, const Type &v2)
Calculate the angle between two vectors.
template<class Vector >
bool c3d::ArFind (const Vector &arParam, double t, ptrdiff_t &id)
Find a parameter in the array.
bool c3d::InRange (double x1, double x2, double x)
Check if the number is in range [x1, x2].
bool c3d::IsParamOn (double tmin, double tmax, double t, double treg)
Check if parameter is in the range of the curve.
bool c3d::InRangePlus (double x1, double x, double eps=FLT_EPSILON)
Check if the number is in range [0, x1).
template<class TypeVector >
bool c3d::IsMonotonic (const TypeVector &items, bool isAscending, bool allowEqual=false)
Whether vector of objects is ascending or descending.
template<class Point , class Vector >
bool c3d::ArePointsOnLine (const SArray< Point > &pnts, double metricEps=METRIC_EPSILON)
Whether points lie on the line.
template<class Point , class Vector >
bool c3d::ArePointsOnLine (const std::vector< Point > &pnts, double metricEps=METRIC_EPSILON)
Whether points lie on the line.
template<class PointsVector >
bool c3d::IsPlanar (const PointsVector &pnts, MbPlacement3D *place, double mEps=METRIC_EPSILON)
Whether the set of points lies on plane.
template<class Point >
bool c3d::IsPlanar2 (const Array2< Point > &pnts, MbPlacement3D *place, double mEps=METRIC_EPSILON)
Whether the set of points lies on plane.
template<class DoubleVector >
void c3d::SetLimitParam (DoubleVector &tarr, double tmin, double tmax, double teps=Math::paramEpsilon)
Set the range of parameter.
void SortSynchroArrays (SArray< double > &tt0, SArray< double > &tt2, double eps, bool checkCoincidentParams)
Sort the array.
void SortArray (SArray< double > &tt0, double eps, bool checkCoincidentParams)
Sort the array.
void CorrectParameter (bool pext, bool pc, double pmin, double pmax, double &p, double eps=Math::paramRegion)
Refine the parameter.
bool CorrectCheckNearParameter (const double &tmin, const double &tmax, const double &tPeriod, const bool &ext, const double &tRegion, double &t)
Correction of parameter with validation.
bool MatrixRoughInverse (const MbPlacement3D &place3D, const MbDirection *pDir, const MbVector3D &seeY, const MbVector3D &seeZ, MbMatrix &matrix)
Determine the inversion matrix of roughness symbol.
bool MatrixTextInverse (const MbPlacement3D &place3D, const MbDirection *pDir, const MbVector3D &seeY, const MbVector3D &seeZ, MbMatrix &matrix)
Determine the inversion matrix of text.
bool RoundedValue (double &value, uint8 n)
The value is rounded to n significant digits.
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.
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.
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.
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.
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.
void EigenVector (double a[c3d::SPACE_DIM][c3d::SPACE_DIM], MbVector3D &vect)
Determine the eigenvector of 3 x 3 matrix.
template<class Point >
bool c3d::EqualPoints (const Point &p1, const Point &p2, double eps)
Check points for equality.
template<class Vector >
bool c3d::EqualVectors (const Vector &p1, const Vector &p2, double eps)
Check equality of vectors with given tolerance.
template<class Matrix >
bool c3d::EqualMatrices (const Matrix &m1, const Matrix &m2, double accuracy)
Compare matrices.
void c3d::GetCosSin (const double &tt, double &cosT, double &sinT)
Calculation of the cosine and sine.
template<class Type >
double GetParamDistance (const Type &p1, const Type &p2, MbeSplineParamType spType)
Get a measure of the distance.
bool IsValidNurbsParams (ptrdiff_t degree, bool closed, size_t pcnt)
Check initialization parameters of a nurbs-object.
bool IsValidNurbsParams (ptrdiff_t degree, bool closed, size_t pcnt, size_t wcnt)
Check initialization parameters of a nurbs-object.
bool IsValidNurbsParams (ptrdiff_t degree, bool closed, size_t pcnt, size_t wcnt, size_t kcnt)
Check initialization parameters of a nurbs-object.
template<class KnotsVector >
bool IsValidNurbsParamsExt (ptrdiff_t degree, bool closed, size_t pcnt, const KnotsVector &knots)
Check initialization parameters of a nurbs-curve.
template<class PointVector , class DoubleVector >
bool IsValidNurbsParamsExt (ptrdiff_t degree, bool closed, const PointVector &pnts, const DoubleVector *wts, const DoubleVector *knots=NULL)
Check initialization parameters of a nurbs-curve.
template<class KnotsVector >
bool IsValidNurbsKnots (const KnotsVector &knots, double eps=EXTENT_EPSILON)
Check knots vector of a nurbs-object.
template<class KnotsVector >
ptrdiff_t KnotIndex (ptrdiff_t degree, const KnotsVector &knots, double &t)
Definition of "left" knot index for the first non-zero function.
template<class KnotsVector >
ptrdiff_t DefineKnotsVector (ptrdiff_t degree, bool closed, ptrdiff_t uppPointsIndex, KnotsVector &knots)
Define knot vector (uniform parameterization).
bool DefineKnotsVector (ptrdiff_t degree, bool closed, size_t count, const SArray< double > *params, SArray< double > &knots)
Define knot vector.
template<class Points , class Params >
bool DefineThroughPointsParams (const Points &points, MbeSplineParamType spType, bool closed, Params &params)
Define parametric distribution of points.
template<class Knots , class DoubleVector >
bool BasisFuns (ptrdiff_t i, double t, ptrdiff_t p, const Knots &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)).
template<class DoubleVector >
bool CalcBsplvb (const DoubleVector &knots, double t, ptrdiff_t left, ptrdiff_t degree, DoubleVector &biatx, DoubleVector &lrVect)
void AllBasisFuns (ptrdiff_t i, double t, ptrdiff_t p, const SArray< double > &knots, double **ndu, double *left, double *right, bool newPatch=true)
void AllBasisFuns (ptrdiff_t i, double t, ptrdiff_t p, const SArray< double > &knots, double *ndu, size_t degree, double *left, double *right, bool newPatch=true)
bool CalcDBsplvb (const SArray< double > &knots, ptrdiff_t degree, double t, ptrdiff_t left, ptrdiff_t n, Array2< double > &values)
Calculate values and derivatives of basic spline.
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.
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.
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.
void CheckParam (const double &tMin, const double &tMax, bool closed, double &t)
Reduce "t" to parameter in the parametric domain of the curve.
template<class KnotsVector , class DoubleVector1 , class DoubleVector2 >
ptrdiff_t CalculateSplines (ptrdiff_t degree, const KnotsVector &knots, bool closed, double &t, DoubleVector1 &nsplines, DoubleVector2 &lrVect)
Calculate non-zero splines with a given parameter.

## Define Documentation

 #define __REG_DUPLICATE_IMPL ( __CLASS )
Value:
```MbRefItem * copyItem = NULL;                            \
if ( iReg == NULL || !iReg->IsReg( this, copyItem ) ) { \
copyItem = new __CLASS;                               \
if ( iReg != NULL )                                   \
iReg->SetReg( this, copyItem );                     \
}
```

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

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

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

Parameters:
 [out] angle - The source angle to normalize. [in] angleEpsilon - Angular tolerance.
template<class Type >
 double c3d::AngleBetweenVectors ( const Type & v1, const Type & v2 )

Template function. Applicable for any vectors.

Parameters:
 [in] v1 - The first vector. [in] v2 - The second vector.
Returns:
The angle.
template<class Vector >
 bool c3d::ArFind ( const Vector & arParam, double t, ptrdiff_t & id ) ` [inline]`

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. [out] id - The index of the parameter found in the array.
Returns:
- true, if there are elements in the array,
otherwise false
 bool c3d::InRange ( double x1, double x2, double x ) ` [inline]`

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.
 bool c3d::IsParamOn ( double tmin, double tmax, double t, double treg ) ` [inline]`

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.
 bool c3d::InRangePlus ( double x1, double x, double eps = `FLT_EPSILON` ) ` [inline]`

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.
template<class TypeVector >
 bool c3d::IsMonotonic ( const TypeVector & items, bool isAscending, bool allowEqual = `false` )

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.
template<class Point , class Vector >
 bool c3d::ArePointsOnLine ( const SArray< Point > & pnts, double metricEps = `METRIC_EPSILON` )

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.
template<class Point , class Vector >
 bool c3d::ArePointsOnLine ( const std::vector< Point > & pnts, double metricEps = `METRIC_EPSILON` )

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.
template<class PointsVector >
 bool c3d::IsPlanar ( const PointsVector & pnts, MbPlacement3D * place, double mEps = `METRIC_EPSILON` )

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.
template<class Point >
 bool c3d::IsPlanar2 ( const Array2< Point > & pnts, MbPlacement3D * place, double mEps = `METRIC_EPSILON` )

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.
template<class DoubleVector >
 void c3d::SetLimitParam ( DoubleVector & tarr, double tmin, double tmax, double teps = `Math::paramEpsilon` )

Set (reparametrize) range of parameter in the array.

Parameters:
 [in,out] params - The array of parameters sorted in ascending order. [in] pmin - Minimal value of parameter. [in] pmax - Maximal value of parameter.
 void SortSynchroArrays ( SArray< double > & tt0, SArray< double > & tt2, double eps, bool checkCoincidentParams )

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.
 void SortArray ( SArray< double > & tt0, double eps, bool checkCoincidentParams )

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.
 void CorrectParameter ( bool pext, bool pc, double pmin, double pmax, double & p, double eps = `Math::paramRegion` )

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.
 bool CorrectCheckNearParameter ( const double & tmin, const double & tmax, const double & tPeriod, const bool & ext, const double & tRegion, double & t )

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.
 bool MatrixRoughInverse ( const MbPlacement3D & place3D, const MbDirection * pDir, const MbVector3D & seeY, const MbVector3D & seeZ, MbMatrix & matrix )

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
 bool MatrixTextInverse ( const MbPlacement3D & place3D, const MbDirection * pDir, const MbVector3D & seeY, const MbVector3D & seeZ, MbMatrix & matrix )

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
 bool RoundedValue ( double & value, uint8 n )

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

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

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

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

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.
 int Degree4Equation ( double a, double b, double c, double d, double e, double * x, double epsilon )

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.
 void EigenVector ( double a[c3d::SPACE_DIM][c3d::SPACE_DIM], MbVector3D & vect )

Determine the eigenvector of 3 x 3 matrix.

Parameters:
 [in] a - 3 x 3 matrix. [out] vect - The eigenvector of matrix.
template<class Point >
 bool c3d::EqualPoints ( const Point & p1, const Point & p2, double eps )

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.
template<class Vector >
 bool c3d::EqualVectors ( const Vector & p1, const Vector & p2, double eps )

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.
template<class Matrix >
 bool c3d::EqualMatrices ( const Matrix & m1, const Matrix & m2, double accuracy )

Tolerant comparison of two matrices.

Parameters:
 [in] m1,m2 - Initial matrices. [in] accuracy - A tolerance.
Returns:
Returns true if matrices are equal,
false otherwise.
 void c3d::GetCosSin ( const double & tt, double & cosT, double & sinT ) ` [inline]`

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.
template<class Type >
 double GetParamDistance ( const Type & p1, const Type & p2, MbeSplineParamType spType )

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.
 bool IsValidNurbsParams ( ptrdiff_t degree, bool closed, size_t pcnt ) ` [inline]`

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.
 bool IsValidNurbsParams ( ptrdiff_t degree, bool closed, size_t pcnt, size_t wcnt ) ` [inline]`

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.
 bool IsValidNurbsParams ( ptrdiff_t degree, bool closed, size_t pcnt, size_t wcnt, size_t kcnt ) ` [inline]`

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.
template<class KnotsVector >
 bool IsValidNurbsParamsExt ( ptrdiff_t degree, bool closed, size_t pcnt, const KnotsVector & knots )

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.
template<class PointVector , class DoubleVector >
 bool IsValidNurbsParamsExt ( ptrdiff_t degree, bool closed, const PointVector & pnts, const DoubleVector * wts, const DoubleVector * knots = `NULL` )

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.
template<class KnotsVector >
 bool IsValidNurbsKnots ( const KnotsVector & knots, double eps = `EXTENT_EPSILON` )

Check knots vector of a nurbs-object.

Parameters:
 [in] knots - Knots vector.
Returns:
Returns true if parameters are consistent.
template<class KnotsVector >
 ptrdiff_t KnotIndex ( ptrdiff_t degree, const KnotsVector & knots, double & t )

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.
template<class KnotsVector >
 ptrdiff_t DefineKnotsVector ( ptrdiff_t degree, bool closed, ptrdiff_t uppPointsIndex, KnotsVector & knots )

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.
 bool DefineKnotsVector ( ptrdiff_t degree, bool closed, size_t count, const SArray< double > * params, SArray< double > & knots )

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). [out] knots - Knots vector.
Returns:
Returns true if result is success.
template<class Points , class Params >
 bool DefineThroughPointsParams ( const Points & points, MbeSplineParamType spType, bool closed, Params & params )

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.
template<class Knots , class DoubleVector >
 bool BasisFuns ( ptrdiff_t i, double t, ptrdiff_t p, const Knots & 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)). 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.
template<class DoubleVector >
 bool CalcBsplvb ( const DoubleVector & knots, double t, ptrdiff_t left, ptrdiff_t degree, DoubleVector & biatx, DoubleVector & lrVect )

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

 void AllBasisFuns ( ptrdiff_t i, double t, ptrdiff_t p, const SArray< double > & knots, double ** ndu, double * left, double * right, bool newPatch = `true` )

Calculation of B - basis (using working pointers to nurbs curves and surfaces).

 void AllBasisFuns ( ptrdiff_t i, double t, ptrdiff_t p, const SArray< double > & knots, double * ndu, size_t degree, double * left, double * right, bool newPatch = `true` )

Calculation of B - basis (using working pointers to nurbs curves and surfaces).

 bool CalcDBsplvb ( const SArray< double > & knots, ptrdiff_t degree, double t, ptrdiff_t left, ptrdiff_t n, Array2< double > & values )
Parameters:
 [in] t - Curve parameter. [in] left - Knot number of the first nonzero spline. [in] n - Order of calculated derivatives. [out] values - 2D-Array filled by spline values.
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 (or some, optionally) difference forms of curve (characteristic derivatives).

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 (or some, optionally) difference forms of curve (characteristic derivatives).

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 (or some, optionally) difference forms of curve (characteristic derivatives).

 void CheckParam ( const double & tMin, const double & tMax, bool closed, double & t ) ` [inline]`
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.
template<class KnotsVector , class DoubleVector1 , class DoubleVector2 >
 ptrdiff_t CalculateSplines ( ptrdiff_t degree, const KnotsVector & knots, bool closed, double & t, DoubleVector1 & nsplines, DoubleVector2 & lrVect )
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.