xmscore
1.0
|
#include <cmath>
Go to the source code of this file.
Functions | |
template<class _T > | |
int | xms::Round (_T a) |
Rounds. More... | |
template<class _T > | |
_T | xms::Miabs (_T a) |
Integer absolute value. More... | |
template<class _T > | |
_T | xms::Mfabs (_T a) |
Float absolute value. More... | |
template<class _T , class _U > | |
_T | xms::Mmax (_T a, _U b) |
Max of two values. More... | |
template<class _T , class _U > | |
_T | xms::Mmin (_T a, _U b) |
Min of two values. More... | |
template<class _T , class _U , class _V > | |
_T | xms::Mmax3 (_T a, _U b, _V c) |
Max of three values. More... | |
template<class _T , class _U , class _V > | |
_T | xms::Mmin3 (_T a, _U b, _V c) |
Min of three values. More... | |
template<typename _T > | |
_T | xms::sqr (const _T x) |
Square. More... | |
template<class _T , class _U , class _V , class _W > | |
double | xms::Mdist (_T x1, _U y1, _V x2, _W y2) |
XY distance. More... | |
template<class _T , class _U , class _V , class _W > | |
double | xms::MdistSq (_T x1, _U y1, _V x2, _W y2) |
XY distance squared. More... | |
template<typename X1 , typename Y1 , typename Z1 , typename X2 , typename Y2 , typename Z2 > | |
double | xms::Mdist (X1 x1, Y1 y1, Z1 z1, X2 x2, Y2 y2, Z2 z2) |
XYZ distance. More... | |
template<typename _T > | |
double | xms::MagSquared (_T const x, _T const y, _T const z=0, _T const w=0) |
Magnituded squared (x*x + y*y + z*z + w*w) More... | |
template<typename _T > | |
double | xms::Mag (_T const x, _T const y, _T const z=0, _T const w=0) |
Magnituded sqrt(x*x + y*y + z*z + w*w) More... | |
template<typename _T > | |
_T | xms::Clamp (_T a_in, _T a_min, _T a_max) |
Returns a value between a_min and a_max. More... | |
template<class _T , class _U , class _V > | |
bool | xms::EQ_EPS (_T A, _U B, _V epsilon) |
Returns true if A == B within an epsilon (DBL EPS). More... | |
template<class _T , class _U , class _V > | |
bool | xms::LT_EPS (_T A, _U B, _V epsilon) |
Returns true if A < B equal within an epsilon (DBL EPS). More... | |
template<class _T , class _U , class _V > | |
bool | xms::GT_EPS (_T A, _U B, _V epsilon) |
Returns true if A > B equal within an epsilon (DBL EPS). More... | |
template<class _T , class _U , class _V > | |
bool | xms::LTEQ_EPS (_T A, _U B, _V epsilon) |
Returns true if A <= B equal within an epsilon (DBL EPS). More... | |
template<class _T , class _U , class _V > | |
bool | xms::GTEQ_EPS (_T A, _U B, _V epsilon) |
Returns true if A >= B equal within an epsilon (DBL EPS). More... | |
template<class _T , class _U , class _V > | |
bool | xms::EQ_TOL (const _T &A, const _U &B, const _V &tolerance) |
Returns true if A == B equal within a tolerance. More... | |
template<class _T , class _U , class _V > | |
bool | xms::LT_TOL (_T A, _U B, _V tolerance) |
Returns true if A < B equal within a tolerance. More... | |
template<class _T , class _U , class _V > | |
bool | xms::GT_TOL (_T A, _U B, _V tolerance) |
Returns true if A > B equal within a tolerance. More... | |
template<class _T , class _U , class _V > | |
bool | xms::LTEQ_TOL (_T A, _U B, _V tol) |
Returns true if A <= B equal within a tolerance. More... | |
template<class _T , class _U , class _V > | |
bool | xms::GTEQ_TOL (_T A, _U B, _V tol) |
Returns true if A >= B equal within a tolerance. More... | |
Definition in file math.h.
_T xms::Clamp | ( | _T | a_in, |
_T | a_min, | ||
_T | a_max | ||
) |
Returns a value between a_min and a_max.
a_in | Value to be clamped. |
a_min | Minimum value. |
a_max | Maximum value. |
Definition at line 175 of file math.h.
References xms::Clamp(), xms::Mmax(), and xms::Mmin().
Referenced by xms::Clamp().
bool xms::EQ_EPS | ( | _T | A, |
_U | B, | ||
_V | epsilon | ||
) |
Returns true if A == B within an epsilon (DBL EPS).
A | left hand side. |
B | right hand side. |
epsilon | The epsilon. |
Definition at line 193 of file math.h.
References xms::EQ_EPS().
Referenced by xms::EQ_EPS(), xms::GTEQ_EPS(), xms::LTEQ_EPS(), and xms::stPrecision().
bool xms::EQ_TOL | ( | const _T & | A, |
const _U & | B, | ||
const _V & | tolerance | ||
) |
Returns true if A == B equal within a tolerance.
A | left hand side. |
B | right hand side. |
tolerance | The tolerance. |
Definition at line 265 of file math.h.
References xms::EQ_TOL().
Referenced by xms::EQ_TOL(), xms::GTEQ_TOL(), xms::LTEQ_TOL(), xms::ltPt3< T >::operator()(), xms::ltPt3_2D< T >::operator()(), and xms::ltPt2< T >::operator()().
bool xms::GT_EPS | ( | _T | A, |
_U | B, | ||
_V | epsilon | ||
) |
Returns true if A > B equal within an epsilon (DBL EPS).
A | left hand side. |
B | right hand side. |
epsilon | The epsilon. |
Definition at line 217 of file math.h.
References xms::GT_EPS().
Referenced by xms::GT_EPS(), xms::GTEQ_EPS(), and xms::stPrecision().
bool xms::GT_TOL | ( | _T | A, |
_U | B, | ||
_V | tolerance | ||
) |
Returns true if A > B equal within a tolerance.
A | left hand side. |
B | right hand side. |
tolerance | The tolerance. |
Definition at line 289 of file math.h.
References xms::GT_TOL().
Referenced by xms::GT_TOL(), and xms::GTEQ_TOL().
bool xms::GTEQ_EPS | ( | _T | A, |
_U | B, | ||
_V | epsilon | ||
) |
Returns true if A >= B equal within an epsilon (DBL EPS).
A | left hand side. |
B | right hand side. |
epsilon | The epsilon. |
Definition at line 241 of file math.h.
References xms::EQ_EPS(), xms::GT_EPS(), and xms::GTEQ_EPS().
Referenced by xms::GTEQ_EPS().
bool xms::GTEQ_TOL | ( | _T | A, |
_U | B, | ||
_V | tol | ||
) |
Returns true if A >= B equal within a tolerance.
A | left hand side. |
B | right hand side. |
tol | The tolerance. |
Definition at line 313 of file math.h.
References xms::EQ_TOL(), xms::GT_TOL(), and xms::GTEQ_TOL().
Referenced by xms::GTEQ_TOL().
bool xms::LT_EPS | ( | _T | A, |
_U | B, | ||
_V | epsilon | ||
) |
Returns true if A < B equal within an epsilon (DBL EPS).
A | left hand side. |
B | right hand side. |
epsilon | The epsilon. |
Definition at line 205 of file math.h.
References xms::LT_EPS().
Referenced by xms::LT_EPS(), xms::LTEQ_EPS(), and xms::stPrecision().
bool xms::LT_TOL | ( | _T | A, |
_U | B, | ||
_V | tolerance | ||
) |
Returns true if A < B equal within a tolerance.
A | left hand side. |
B | right hand side. |
tolerance | The tolerance. |
Definition at line 277 of file math.h.
References xms::LT_TOL().
Referenced by xms::LT_TOL(), xms::LTEQ_TOL(), xms::ltPt3< T >::operator()(), xms::ltPt3_2D< T >::operator()(), xms::ltPt2< T >::operator()(), and xms::STRstd().
bool xms::LTEQ_EPS | ( | _T | A, |
_U | B, | ||
_V | epsilon | ||
) |
Returns true if A <= B equal within an epsilon (DBL EPS).
A | left hand side. |
B | right hand side. |
epsilon | The epsilon. |
Definition at line 229 of file math.h.
References xms::EQ_EPS(), xms::LT_EPS(), and xms::LTEQ_EPS().
Referenced by xms::LTEQ_EPS().
bool xms::LTEQ_TOL | ( | _T | A, |
_U | B, | ||
_V | tol | ||
) |
Returns true if A <= B equal within a tolerance.
A | left hand side. |
B | right hand side. |
tol | The tolerance. |
Definition at line 301 of file math.h.
References xms::EQ_TOL(), xms::LT_TOL(), and xms::LTEQ_TOL().
Referenced by xms::LTEQ_TOL().
double xms::Mag | ( | _T const | x, |
_T const | y, | ||
_T const | z = 0 , |
||
_T const | w = 0 |
||
) |
Magnituded sqrt(x*x + y*y + z*z + w*w)
x | Value in x. |
y | Value in y. |
z | Value in z. |
w | Value in x. |
Definition at line 163 of file math.h.
References xms::Mag(), and xms::MagSquared().
Referenced by xms::Mag().
double xms::MagSquared | ( | _T const | x, |
_T const | y, | ||
_T const | z = 0 , |
||
_T const | w = 0 |
||
) |
Magnituded squared (x*x + y*y + z*z + w*w)
x | Value in x. |
y | Value in y. |
z | Value in z. |
w | Value in x. |
Definition at line 150 of file math.h.
References xms::MagSquared().
Referenced by xms::Mag(), and xms::MagSquared().
double xms::Mdist | ( | _T | x1, |
_U | y1, | ||
_V | x2, | ||
_W | y2 | ||
) |
XY distance.
x1 | X coordinate of first point. |
y1 | Y coordinate of first point. |
x2 | X coordinate of second point. |
y2 | Y coordinate of second point. |
Definition at line 109 of file math.h.
References xms::Mdist(), and xms::sqr().
Referenced by xms::Mdist().
double xms::Mdist | ( | X1 | x1, |
Y1 | y1, | ||
Z1 | z1, | ||
X2 | x2, | ||
Y2 | y2, | ||
Z2 | z2 | ||
) |
XYZ distance.
x1 | X coordinate of first point. |
y1 | Y coordinate of first point. |
z1 | Z coordinate of first point. |
x2 | X coordinate of second point. |
y2 | Y coordinate of second point. |
z2 | Z coordinate of second point. |
Definition at line 137 of file math.h.
References xms::Mdist(), and xms::sqr().
double xms::MdistSq | ( | _T | x1, |
_U | y1, | ||
_V | x2, | ||
_W | y2 | ||
) |
XY distance squared.
x1 | X coordinate of first point. |
y1 | Y coordinate of first point. |
x2 | X coordinate of second point. |
y2 | Y coordinate of second point. |
Definition at line 122 of file math.h.
References xms::MdistSq(), and xms::sqr().
Referenced by xms::MdistSq().
_T xms::Mfabs | ( | _T | a | ) |
Float absolute value.
a | The value. |
Definition at line 40 of file math.h.
References xms::Mfabs().
Referenced by xms::Mfabs().
_T xms::Miabs | ( | _T | a | ) |
Integer absolute value.
a | The value. |
Definition at line 30 of file math.h.
References xms::Miabs().
Referenced by xms::Miabs(), xms::stPrecision(), and xms::STRstd().
_T xms::Mmax | ( | _T | a, |
_U | b | ||
) |
Max of two values.
a | The first value. |
b | The second value. |
Definition at line 51 of file math.h.
References xms::Mmax().
Referenced by xms::Clamp(), and xms::Mmax().
_T xms::Mmax3 | ( | _T | a, |
_U | b, | ||
_V | c | ||
) |
Max of three values.
a | The first value. |
b | The second value. |
c | The third value. |
Definition at line 74 of file math.h.
References xms::Mmax3().
Referenced by xms::Mmax3().
_T xms::Mmin | ( | _T | a, |
_U | b | ||
) |
Min of two values.
a | The first value. |
b | The second value. |
Definition at line 62 of file math.h.
References xms::Mmin().
Referenced by xms::Clamp(), and xms::Mmin().
_T xms::Mmin3 | ( | _T | a, |
_U | b, | ||
_V | c | ||
) |
Min of three values.
a | The first value. |
b | The second value. |
c | The third value. |
Definition at line 86 of file math.h.
References xms::Mmin3().
Referenced by xms::Mmin3().
int xms::Round | ( | _T | a | ) |
Rounds.
a | The value. |
Definition at line 20 of file math.h.
References xms::Round().
Referenced by xms::Round(), and xms::stPrecision().
|
inline |
Square.
x | The value to square. |
Definition at line 96 of file math.h.
References xms::sqr().
Referenced by xms::Mdist(), xms::MdistSq(), and xms::sqr().