xmscore  1.0
math.h File Reference
#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...
 

Detailed Description

Definition in file math.h.

Function Documentation

◆ Clamp()

template<typename _T >
_T xms::Clamp ( _T  a_in,
_T  a_min,
_T  a_max 
)

Returns a value between a_min and a_max.

Parameters
a_inValue to be clamped.
a_minMinimum value.
a_maxMaximum value.
Returns
Clamped value. macro

Definition at line 175 of file math.h.

References xms::Clamp(), xms::Mmax(), and xms::Mmin().

Referenced by xms::Clamp().

◆ EQ_EPS()

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

Parameters
Aleft hand side.
Bright hand side.
epsilonThe epsilon.
Returns
true or false. macro

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

◆ EQ_TOL()

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.

Parameters
Aleft hand side.
Bright hand side.
toleranceThe tolerance.
Returns
true or false.

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

◆ GT_EPS()

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

Parameters
Aleft hand side.
Bright hand side.
epsilonThe epsilon.
Returns
true or false. macro

Definition at line 217 of file math.h.

References xms::GT_EPS().

Referenced by xms::GT_EPS(), xms::GTEQ_EPS(), and xms::stPrecision().

◆ GT_TOL()

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.

Parameters
Aleft hand side.
Bright hand side.
toleranceThe tolerance.
Returns
true or false. macro

Definition at line 289 of file math.h.

References xms::GT_TOL().

Referenced by xms::GT_TOL(), and xms::GTEQ_TOL().

◆ GTEQ_EPS()

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

Parameters
Aleft hand side.
Bright hand side.
epsilonThe epsilon.
Returns
true or false. macro

Definition at line 241 of file math.h.

References xms::EQ_EPS(), xms::GT_EPS(), and xms::GTEQ_EPS().

Referenced by xms::GTEQ_EPS().

◆ GTEQ_TOL()

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.

Parameters
Aleft hand side.
Bright hand side.
tolThe tolerance.
Returns
true or false. macro

Definition at line 313 of file math.h.

References xms::EQ_TOL(), xms::GT_TOL(), and xms::GTEQ_TOL().

Referenced by xms::GTEQ_TOL().

◆ LT_EPS()

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

Parameters
Aleft hand side.
Bright hand side.
epsilonThe epsilon.
Returns
true or false. macro

Definition at line 205 of file math.h.

References xms::LT_EPS().

Referenced by xms::LT_EPS(), xms::LTEQ_EPS(), and xms::stPrecision().

◆ LT_TOL()

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.

Parameters
Aleft hand side.
Bright hand side.
toleranceThe tolerance.
Returns
true or false. macro

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

◆ LTEQ_EPS()

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

Parameters
Aleft hand side.
Bright hand side.
epsilonThe epsilon.
Returns
true or false. macro

Definition at line 229 of file math.h.

References xms::EQ_EPS(), xms::LT_EPS(), and xms::LTEQ_EPS().

Referenced by xms::LTEQ_EPS().

◆ LTEQ_TOL()

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.

Parameters
Aleft hand side.
Bright hand side.
tolThe tolerance.
Returns
true or false. macro

Definition at line 301 of file math.h.

References xms::EQ_TOL(), xms::LT_TOL(), and xms::LTEQ_TOL().

Referenced by xms::LTEQ_TOL().

◆ Mag()

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)

Parameters
xValue in x.
yValue in y.
zValue in z.
wValue in x.
Returns
Magnitude. macro

Definition at line 163 of file math.h.

References xms::Mag(), and xms::MagSquared().

Referenced by xms::Mag().

◆ MagSquared()

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)

Parameters
xValue in x.
yValue in y.
zValue in z.
wValue in x.
Returns
Magnitude squared. macro

Definition at line 150 of file math.h.

References xms::MagSquared().

Referenced by xms::Mag(), and xms::MagSquared().

◆ Mdist() [1/2]

template<class _T , class _U , class _V , class _W >
double xms::Mdist ( _T  x1,
_U  y1,
_V  x2,
_W  y2 
)

XY distance.

Parameters
x1X coordinate of first point.
y1Y coordinate of first point.
x2X coordinate of second point.
y2Y coordinate of second point.
Returns
XY distance. macro

Definition at line 109 of file math.h.

References xms::Mdist(), and xms::sqr().

Referenced by xms::Mdist().

◆ Mdist() [2/2]

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.

Parameters
x1X coordinate of first point.
y1Y coordinate of first point.
z1Z coordinate of first point.
x2X coordinate of second point.
y2Y coordinate of second point.
z2Z coordinate of second point.
Returns
XYZ distance. macro

Definition at line 137 of file math.h.

References xms::Mdist(), and xms::sqr().

◆ MdistSq()

template<class _T , class _U , class _V , class _W >
double xms::MdistSq ( _T  x1,
_U  y1,
_V  x2,
_W  y2 
)

XY distance squared.

Parameters
x1X coordinate of first point.
y1Y coordinate of first point.
x2X coordinate of second point.
y2Y coordinate of second point.
Returns
XY distance squared. macro

Definition at line 122 of file math.h.

References xms::MdistSq(), and xms::sqr().

Referenced by xms::MdistSq().

◆ Mfabs()

template<class _T >
_T xms::Mfabs ( _T  a)

Float absolute value.

Parameters
aThe value.
Returns
non-negative value macro

Definition at line 40 of file math.h.

References xms::Mfabs().

Referenced by xms::Mfabs().

◆ Miabs()

template<class _T >
_T xms::Miabs ( _T  a)

Integer absolute value.

Parameters
aThe value.
Returns
non-negative value macro

Definition at line 30 of file math.h.

References xms::Miabs().

Referenced by xms::Miabs(), xms::stPrecision(), and xms::STRstd().

◆ Mmax()

template<class _T , class _U >
_T xms::Mmax ( _T  a,
_U  b 
)

Max of two values.

Parameters
aThe first value.
bThe second value.
Returns
Max value macro

Definition at line 51 of file math.h.

References xms::Mmax().

Referenced by xms::Clamp(), and xms::Mmax().

◆ Mmax3()

template<class _T , class _U , class _V >
_T xms::Mmax3 ( _T  a,
_U  b,
_V  c 
)

Max of three values.

Parameters
aThe first value.
bThe second value.
cThe third value.
Returns
Max value macro

Definition at line 74 of file math.h.

References xms::Mmax3().

Referenced by xms::Mmax3().

◆ Mmin()

template<class _T , class _U >
_T xms::Mmin ( _T  a,
_U  b 
)

Min of two values.

Parameters
aThe first value.
bThe second value.
Returns
Min value macro

Definition at line 62 of file math.h.

References xms::Mmin().

Referenced by xms::Clamp(), and xms::Mmin().

◆ Mmin3()

template<class _T , class _U , class _V >
_T xms::Mmin3 ( _T  a,
_U  b,
_V  c 
)

Min of three values.

Parameters
aThe first value.
bThe second value.
cThe third value.
Returns
Min value macro

Definition at line 86 of file math.h.

References xms::Mmin3().

Referenced by xms::Mmin3().

◆ Round()

template<class _T >
int xms::Round ( _T  a)

Rounds.

Parameters
aThe value.
Returns
int macro

Definition at line 20 of file math.h.

References xms::Round().

Referenced by xms::Round(), and xms::stPrecision().

◆ sqr()

template<typename _T >
_T xms::sqr ( const _T  x)
inline

Square.

Parameters
xThe value to square.
Returns
The value squared macro

Definition at line 96 of file math.h.

References xms::sqr().

Referenced by xms::Mdist(), xms::MdistSq(), and xms::sqr().