C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2
alg_base.h File Reference

Common auxiliary functions. More...

`#include <templ_s_array.h>`
`#include <templ_array2.h>`
`#include <mb_rect.h>`
`#include <mb_placement3d.h>`
`#include <mb_cart_point.h>`
`#include <mb_cart_point3d.h>`
`#include <mb_enum.h>`
`#include <math_version.h>`
`#include <limits.h>`
`#include <vector>`

## Namespaces

c3d
C3D namespace declaration.

## Functions

double c3d::CalcAngle0X (double dx, double dy)
Calculate angle between line and 0X-axis. More...

long double c3d::CalcAngle0X (long double dx, long double dy)
Calculate the angle between a line and 0X-axis. More...

double c3d::CalcAngle0X (const MbCartPoint &p1, const MbCartPoint &p2)
Calculate the angle between a line and 0X-axis. More...

double & c3d::NormalizeAngle (double &angle, double angleEpsilon=Math::AngleEps)
Normalize an angle. More...

void c3d::AngleToParam (double dir, bool left, double &t)
Transform a circle angle to the curve parameter. More...

template<class Type >
double c3d::AngleBetweenVectors (const Type &v1, const Type &v2)
Calculate the angle between two-dimensional vectors. More...

double c3d::CalcAngle3Points (const MbCartPoint &p1, const MbCartPoint &centre, const MbCartPoint &p3)
Calculate the minimal angle between lines. More...

template<class ParamsVector >
bool c3d::ArFind (const ParamsVector &arParam, double t, ptrdiff_t &id)
Find a parameter in the array. More...

MbCartPoint c3d::LineSegDivide (const MbCartPoint &p1, const MbCartPoint &p2)
Split segment by the middle. More...

ptrdiff_t c3d::mod (ptrdiff_t i, ptrdiff_t n)
I by modulo n (cyclic case).

int c3d::Sign (double a)
Determination of the sign of a real number.

int c3d::Round (double x)
Round-off the real number.

int32 c3d::LRound (double x)
Round-off the real number.

int32 c3d::CheckLRound (double x)
Round-off the real number with validation.

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

## Detailed Description

Common auxiliary functions.