Algebra3D Algebra for 3D transformations
algebra3d Namespace Reference

A namespace for the whole library. More...

Classes

class  Vector3
A class to store vectors of 3 elements. More...

class  Quaternion
A class to store quaternions. More...

class  Matrix3
A class to store 3x3 rotation matrices. More...

Typedefs

typedef Matrix3< double > Matrix3D

typedef Matrix3< float > Matrix3F

typedef Quaternion< double > QuaternionD

typedef Quaternion< float > QuaternionF

typedef Vector3< double > Vector3D

typedef Vector3< float > Vector3F

Functions

template<class fpType >
int sign (const fpType &val)

template<class fpType >
int signStar (const fpType &val)

template<class fpType >
bool isInf (const fpType &number)

template<class fpType >
bool isNaN (const fpType &number)

template<class fpType >
int compare (const fpType &d1, const fpType &d2, const fpType &precision=PRECISION)

template<class fpType >
fpType normalizeAngle (const fpType &angle)

template<class fpType >
fpType getAngleFromSinCose (fpType sinAlpha, fpType cosAlpha)

template<class fpType >
Matrix3< fpType > operator* (const double &scale, const Matrix3< fpType > &mat)

template<class fpType >
Matrix3< fpType > operator* (const float &scale, const Matrix3< fpType > &mat)

template<class fpType >
std::ostream & operator<< (std::ostream &stream, const Matrix3< fpType > &mat)

template<class fpType >
std::istream & operator>> (std::istream &stream, Matrix3< fpType > &mat)

template<class fpType >
std::ostream & operator<< (std::ostream &stream, const Quaternion< fpType > &quat)

template<class fpType >
std::istream & operator>> (std::istream &stream, Quaternion< fpType > &quat)

template<class fpType >
Vector3< fpType > operator* (const double &scale, const Vector3< fpType > &vec)

template<class fpType >
Vector3< fpType > operator* (const float &scale, const Vector3< fpType > &vec)

template<class fpType >
std::ostream & operator<< (std::ostream &stream, const Vector3< fpType > &vec)

template<class fpType >
std::istream & operator>> (std::istream &stream, Vector3< fpType > &vec)

Detailed Description

A namespace for the whole library.

Typedef Documentation

 algebra3d Matrix3< double\> algebra3d algebra3d::Matrix3D

An abbreviated name for algebra3d::Matrix3 <double>

 algebra3d Matrix3< float\> algebra3d algebra3d::Matrix3F

An abbreviated name for algebra3d::Matrix3 <float>

 algebra3d Quaternion double algebra3d algebra3d::QuaternionD

An abbreviated name for algebra3d::Quaternion <double>

 algebra3d Quaternion< double\> algebra3d algebra3d::QuaternionF

An abbreviated name for algebra3d::Quaternion <float>

 algebra3d Vector3< double\> algebra3d algebra3d::Vector3D

An abbreviated name for algebra3d::Vector3 <double>

 algebra3d Vector3< double\> algebra3d algebra3d::Vector3F

An abbreviated name for algebra3d::Vector3 <float>

Function Documentation

template<class fpType >
 int algebra3d::compare ( const fpType & d1, const fpType & d2, const fpType & precision = `PRECISION` )
inline

Compares the two fpType numbers up to the precision. Returns 0 if the numbers are equal up to precision, 1 if the first number is greater, -1 if the second number is greater, 2 if one of the numbers is `NaN`.

Two function pointers have been added to make it easier to use.

Parameters
 [in] d1 A number to compare. [in] d2 The other number to compare. [in] precision The precision to use; by default the global PRECISION is used.
Returns
`0` if the numbers are equal up to PRECISION, `1` if the first one is greater, `-1` if the second number is greater, `2` if one of the numbers is `NaN`.
compareD
compareF
template<class fpType >
 fpType algebra3d::getAngleFromSinCose ( fpType sinAlpha, fpType cosAlpha )
inline

Computes a normalized angle for the given values of sine and cosine.

Parameters
 sinAlpha sine of the angle to calculate cosAlpha cosine of the angle to calculate.
Returns
The computed normalized angle.
template<class fpType >
 bool algebra3d::isInf ( const fpType & number )
inline

Checks if the provided number is Inf.

Two function pointers have been added to make it easier to use.

Parameters
 [in] number The number to check.
Returns
`true` if the numbers is Inf, `false` otherwise.
template<class fpType >
 bool algebra3d::isNaN ( const fpType & number )
inline

Checks if the provided number is NaN.

Two function pointers have been added to make it easier to use.

Parameters
 [in] number The number to check.
Returns
`true` if the numbers is NaN, `false` otherwise.
template<class fpType >
 fpType algebra3d::normalizeAngle ( const fpType & angle )

"Normalizes" the angle i.e. transforms it to (-PI, PI].

Two function pointers have been added to make it easier to use.

Parameters
 [in] angle The angle to "normalize".
Returns
The "normalized" angle.
normalizeAngleD
normalizeAngleF
template<class fpType >
 Vector3 algebra3d::operator* ( const double & scale, const Vector3< fpType > & vec )

Scales the provided vector by the provided double number.

Parameters
 [in] scale The scaling factor. [in] vec Vector to scale.
Returns
The scaled matrix.
template<class fpType >
 Vector3 algebra3d::operator* ( const float & scale, const Vector3< fpType > & vec )

Scales the provided vector by the provided float number.

Parameters
 [in] scale The scaling factor. [in] vec Vector to scale.
Returns
The scaled matrix.
template<class fpType >
 Matrix3 algebra3d::operator* ( const double & scale, const Matrix3< fpType > & mat )

Scales the provided matrix by the provided double number.

Parameters
 [in] scale The scaling factor. [in] mat Matrix to scale.
Returns
The scaled matrix.
template<class fpType >
 Matrix3 algebra3d::operator* ( const float & scale, const Matrix3< fpType > & mat )

Scales the provided matrix by the provided float number.

Parameters
 [in] scale The scaling factor. [in] mat Matrix to scale.
Returns
The scaled matrix.
template<class fpType >
 std::ostream& algebra3d::operator<< ( std::ostream & stream, const Quaternion< fpType > & quat )

Outputs the provided quaternion to the provided stream.

Parameters
 [in] stream The stream to use. [in] quat The quaternion to output.
Returns
The stream.
template<class fpType >
 std::ostream& algebra3d::operator<< ( std::ostream & stream, const Vector3< fpType > & vec )

Outputs the provided vector to the provided stream.

Parameters
 [in] stream The stream to use. [in] vec The vector to output.
Returns
The stream.
template<class fpType >
 std::ostream& algebra3d::operator<< ( std::ostream & stream, const Matrix3< fpType > & mat )

Outputs the provided matrix to the provided stream..

Parameters
 [in] stream The stream to use. [in] mat The matrix to output.
Returns
The stream.
template<class fpType >
 std::istream& algebra3d::operator>> ( std::istream & stream, Quaternion< fpType > & quat )

Reads data for the provided quaternion from the provided stream.

Parameters
 [in] stream The stream to use. [in] quat The quaternion to fill in.
Returns
The stream.
template<class fpType >
 std::istream& algebra3d::operator>> ( std::istream & stream, Vector3< fpType > & vec )

Reads data for the provided vector from the provided stream.

Parameters
 [in] stream The stream to use. [in] vec The vector to fill in.
Returns
The stream.
template<class fpType >
 std::istream& algebra3d::operator>> ( std::istream & stream, Matrix3< fpType > & mat )

Reads data for the provided matrix from the provided stream.

Parameters
 [in] stream The stream to use. [in] mat The matrix to fill in.
Returns
The stream.
template<class fpType >
 int algebra3d::sign ( const fpType & val )
inline

Returns the sign of the given number.

Parameters
 [in] val The number to return the sign for.
Returns
The sign of the given number.