TrueReality  v0.1.1912
trUtil::Math Namespace Reference

Functions

void SinCos (double x, double &sinVal, double &cosVal)
 Takes a Value X and outputs its Sin and Cos by reference. More...
 
void SinCos (float x, float &sinVal, float &cosVal)
 Takes a Value X and outputs its Sin and Cos by reference. More...
 
double Deg2Rad (double degree)
 Takes Degrees and converts them to Radians. More...
 
float Deg2Rad (float degree)
 Takes Degrees and converts them to Radians. More...
 
double Rad2Deg (double radian)
 Takes Radians and converts them to Degrees. More...
 
float Rad2Deg (float radian)
 Takes Radians and converts them to Degrees. More...
 
double CheckState (double state)
 Checks if State is = to 0, less then 0 or greater, and outputs -1, 0, 1. More...
 
float CheckState (float state)
 Checks if State is = to 0, less then 0 or greater, and outputs -1, 0, 1. More...
 
template<typename T >
Lerp (T from, T to, T alpha)
 Linear Interpolation function. More...
 

Variables

static const double PI = osg::PI
 / pi. More...
 
static const double PI_OVER_2 = osg::PI_2
 / pi/2. More...
 
static const double PI_OVER_4 = osg::PI_4
 / pi/4. More...
 
static const double TWO_PI = trUtil::Math::PI * 2.0
 / pi*2. More...
 
static const double FOUR_PI = trUtil::Math::PI * 4.0
 / pi*4. More...
 
static const double SQRT_PI = 1.77245385090551602729816748334
 / pi^(1/2) More...
 
static const double E = 2.7182818284590452354
 / e. More...
 
static const double LOG_OF_2 = osg::LN_2
 / ln(2) More...
 
static const double INV_LOG_OF_2 = osg::INVLN_2
 / 1/ln(2) More...
 
static const double ONE_OVER_PI = 1.0 / trUtil::Math::PI
 1/PI. More...
 
static const double ONE80_OVER_PI = (180.0*ONE_OVER_PI)
 PI/180. More...
 

Function Documentation

◆ CheckState() [1/2]

double trUtil::Math::CheckState ( double  state)
inline

Checks if State is = to 0, less then 0 or greater, and outputs -1, 0, 1.

Parameters
stateThe state.
Returns
A double.

Definition at line 148 of file Math.h.

◆ CheckState() [2/2]

float trUtil::Math::CheckState ( float  state)
inline

Checks if State is = to 0, less then 0 or greater, and outputs -1, 0, 1.

Parameters
stateThe state.
Returns
A float.

Definition at line 167 of file Math.h.

◆ Deg2Rad() [1/2]

double trUtil::Math::Deg2Rad ( double  degree)
inline

Takes Degrees and converts them to Radians.

Parameters
degreeThe degree.
Returns
A double.

Definition at line 92 of file Math.h.

Referenced by trCore::SceneObjects::RingArray::RingArray().

Here is the caller graph for this function:

◆ Deg2Rad() [2/2]

float trUtil::Math::Deg2Rad ( float  degree)
inline

Takes Degrees and converts them to Radians.

Parameters
degreeThe degree.
Returns
A float.

Definition at line 106 of file Math.h.

◆ Lerp()

template<typename T >
T trUtil::Math::Lerp ( from,
to,
alpha 
)
inline

Linear Interpolation function.

Template Parameters
TGeneric type parameter.
Parameters
fromStart point from which to interpret.
toEnd point to which to interpret.
alphaThe alpha (0-1)
Returns
A T.

Definition at line 191 of file Math.h.

◆ Rad2Deg() [1/2]

double trUtil::Math::Rad2Deg ( double  radian)
inline

Takes Radians and converts them to Degrees.

Parameters
radianThe radian.
Returns
A double.

Definition at line 120 of file Math.h.

◆ Rad2Deg() [2/2]

float trUtil::Math::Rad2Deg ( float  radian)
inline

Takes Radians and converts them to Degrees.

Parameters
radianThe radian.
Returns
A float.

Definition at line 134 of file Math.h.

◆ SinCos() [1/2]

void trUtil::Math::SinCos ( double  x,
double &  sinVal,
double &  cosVal 
)
inline

Takes a Value X and outputs its Sin and Cos by reference.

Parameters
xThe x coordinate.
[in,out]sinValThe sine value.
[in,out]cosValThe cosine value.

Definition at line 62 of file Math.h.

◆ SinCos() [2/2]

void trUtil::Math::SinCos ( float  x,
float &  sinVal,
float &  cosVal 
)
inline

Takes a Value X and outputs its Sin and Cos by reference.

Parameters
xThe x coordinate.
[in,out]sinValThe sine value.
[in,out]cosValThe cosine value.

Definition at line 77 of file Math.h.

Variable Documentation

◆ E

const double trUtil::Math::E = 2.7182818284590452354
static

/ e.

Definition at line 43 of file Math.h.

◆ FOUR_PI

const double trUtil::Math::FOUR_PI = trUtil::Math::PI * 4.0
static

/ pi*4.

Definition at line 39 of file Math.h.

◆ INV_LOG_OF_2

const double trUtil::Math::INV_LOG_OF_2 = osg::INVLN_2
static

/ 1/ln(2)

Definition at line 47 of file Math.h.

◆ LOG_OF_2

const double trUtil::Math::LOG_OF_2 = osg::LN_2
static

/ ln(2)

Definition at line 45 of file Math.h.

◆ ONE80_OVER_PI

const double trUtil::Math::ONE80_OVER_PI = (180.0*ONE_OVER_PI)
static

PI/180.

Definition at line 51 of file Math.h.

◆ ONE_OVER_PI

const double trUtil::Math::ONE_OVER_PI = 1.0 / trUtil::Math::PI
static

1/PI.

Definition at line 49 of file Math.h.

◆ PI

const double trUtil::Math::PI = osg::PI
static

/ pi.

Definition at line 31 of file Math.h.

◆ PI_OVER_2

const double trUtil::Math::PI_OVER_2 = osg::PI_2
static

/ pi/2.

Definition at line 33 of file Math.h.

◆ PI_OVER_4

const double trUtil::Math::PI_OVER_4 = osg::PI_4
static

/ pi/4.

Definition at line 35 of file Math.h.

◆ SQRT_PI

const double trUtil::Math::SQRT_PI = 1.77245385090551602729816748334
static

/ pi^(1/2)

Definition at line 41 of file Math.h.

◆ TWO_PI