EHS
ehs::Math Class Reference

#include <Math.h>

Static Public Member Functions

static bool AbsCmp (float a, float b)
 Absolute tolerance comparison for single precision floats. More...
 
static bool AbsCmp (double a, double b)
 Absolute tolerance comparison for double precision floats. More...
 
static bool RelCmp (float a, float b)
 Relative tolerance comparison for single precision floats. More...
 
static bool RelCmp (double a, double b)
 Relative tolerance comparison for double precision floats. More...
 
static bool ComCmp (float a, float b)
 Combined absolute and relative tolerance comparison for single precision floats. More...
 
static bool ComCmp (double a, double b)
 Combined absolute and relative tolerance comparison for double precision floats. More...
 
template<typename T = float>
static T Max (const T a, const T b)
 
template<typename T = float>
static T Min (const T a, const T b)
 
template<typename T = float>
static T Clamp (const T value, const T min, const T max)
 
template<typename T = float>
static T Abs (const T from)
 
template<typename T = float>
static constexpr T Pi ()
 
template<typename T = float>
static T Rads (const T from)
 
template<typename T = float>
static T Degr (const T from)
 
template<typename T = float>
static T Exp (const T x)
 
template<typename T = float>
static T Ln_Taylor (T x)
 
template<typename T = float>
static T Ln (T x)
 
template<typename T = float, typename I = float>
static T Pow (const T base, const I exponent)
 
template<typename T = float>
static T Log10 (const T x)
 
static float Near (const float from)
 
static double Near (const double from)
 
static float Floor (const float from)
 
static double Floor (const double from)
 
static float Ceil (const float from)
 
static double Ceil (const double from)
 
static float Trunc (const float from)
 
static double Trunc (const double from)
 
static float Mod (const float from, const float divisor)
 
static double Mod (const double from, const double divisor)
 
template<typename T = float>
static T Sqrt (const T from)
 
static double Sqrt (const double from)
 
static float Sqrt (const float from)
 
template<typename R = float>
static R Sin (const R angle, const R precision=0.001)
 
template<typename R = float, typename T = UInt_64>
static R ASin (const R yPos, const T precision=10)
 
template<typename R = float>
static R Cos (const R angle, const R precision=0.001)
 
template<typename R = float, typename T = UInt_64>
static R ACos (const R xPos, const T precision=10)
 
template<typename R = float>
static R Tan (const R angle, const R precision=0.001)
 
template<typename R = float, typename T = UInt_64>
static R ATan (const R x, const T precision=1)
 
template<typename R = float>
static R Cot (const R x, const R precision=0.001)
 
template<typename T = UInt_64>
static T Fact (const T n)
 
template<typename R = float, typename T = UInt_64>
static R Combination (const T n, const T k)
 
template<typename R = float, typename T = UInt_64>
static R B (const T n)
 

Static Public Attributes

static constexpr float fltEpsilon = 1e-7f
 
static constexpr double dblEpsilon = 1e-16
 

Member Function Documentation

◆ Abs()

template<typename T = float>
static T ehs::Math::Abs ( const T  from)
inlinestatic

◆ AbsCmp() [1/2]

bool ehs::Math::AbsCmp ( double  a,
double  b 
)
static

Absolute tolerance comparison for double precision floats.

◆ AbsCmp() [2/2]

bool ehs::Math::AbsCmp ( float  a,
float  b 
)
static

Absolute tolerance comparison for single precision floats.

◆ ACos()

template<typename R = float, typename T = UInt_64>
static R ehs::Math::ACos ( const R  xPos,
const T  precision = 10 
)
inlinestatic

A trigonometry Arc Cosine function for finding the Z-Axis angle form the X-Axis position.

Template Parameters
RBaseInput and result data type.
TPrecision data type.
Parameters
[in]xPosThe position from the X-Axis.
[in]precisionSigma max.
Returns
The Z-Axis angle.

◆ ASin()

template<typename R = float, typename T = UInt_64>
static R ehs::Math::ASin ( const R  yPos,
const T  precision = 10 
)
inlinestatic

◆ ATan()

template<typename R = float, typename T = UInt_64>
static R ehs::Math::ATan ( const R  x,
const T  precision = 1 
)
inlinestatic

◆ B()

template<typename R = float, typename T = UInt_64>
static R ehs::Math::B ( const T  n)
inlinestatic

◆ Ceil() [1/2]

static double ehs::Math::Ceil ( const double  from)
static

◆ Ceil() [2/2]

static float ehs::Math::Ceil ( const float  from)
static

◆ Clamp()

template<typename T = float>
static T ehs::Math::Clamp ( const T  value,
const T  min,
const T  max 
)
inlinestatic

◆ Combination()

template<typename R = float, typename T = UInt_64>
static R ehs::Math::Combination ( const T  n,
const T  k 
)
inlinestatic

◆ ComCmp() [1/2]

bool ehs::Math::ComCmp ( double  a,
double  b 
)
static

