Classes | Namespaces | Functions

Math.h File Reference

#include <math.h>
#include <stdlib.h>
#include <gmtl/Defines.h>
#include <gmtl/Util/Assert.h>
#include <gmtl/Util/StaticAssert.h>
Include dependency graph for Math.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  gmtl::RotationOrderBase
 Base class for Rotation orders. More...
struct  gmtl::XYZ
 XYZ Rotation order. More...
struct  gmtl::ZYX
 ZYX Rotation order. More...
struct  gmtl::ZXY
 ZXY Rotation order. More...

Namespaces

namespace  gmtl
 

Meta programming classes.


namespace  gmtl::Math

Functions

template<class T >
gmtl::Math::clamp (T number, T lo, T hi)
 clamp "number" to a range between lo and hi
template<class T >
bool gmtl::Math::quadraticFormula (T &r1, T &r2, const T &a, const T &b, const T &c)
 Uses the quadratic formula to compute the 2 roots of the given 2nd degree polynomial in the form of Ax^2 + Bx + C.
C Math Abstraction

template<typename T >
gmtl::Math::abs (T iValue)
float gmtl::Math::abs (float iValue)
double gmtl::Math::abs (double iValue)
int gmtl::Math::abs (int iValue)
long gmtl::Math::abs (long iValue)
template<typename T >
gmtl::Math::ceil (T fValue)
float gmtl::Math::ceil (float fValue)
double gmtl::Math::ceil (double fValue)
template<typename T >
gmtl::Math::floor (T fValue)
float gmtl::Math::floor (float fValue)
double gmtl::Math::floor (double fValue)
template<typename T >
int gmtl::Math::sign (T iValue)
template<typename T >
gmtl::Math::zeroClamp (T value, T eps=static_cast< T >(0))
 Clamps the given value down to zero if it is within epsilon of zero.
template<typename T >
gmtl::Math::aCos (T fValue)
float gmtl::Math::aCos (float fValue)
double gmtl::Math::aCos (double fValue)
template<typename T >
gmtl::Math::aSin (T fValue)
float gmtl::Math::aSin (float fValue)
double gmtl::Math::aSin (double fValue)
template<typename T >
gmtl::Math::aTan (T fValue)
double gmtl::Math::aTan (double fValue)
float gmtl::Math::aTan (float fValue)
template<typename T >
gmtl::Math::aTan2 (T fY, T fX)
float gmtl::Math::aTan2 (float fY, float fX)
double gmtl::Math::aTan2 (double fY, double fX)
template<typename T >
gmtl::Math::cos (T fValue)
float gmtl::Math::cos (float fValue)
double gmtl::Math::cos (double fValue)
template<typename T >
gmtl::Math::exp (T fValue)
float gmtl::Math::exp (float fValue)
double gmtl::Math::exp (double fValue)
template<typename T >
gmtl::Math::log (T fValue)
double gmtl::Math::log (double fValue)
float gmtl::Math::log (float fValue)
double gmtl::Math::pow (double fBase, double fExponent)
float gmtl::Math::pow (float fBase, float fExponent)
template<typename T >
gmtl::Math::sin (T fValue)
double gmtl::Math::sin (double fValue)
float gmtl::Math::sin (float fValue)
template<typename T >
gmtl::Math::tan (T fValue)
double gmtl::Math::tan (double fValue)
float gmtl::Math::tan (float fValue)
template<typename T >
gmtl::Math::sqr (T fValue)
template<typename T >
gmtl::Math::sqrt (T fValue)
double gmtl::Math::sqrt (double fValue)
float gmtl::Math::fastInvSqrt (float x)
 Fast inverse square root.
float gmtl::Math::fastInvSqrt2 (float x)
float gmtl::Math::fastInvSqrt3 (float x)
void gmtl::Math::seedRandom (unsigned int seed)
 Seeds the pseudorandom number generator with the given seed.
float gmtl::Math::unitRandom ()
 get a random number between 0 and 1
float gmtl::Math::rangeRandom (float x1, float x2)
 return a random number between x1 and x2 RETURNS: random number between x1 and x2
float gmtl::Math::deg2Rad (float fVal)
double gmtl::Math::deg2Rad (double fVal)
float gmtl::Math::rad2Deg (float fVal)
double gmtl::Math::rad2Deg (double fVal)
template<class T >
bool gmtl::Math::isEqual (const T &a, const T &b, const T &tolerance)
 Is almost equal? test for equality within some tolerance...
template<class T >
gmtl::Math::trunc (T val)
 cut off the digits after the decimal place
template<class T >
gmtl::Math::round (T p)
 round to nearest integer
template<class T >
gmtl::Math::Min (const T &x, const T &y)
 min returns the minimum of 2 values
template<class T >
gmtl::Math::Min (const T &x, const T &y, const T &z)
 min returns the minimum of 3 values
template<class T >
gmtl::Math::Min (const T &w, const T &x, const T &y, const T &z)
 min returns the minimum of 4 values
template<class T >
gmtl::Math::Max (const T &x, const T &y)
 max returns the maximum of 2 values
template<class T >
gmtl::Math::Max (const T &x, const T &y, const T &z)
 max returns the maximum of 3 values
template<class T >
gmtl::Math::Max (const T &w, const T &x, const T &y, const T &z)
 max returns the maximum of 4 values
template<class T >
gmtl::Math::factorial (T rhs)
 Compute the factorial.
Scalar type interpolation (for doubles, floats, etc...)

template<class T , typename U >
void gmtl::Math::lerp (T &result, const U &lerp, const T &a, const T &b)
 Linear Interpolation between number [a] and [b].

Variables

Mathematical constants

const float gmtl::Math::TWO_PI = 6.28318530717958647692f
const float gmtl::Math::PI = 3.14159265358979323846f
const float gmtl::Math::PI_OVER_2 = 1.57079632679489661923f
const float gmtl::Math::PI_OVER_4 = 0.78539816339744830962f