C3D Toolkit
Kernel - 117982, Vision - 2.9.2.2
|
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 ¶ms) |
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... | |
#define __REG_DUPLICATE_IMPL | ( | __CLASS | ) |
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.
|
inline |
Normalize an angle.
Draw the source angle in range [0, 2*M_PI) if necessary.
[out] | angle | - The source angle to normalize. |
[in] | angleEpsilon | - Angular tolerance. |
double c3d::AngleBetweenVectors | ( | const Type & | v1, |
const Type & | v2 | ||
) |
Calculate the angle between two-dimensional vectors.
Calculate the angle between two-dimensional vectors.
[in] | v1 | - The first vector. |
[in] | v2 | - The second vector. |
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.
[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. |
|
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.
[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. |
|
inline |
Check if parameter is in the range of the curve.
Range of the curve is given by domain of curve parameters [tmin, tmax].
[in] | tmin | - Minimal value of parameter. |
[in] | tmax | - Maximal value of parameter. |
[in] | t | - Source parameter |
[in] | treg | - Accuracy of parameter. |
|
inline |
Check if the number is in range [0, x1).
x1 >= 0
[in] | x1 | - End of the source range. |
[in] | x | - The input number which should be checked. |
[in] | eps | - Tolerance. |
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.
[in] | items | - Vector of objects. |
[in] | isAscending | - Check for ascending. |
[in] | allowEqual | - Allow for equality of objects. |
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).
[in] | pnts | - Point set. |
[in] | metricEps | - Check accuracy. |
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.
[in] | pnts | - Point set. |
[in,out] | place | - Points coordinate system. |
[in] | mEps | - Check accuracy. |
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.
[in] | pnts | - Point set. |
[in,out] | place | - Points coordinate system. |
[in] | mEps | - Check accuracy. |
bool c3d::CalculateBoundingBox | ( | const PointsVector & | pnts, |
BBox & | bbox | ||
) |
Calculate points bounding box.
Calculate points bounding box.
[in] | pnts | - Point set. |
[out] | bbox | - Bounding box. |
bool c3d::CalculateBoundingBox2 | ( | const Array2< Point > & | pnts, |
BBox & | bbox | ||
) |
Calculate points bounding box.
Calculate points bounding box.
[in] | pnts | - Point set. |
[out] | bbox | - Bounding box. |
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.
[in,out] | tarr | - The array of parameters sorted in ascending order. |
[in] | tmin | - Minimal value of parameter. |
[in] | tmax | - Maximal value of parameter. |
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.
[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 | ( | 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.
[out] | tt0 | - Source array of parameters to sort. |
[in] | eps | - Parameters comparison tolerance. |
[in] | checkCoincidentParams | - Flag for checking of duplicate parameters. |
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.
[in] | period | - Period. |
[in] | p0 | - Initial approximation of the parameter. |
[in,out] | p | - The parameter to refine. |
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.
[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 | ||
) |
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].
[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. |
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.
[in] | place3D | - Local coordinate system. |
[in] | pDir | - Direction. |
[in] | seeY | - Screen Y-axis. |
[in] | seeZ | - Screen Z-axis. |
[out] | matrix | - Inversion matrix. |
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.
[in] | place3D | - Local coordinate system. |
[in] | pDir | - Direction. |
[in] | seeY | - Screen Y-axis. |
[in] | seeZ | - Screen Z-axis. |
[out] | matrix | - Inversion matrix. |
bool RoundedValue | ( | double & | value, |
uint8 | n | ||
) |
The value is rounded to n significant digits.
The value is rounded to n significant digits.
[in,out] | value | - The value. |
[in] | n | - Number of 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.
Solve a quadratic equation of the form a * x ^ 2 + b * x + c = 0 without external tolerance control.
[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. |
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.
[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. |
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.
[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. |
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.
[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. |
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.
[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. |
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.
[in] | a | - 3 x 3 matrix. |
[out] | vect | - The eigenvector of matrix. |
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.
[in] | p1 | - The first cartesian point. |
[in] | p2 | - The second cartesian point. |
[in] | eps | - Metric tolerance of points coincidence. |
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.
[in] | p1 | - The first vector. |
[in] | p2 | - The second vector. |
[in] | eps | - Coordinate tolerance. |
bool c3d::EqualMatrices | ( | const Matrix & | m1, |
const Matrix & | m2, | ||
double | accuracy | ||
) |
Compare matrices.
Tolerant comparison of two matrices.
[in] | m1,m2 | - Initial matrices. |
[in] | accuracy | - A tolerance. |
|
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.
[in] | tt | - Angle (in radians). |
[out] | cosT | - Cosine of the angle tt. |
[out] | sinT | - Sine of the angle tt. |
double GetParamDistance | ( | const Type & | p1, |
const Type & | p2, | ||
MbeSplineParamType | spType | ||
) |
Get a measure of the distance.
Get a measure of the distance.
[in] | p1,p2 | - Points between which the distance is computed. |
[in] | spType | - The parametrization type of spline objects. |
|
inline |
Check initialization parameters of a nurbs-object.
Check initialization parameters of a nurbs-object.
[in] | degree | - B-spline degree. |
[in] | closed | - A closedness attribute. |
[in] | pcnt | - Number of points. |
|
inline |
Check initialization parameters of a nurbs-object.
Check initialization parameters of a nurbs-object.
[in] | degree | - B-spline degree. |
[in] | closed | - A closedness attribute. |
[in] | pcnt | - Number of points. |
[in] | wcnt | - Number of weights. |
|
inline |
Check initialization parameters of a nurbs-object.
Check initialization parameters of a nurbs-object.
[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. |
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.
[in] | degree | - B-spline degree. |
[in] | closed | - A closedness attribute. |
[in] | pcnt | - Number of points. |
[in] | knots | - Knots vector. |
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.
[in] | degree | - B-spline degree. |
[in] | closed | - A closedness attribute. |
[in] | pnts | - Points vector. |
[in] | wts | - Weights vector. |
[in] | knots | - Knots vector. |
bool IsValidNurbsKnots | ( | const KnotsVector & | knots, |
double | eps = EXTENT_EPSILON |
||
) |
Check knots vector of a nurbs-object.
Check knots vector of a nurbs-object.
[in] | knots | - Knots vector. |
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.
[in] | degree | - B-spline degree. |
[in] | closed | - A closedness attribute. |
[in] | pointsCnt | - Number of points. |
[in,out] | knots | - Knots vector. |
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]).
[in] | degree | - B-spline degree. |
[in] | knots | - Knots. |
[in,out] | t | - A parameter value. |
ptrdiff_t DefineKnotsVector | ( | ptrdiff_t | degree, |
bool | closed, | ||
ptrdiff_t | uppPointsIndex, | ||
KnotsVector & | knots | ||
) |
Define knot vector (uniform parameterization).
Define knot vector (uniform parameterization).
[in] | degree | - B-spline degree. |
[in] | closed | - A closedness attribute. |
[in] | uppPointsIndex | - Last point index. |
[in] | knots | - Knots vector. |
bool DefineKnotsVector | ( | size_t | degree, |
bool | closed, | ||
size_t | count, | ||
const ParamsVector * | paramsPtr, | ||
size_t | kMode, | ||
KnotsVector & | knots | ||
) |
Define knot vector.
Define knot vector.
[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. |
bool DefineThroughPointsParams | ( | const PointsVector & | points, |
MbeSplineParamType | spType, | ||
bool | closed, | ||
ParamsVector & | params | ||
) |
Define parametric distribution of points.
Define parametric distribution of points.
[in] | points | - Points vector. |
[in] | spType | - The parameterization type of spline objects. |
[in] | closed | - A closedness attribute. |
[out] | params | - Parametric distribution of points. |
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.
[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. |
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.
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).
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).
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).
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).
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).
|
inline |
Reduce "t" to parameter in the parametric domain of the curve.
[in] | tMin,tMax | - Parameters which define the parametric region of the curve. |
[in] | closed | - An attribute of curve closedness. |
[in,out] | t | - Initial parameter. |
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.
[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). |
void Swap | ( | Type * | arr, |
size_t | ind1, | ||
size_t | ind2 | ||
) |
Swapping of 2 elements in the array.
Swapping of given elements in the array.
[out] | base | - Pointer to the array. |
[in] | ind1 | - Index of the first element. |
[in] | ind2 | - Index of the second element. |
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.
[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). |
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.
[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). |