Combined absolute and relative tolerance comparison for double precision floats.

◆ ComCmp() [2/2]

bool ehs::Math::ComCmp ( float  a,
float  b 
)
static

Combined absolute and relative tolerance comparison for single precision floats.

◆ Cos()

template<typename R = float>
static R ehs::Math::Cos ( const R  angle,
const R  precision = 0.001 
)
inlinestatic

A trigonometry Cosine function for finding the X-Axis position from the Z-Axis angle.

Template Parameters
RBaseInput and result data type.
TPrecision data type.
Parameters
[in]angleThe angle in radians from the Z-Axis.
[in]precisionSigma max.
Returns
The X-Axis position.

◆ Cot()

template<typename R = float>
static R ehs::Math::Cot ( const R  x,
const R  precision = 0.001 
)
inlinestatic

◆ Degr()

template<typename T = float>
static T ehs::Math::Degr ( const T  from)
inlinestatic

Converts radians into degrees.

Template Parameters
TThe data type to return;
Parameters
[in]fromThe value to convert to degrees.
Returns
The value in degrees.

◆ Exp()

template<typename T = float>
static T ehs::Math::Exp ( const T  x)
inlinestatic

◆ Fact()

template<typename T = UInt_64>
static T ehs::Math::Fact ( const T  n)
inlinestatic

◆ Floor() [1/2]

static double ehs::Math::Floor ( const double  from)
static

◆ Floor() [2/2]

static float ehs::Math::Floor ( const float  from)
static

◆ Ln()

template<typename T = float>
static T ehs::Math::Ln ( x)
inlinestatic

◆ Ln_Taylor()

template<typename T = float>
static T ehs::Math::Ln_Taylor ( x)
inlinestatic

◆ Log10()

template<typename T = float>
static T ehs::Math::Log10 ( const T  x)
inlinestatic

◆ Max()

template<typename T = float>
static T ehs::Math::Max ( const T  a,
const T  b 
)
inlinestatic

◆ Min()

template<typename T = float>
static T ehs::Math::Min ( const T  a,
const T  b 
)
inlinestatic

◆ Mod() [1/2]

double ehs::Math::Mod ( const double  from,
const double  divisor 
)
static

◆ Mod() [2/2]

float ehs::Math::Mod ( const float  from,
const float  divisor 
)
static

◆ Near() [1/2]

static double ehs::Math::Near ( const double  from)
static

◆ Near() [2/2]

static float ehs::Math::Near ( const float  from)
static

◆ Pi()

template<typename T = float>
static constexpr T ehs::Math::Pi ( )
inlinestaticconstexpr

Retrieves a very accurate version of Pi as a long double and converts it.

Template Parameters
TThe data type to return Pi as.
Returns
The result.

◆ Pow()

template<typename T = float, typename I = float>
static T ehs::Math::Pow ( const T  base,
const I  exponent 
)
inlinestatic

A method for use of exponents.

Template Parameters
TThe data type to return;
IThe data type to use as the exponent.
Parameters
[in]fromThe value to use the exponent on.
[in]ofThe exponent.
Returns
The result.

◆ Rads()

template<typename T = float>
static T ehs::Math::Rads ( const T  from)
inlinestatic

Converts degrees into radians.

Template Parameters
TThe data type to return;
Parameters
[in]fromThe value to convert to radians.
Returns
The value in radians.

◆ RelCmp() [1/2]

bool ehs::Math::RelCmp ( double  a,
double  b 
)
static

Relative tolerance comparison for double precision floats.

◆ RelCmp() [2/2]

bool ehs::Math::RelCmp ( float  a,
float  b 
)
static

Relative tolerance comparison for single precision floats.

◆ Sin()

template<typename R = float>
static R ehs::Math::Sin ( const R  angle,
const R  precision = 0.001 
)
inlinestatic

◆ Sqrt() [1/3]

double ehs::Math::Sqrt ( const double  from)
static

◆ Sqrt() [2/3]

float ehs::Math::Sqrt ( const float  from)
static

◆ Sqrt() [3/3]

template<typename T = float>
static T ehs::Math::Sqrt ( const T  from)
inlinestatic

A method for retrieving the square root of a value.

Template Parameters
TThe data type to use.
Parameters
[in]fromThe value to retrieve to square root of.
Returns
The result.

◆ Tan()

template<typename R = float>
static R ehs::Math::Tan ( const R  angle,
const R  precision = 0.001 
)
inlinestatic

◆ Trunc() [1/2]

static double ehs::Math::Trunc ( const double  from)
static

◆ Trunc() [2/2]

static float ehs::Math::Trunc ( const float  from)
static

Member Data Documentation

◆ dblEpsilon

constexpr double ehs::Math::dblEpsilon = 1e-16
staticconstexpr

◆ fltEpsilon

constexpr float ehs::Math::fltEpsilon = 1e-7f
staticconstexpr

The documentation for this class was generated from the following files: