Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

math Namespace Reference

Math related functions and classes. More...


Compounds

class  math::matrix4
 A 4x4 matrix. More...

class  math::quaternion
 A quaternion. More...

class  math::vector3
 A 3-dimensional vector. More...


Functions

double rand01 (void)
 Returns a random number between 0.0 and 1.0.

double to_degrees (double x)
 Converts radians to degrees. More...

double to_radians (double x)
 Converts degrees to radians. More...

bool equals (double x, double y)
 Precision aware equals. More...

template<class T> void swap (T &x, T &y)
 Swaps x and y. More...

double sign (double x)
 Finds the sign of x. More...

bool same_sign (double x, double y)
 Checks if x and y share the same sign. More...

bool negative (double x)
 Check if x is negative. More...

bool positive (double x)
 Check if x is positive. More...

math::vector3 cross (const math::vector3 &lhs, const math::vector3 &rhs)
void add (math::vector3 &dest, const math::vector3 &lhs, const math::vector3 &rhs)
void subtract (math::vector3 &dest, const math::vector3 &lhs, const math::vector3 &rhs)
void multiply (math::vector3 &dest, const math::vector3 &lhs, const math::vector3 &rhs)
void divide (math::vector3 &dest, const math::vector3 &lhs, const math::vector3 &rhs)
void multiply (math::vector3 &dest, const math::vector3 &lhs, real_t rhs)
void multiply (math::vector3 &dest, real_t rhs, const math::vector3 &lhs)
real_t dot (const math::vector3 &lhs, const math::vector3 &rhs)


Detailed Description

Math related functions and classes.

Function Documentation

bool equals double    x,
double    y
[inline]
 

Precision aware equals.

Returns true if x is equal to y. To account for precision errors, true is returned if x differs from y by less than MATH_EPSILON.

Definition at line 59 of file mathematics.h.

Referenced by math::quaternion::get_angle_axis, math::matrix4::get_inverted_rotation, math::vector3::normalize, math::vector3::operator!=, math::vector3::operator==, and math::quaternion::slerp.

bool negative double    x [inline]
 

Check if x is negative.

Returns:
true if x is less than 0.0.

Definition at line 115 of file mathematics.h.

bool positive double    x [inline]
 

Check if x is positive.

Returns:
true if x is greater than or equal to 0.0.

Definition at line 129 of file mathematics.h.

bool same_sign double    x,
double    y
[inline]
 

Checks if x and y share the same sign.

Returns:
true if x and y share the same sign.

Definition at line 101 of file mathematics.h.

double sign double    x [inline]
 

Finds the sign of x.

Returns:
-1.0 if x is less than 0.0, 1.0 otherwise.

Definition at line 87 of file mathematics.h.

template<class T>
void swap T &    x,
T &    y
[inline]
 

Swaps x and y.

Templated swap function. Assumes the following:

  • type has copy constructor
  • the assignment operator is defined for type
Note:
std::swap() works just as well. This function is included here to be backwards compatible with old code.

Definition at line 75 of file mathematics.h.

Referenced by math::matrix4::transpose.

double to_degrees double    x [inline]
 

Converts radians to degrees.

Parameters:
x  double in radians
Returns:
x converted to degrees.

Definition at line 37 of file mathematics.h.

double to_radians double    x [inline]
 

Converts degrees to radians.

Parameters:
x  double in degrees
Returns:
x converted to radians.

Definition at line 48 of file mathematics.h.


Generated on Tue Feb 11 18:49:49 2003 for uber by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002