pgMath Class Reference
[pgMath -- Mathematics module]

Provides mathematical functions. More...

#include <pg_math.h>

List of all members.

Static Public Member Functions

template<class T >
static T abs (T x)
 Returns the absolute value of a value.
template<class T >
static T min (T a, T b)
 Returns the minimum of two values.
template<class T >
static T max (T a, T b)
 Returns the maximum of two values.
template<class T >
static T clamp (T x, T min, T max)
 Returns the clamped value between two thresholds.
static r32 sqrt (r32 x)
 Returns the square root of a value.
static r32 sin_r32 (r32 deg)
 Returns the trigonometric sine of an r32 angle.
static r32 cos_r32 (r32 deg)
 Returns the trigonometric cosine of an r32 angle.
static r32 sin_s32 (s32 deg)
 Returns the trigonometric sine of an s32 angle.
static r32 cos_s32 (s32 deg)
 Returns the trigonometric cosine of an s32 angle.
static r32 asin (r32 x)
 Returns the arc sine of a value.
static r32 acos (r32 x)
 Returns the arc cosine of a value.
static r32 atan2 (r32 y, r32 x)
 Returns the arc tangent of y/x, using the signs of both arguments to determine the quadrant of the return value.
static void srand (u32 seed)
 Sets the seed of the random number generator.
static s32 rand (s32 from, s32 to)
 Returns a pseudo-random number between two specified values.
static r32 rand (r32 from, r32 to, r32 interval)
 Returns a pseudo-random number between two specified values with the specified interval.
static r32 interp (r32 from, r32 to, r32 ratio)
 Returns the interpolated value between two values by the specified ratio.

Static Public Attributes

static const r32 EPSILON
 If the difference of two numbers is less than this value, two numbers are considered equal.
static const r32 PI
 Pi.
static const r32 DEG_TO_RAD
 Is equal to Pi/180.
static const r32 RAD_TO_DEG
 Is equal to 180/Pi.


Detailed Description

Provides mathematical functions.

Member Function Documentation

template<class T >
static T pgMath::abs ( x  )  [inline, static]

Returns the absolute value of a value.

Template Parameters:
T The type of a value.
Parameters:
[in] x A value.
Returns:
The absolute value of the value.

static r32 pgMath::acos ( r32  x  )  [static]

Returns the arc cosine of a value.

Parameters:
[in] x A value.
Returns:
The arc cosine of the value, expressed in degrees.

static r32 pgMath::asin ( r32  x  )  [static]

Returns the arc sine of a value.

Parameters:
[in] x A value.
Returns:
The arc sine of the value, expressed in degrees.

static r32 pgMath::atan2 ( r32  y,
r32  x 
) [static]

Returns the arc tangent of y/x, using the signs of both arguments to determine the quadrant of the return value.

Parameters:
[in] y The y-coordinate.
[in] x The x-coordinate.
Returns:
The arc tangent of y/x, expressed in degrees.

template<class T >
static T pgMath::clamp ( x,
min,
max 
) [inline, static]

Returns the clamped value between two thresholds.

Template Parameters:
T The type of a value and thresholds.
Parameters:
[in] x A value.
[in] min The lower clamp threshold.
[in] max The upper clamp threshold.
Returns:
The clamped value between two thresholds.

static r32 pgMath::cos_r32 ( r32  deg  )  [static]

Returns the trigonometric cosine of an r32 angle.

Parameters:
[in] deg An r32 angle in degrees.
Returns:
The cosine of the r32 angle.

static r32 pgMath::cos_s32 ( s32  deg  )  [static]

Returns the trigonometric cosine of an s32 angle.

This method allows only an s32 type as an angle, but is faster than its r32 version.

Parameters:
[in] deg An s32 angle in degrees.
Returns:
The cosine of the s32 angle.

static r32 pgMath::interp ( r32  from,
r32  to,
r32  ratio 
) [static]

Returns the interpolated value between two values by the specified ratio.

Parameters:
[in] from The source value.
[in] to The destination value.
[in] ratio The value which indicates how far to interpolate between two values. This value is clamped between 0.0f and 1.0f.
Returns:
The interpolated value between two values by the specified ratio.

template<class T >
static T pgMath::max ( a,
b 
) [inline, static]

Returns the maximum of two values.

Template Parameters:
T The type of two values.
Parameters:
[in] a A value.
[in] b An another value.
Returns:
The maximum of two values.

template<class T >
static T pgMath::min ( a,
b 
) [inline, static]

Returns the minimum of two values.

Template Parameters:
T The type of two values.
Parameters:
[in] a A value.
[in] b An another value.
Returns:
The minimum of two values.

static r32 pgMath::rand ( r32  from,
r32  to,
r32  interval 
) [static]

Returns a pseudo-random number between two specified values with the specified interval.

Parameters:
[in] from A range of the generated numbers.
[in] to An another range of the generated numbers. This value may be changed depending on the specified interval.
[in] interval The interval of the generated numbers.
Returns:
A pseudo-random number between two specified values with the specified interval.

static s32 pgMath::rand ( s32  from,
s32  to 
) [static]

Returns a pseudo-random number between two specified values.

Parameters:
[in] from A range of the generated numbers.
[in] to An another range of the generated numbers.
Returns:
A pseudo-random number between two specified values.

static r32 pgMath::sin_r32 ( r32  deg  )  [static]

Returns the trigonometric sine of an r32 angle.

Parameters:
[in] deg An r32 angle in degrees.
Returns:
The sine of the r32 angle.

static r32 pgMath::sin_s32 ( s32  deg  )  [static]

Returns the trigonometric sine of an s32 angle.

This method allows only an s32 type as an angle, but is faster than its r32 version.

Parameters:
[in] deg An s32 angle in degrees.
Returns:
The sine of the s32 angle.

static r32 pgMath::sqrt ( r32  x  )  [static]

Returns the square root of a value.

Parameters:
[in] x A value. This value must be greater than or equal to zero.
Returns:
The square root of the value.

static void pgMath::srand ( u32  seed  )  [static]

Sets the seed of the random number generator.

Parameters:
[in] seed The initial seed.


Member Data Documentation

const r32 pgMath::DEG_TO_RAD [static]

Is equal to Pi/180.

const r32 pgMath::EPSILON [static]

If the difference of two numbers is less than this value, two numbers are considered equal.

const r32 pgMath::PI [static]

Pi.

const r32 pgMath::RAD_TO_DEG [static]

Is equal to 180/Pi.


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

Generated on Sat Aug 15 11:24:38 2009 for Pogolyn by  doxygen 1.5.8