Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

mathutils Namespace Reference


Detailed Description

a variety of handy mathematical functions, many of which are templated


Functions

template<class num>
num squareDistance (num x1, num ya, num x2, num yb)
 euclidean distance of two points (squared), see distance()
template<class num>
num distance (num x1, num ya, num x2, num yb)
 euclidean distance of two points, see squareDistance()
template<class num>
num limitRange (num n, num low, num high)
 Clips n to a minimum of low or maximum of high.
template<class num>
num squared (num n)
 returns n*n;
template<class num>
num abs_t (num n)
 returns the maximum of n or -n
template<class num>
num log2t (num x)
 Returns the log base 2 of a number.
template<>
float log2t (float x)
 returns the log base 2 for a 'float' value
template<>
double log2t (double x)
 returns the log base 2 for a 'double' value
template<class num>
num deg2rad (num x)
 converts from degrees to radians
template<class num>
num rad2deg (num x)
 converts from radians to degrees


Function Documentation

template<class num>
num mathutils::abs_t ( num  n  )  [inline]

returns the maximum of n or -n

Definition at line 38 of file mathutils.h.

template<class num>
num mathutils::deg2rad ( num  x  )  [inline]

converts from degrees to radians

Definition at line 70 of file mathutils.h.

template<class num>
num mathutils::distance ( num  x1,
num  ya,
num  x2,
num  yb 
) [inline]

euclidean distance of two points, see squareDistance()

Definition at line 17 of file mathutils.h.

template<class num>
num mathutils::limitRange ( num  n,
num  low,
num  high 
) [inline]

Clips n to a minimum of low or maximum of high.

If low and high are inverted, high is returned.

Definition at line 24 of file mathutils.h.

template<>
double mathutils::log2t ( double  x  )  [inline]

returns the log base 2 for a 'double' value

Definition at line 64 of file mathutils.h.

template<>
float mathutils::log2t ( float  x  )  [inline]

returns the log base 2 for a 'float' value

Definition at line 59 of file mathutils.h.

template<class num>
num mathutils::log2t ( num  x  )  [inline]

Returns the log base 2 of a number.

This template implementation does a bit shifting method appropriate for integers. Specializations are provided for float and double to use the 'real' log()

Definition at line 46 of file mathutils.h.

template<class num>
num mathutils::rad2deg ( num  x  )  [inline]

converts from radians to degrees

Definition at line 76 of file mathutils.h.

Referenced by HeadPointerMC::isReachable().

template<class num>
num mathutils::squared ( num  n  )  [inline]

returns n*n;

Definition at line 32 of file mathutils.h.

template<class num>
num mathutils::squareDistance ( num  x1,
num  ya,
num  x2,
num  yb 
) [inline]

euclidean distance of two points (squared), see distance()

Definition at line 11 of file mathutils.h.

Referenced by distance().


Tekkotsu v4.0
Generated Thu Nov 22 00:58:51 2007 by Doxygen 1.5.4