LinearAlgebra
 All Classes Namespaces Files Functions Variables Typedefs Macros
Classes | Typedefs | Functions
a3d Namespace Reference

KJs Algebra 3D Package for C++. More...

Classes

struct  Math
 Template-based math functions providing the essential operators for a specific type. More...
 
struct  Vector3
 A vector of three values for 3d calculations. More...
 
struct  Vector4
 A vector of four values for 3d calculations in homogeneous coordinates. More...
 
struct  Rotation
 A rotation struct. More...
 
struct  Quaternion
 A quaternion struct primarily for rotation representations and calculations. More...
 
struct  Matrix3
 A matrix of nine values for 3d calculations. More...
 
struct  Matrix4
 A matrix of 16 values for 3d calculations in homogeneous coordinates. More...
 

Typedefs

typedef Vector3< float > Vector3f
 Floating point vector, single precision. More...
 
typedef Vector3< double > Vector3d
 Floating point vector, double precision. More...
 
typedef Vector4< float > Vector4f
 Floating point vector in homogenious coordinates, single precision. More...
 
typedef Vector4< double > Vector4d
 Floating point vector in homogenious coordinates, double precision. More...
 
typedef Rotation< float > Rotationf
 Floating point rotation. More...
 
typedef Rotation< double > Rotationd
 Floating point rotation, double precision. More...
 
typedef Quaternion< float > Quaternionf
 Floating point quaternion. More...
 
typedef Quaternion< double > Quaterniond
 Floating point quaternion, double precision. More...
 
typedef Matrix3< float > Matrix3f
 Floating point matrix. More...
 
typedef Matrix3< double > Matrix3d
 Floating point matrix, double precision. More...
 
typedef Matrix4< float > Matrix4f
 Floating point matrix. More...
 
typedef Matrix4< double > Matrix4d
 Floating point matrix, double precision. More...
 

Functions

template<class S1 , class S2 >
S1 & operator+= (S1 &o1, const S2 &o2)
 Operator. More...
 
template<class S1 , class S2 >
S1 & operator-= (S1 &o1, const S2 &o2)
 Operator. More...
 
template<class S1 , class S2 >
S1 & operator*= (S1 &o1, const S2 &o2)
 This operator is defined as o1 = o2 * o1. More...
 
template<class S1 , class S2 >
S1 & operator/= (S1 &o1, const S2 &o2)
 Operator. More...
 
template<class T , class M >
operator* (const Vector3< T, M > &o1, const Vector3< T, M > &o2)
 Operator. More...
 
template<class T , class M >
operator* (const Vector4< T, M > &o1, const Vector4< T, M > &o2)
 Operator. More...
 
template<class T , class M >
Vector3< T, M > operator% (const Vector3< T, M > &o1, const Vector3< T, M > &o2)
 The cross product operator. More...
 
template<class T , class M >
Vector3< T, M > operator+ (const Vector3< T, M > &o1, const Vector3< T, M > &o2)
 Operator. More...
 
template<class T , class M >
Vector3< T, M > operator- (const Vector3< T, M > &o1, const Vector3< T, M > &o2)
 Operator. More...
 
template<class T , class M >
Vector4< T, M > operator+ (const Vector4< T, M > &o1, const Vector4< T, M > &o2)
 Operator. More...
 
template<class T , class M >
Vector4< T, M > operator- (const Vector4< T, M > &o1, const Vector4< T, M > &o2)
 Operator. More...
 
template<class S , class T , class M >
Vector3< T, M > operator* (S o1, const Vector3< T, M > &o2)
 Vector scaling operator. More...
 
template<class S , class T , class M >
Vector3< T, M > operator* (const Vector3< T, M > &o1, S o2)
 Vector scaling operator. More...
 
template<class S , class T , class M >
Vector3< T, M > operator/ (const Vector3< T, M > &o1, S o2)
 Vector scaling operator. More...
 
template<class S , class T , class M >
Vector4< T, M > operator* (S o1, const Vector4< T, M > &o2)
 Vector scaling operator. More...
 
template<class S , class T , class M >
Vector4< T, M > operator* (const Vector4< T, M > &o1, S o2)
 Vector scaling operator. More...
 
template<class S , class T , class M >
Vector4< T, M > operator/ (const Vector4< T, M > &o1, S o2)
 Vector scaling operator. More...
 
template<class S , class T , class M >
Quaternion< T, M > operator* (S o1, const Quaternion< T, M > &o2)
 Warning for this operator: a multiplication with a scalar destroys the unity of the quaternion. More...
 
template<class S , class T , class M >
Quaternion< T, M > operator* (const Quaternion< T, M > &o1, S o2)
 Warning for this operator: a multiplication with a scalar destroys the unity of the quaternion. More...
 
template<class T , class M >
Quaternion< T, M > operator* (const Quaternion< T, M > &o1, const Quaternion< T, M > &o2)
 Quaternion multiplication operator. More...
 
template<class S , class T , class M >
Quaternion< T, M > operator/ (const Quaternion< T, M > &o1, S o2)
 Warning for this operator: a division by a scalar destroys the unity of the quaternion. More...
 
template<class T , class M >
Quaternion< T, M > operator/ (const Quaternion< T, M > &o1, const Quaternion< T, M > &o2)
 Warning for this operator: division between two quaternions is not uniquely defined so make sure that you know what you are doing. More...
 
template<class T , class M >
Quaternion< T, M > operator+ (const Quaternion< T, M > &o1, const Quaternion< T, M > &o2)
 Quaternion addition operator. More...
 
template<class T , class M >
Quaternion< T, M > operator- (const Quaternion< T, M > &o1, const Quaternion< T, M > &o2)
 Quaternion substraction operator. More...
 
template<class T , class S , class M >
Matrix3< T, M > operator* (const S &o1, const Matrix3< T, M > &o2)
 Matrix scaling operator. More...
 
template<class T , class S , class M >
Matrix4< T, M > operator* (const S &o1, const Matrix4< T, M > &o2)
 Matrix scaling operator. More...
 
template<class T , class S , class M >
Matrix3< T, M > operator/ (const Matrix3< T, M > &o1, const S &o2)
 Matrix scaling operator. More...
 
template<class T , class S , class M >
Matrix4< T, M > operator/ (const Matrix4< T, M > &o1, const S &o2)
 Matrix scaling operator. More...
 
template<class T , class M >
Matrix3< T, M > operator* (const Matrix3< T, M > &o1, const Matrix3< T, M > &o2)
 Matrix matrix multiplication operator. More...
 
template<class T , class M >
Matrix4< T, M > operator* (const Matrix4< T, M > &o1, const Matrix4< T, M > &o2)
 Matrix matrix multiplication operator. More...
 
template<class T , class M >
Vector3< T, M > operator* (const Matrix3< T, M > &o1, const Vector3< T, M > &o2)
 Matrix vector multiplication operator. More...
 
template<class T , class M >
Matrix3< T, M > operator* (const Vector3< T, M > &o1, const Matrix3< T, M > &o2)
 Vector matrix multiplication operator. More...
 
template<class T , class M >
Vector4< T, M > operator* (const Matrix4< T, M > &o1, const Vector4< T, M > &o2)
 Matrix vector multiplication operator. More...
 
template<class T , class M >
Matrix4< T, M > operator* (const Vector4< T, M > &o1, const Matrix4< T, M > &o2)
 Vector matrix multiplication operator. More...
 
template<class T , class M >
std::ostream & operator<< (std::ostream &out, const Vector3< T, M > &o)
 Printing operator. More...
 
template<class T , class M >
std::ostream & operator<< (std::ostream &out, const Vector4< T, M > &o)
 Printing operator. More...
 
template<class T , class M >
std::ostream & operator<< (std::ostream &out, const Quaternion< T, M > &o)
 Printing operator. More...
 
template<class T , class M >
std::ostream & operator<< (std::ostream &out, const Rotation< T, M > &o)
 Printing operator. More...
 
template<class T , class M >
std::ostream & operator<< (std::ostream &out, const Matrix3< T, M > &o)
 Printing operator. More...
 
template<class T , class M >
std::ostream & operator<< (std::ostream &out, const Matrix4< T, M > &o)
 Printing operator. More...
 

Detailed Description

KJs Algebra 3D Package for C++.

The goal is to have all possible operators overloaded inline so that intuitive and effective 3D algebra can be performed.

Typedef Documentation

typedef Matrix3<double> a3d::Matrix3d

Floating point matrix, double precision.

typedef Matrix3<float> a3d::Matrix3f

Floating point matrix.

typedef Matrix4<double> a3d::Matrix4d

Floating point matrix, double precision.

typedef Matrix4<float> a3d::Matrix4f

Floating point matrix.

typedef Quaternion<double> a3d::Quaterniond

Floating point quaternion, double precision.

typedef Quaternion<float> a3d::Quaternionf

Floating point quaternion.

typedef Rotation<double> a3d::Rotationd

Floating point rotation, double precision.

typedef Rotation<float> a3d::Rotationf

Floating point rotation.

typedef Vector3<double> a3d::Vector3d

Floating point vector, double precision.

typedef Vector3<float> a3d::Vector3f

Floating point vector, single precision.

typedef Vector4<double> a3d::Vector4d

Floating point vector in homogenious coordinates, double precision.

typedef Vector4<float> a3d::Vector4f

Floating point vector in homogenious coordinates, single precision.

Function Documentation

template<class T , class M >
Vector3<T,M> a3d::operator% ( const Vector3< T, M > &  o1,
const Vector3< T, M > &  o2 
)
inline

The cross product operator.

Since the modulus operator looks most like the cross and is not defined for two vector operands this operator is used as the cross product operator.

template<class T , class M >
T a3d::operator* ( const Vector3< T, M > &  o1,
const Vector3< T, M > &  o2 
)
inline

Operator.

template<class T , class M >
T a3d::operator* ( const Vector4< T, M > &  o1,
const Vector4< T, M > &  o2 
)
inline

Operator.

template<class S , class T , class M >
Vector3<T,M> a3d::operator* ( o1,
const Vector3< T, M > &  o2 
)
inline

Vector scaling operator.

template<class S , class T , class M >
Vector3<T,M> a3d::operator* ( const Vector3< T, M > &  o1,
o2 
)
inline

Vector scaling operator.

template<class S , class T , class M >
Vector4<T,M> a3d::operator* ( o1,
const Vector4< T, M > &  o2 
)
inline

Vector scaling operator.

template<class S , class T , class M >
Vector4<T,M> a3d::operator* ( const Vector4< T, M > &  o1,
o2 
)
inline

Vector scaling operator.

template<class S , class T , class M >
Quaternion<T,M> a3d::operator* ( o1,
const Quaternion< T, M > &  o2 
)
inline

Warning for this operator: a multiplication with a scalar destroys the unity of the quaternion.

References A3D_WARNING_OPERATOR, a3d::Quaternion< T, M >::s, and a3d::Quaternion< T, M >::v.

template<class S , class T , class M >
Quaternion<T,M> a3d::operator* ( const Quaternion< T, M > &  o1,
o2 
)
inline

Warning for this operator: a multiplication with a scalar destroys the unity of the quaternion.

template<class T , class M >
Quaternion<T,M> a3d::operator* ( const Quaternion< T, M > &  o1,
const Quaternion< T, M > &  o2 
)
inline

Quaternion multiplication operator.

References a3d::Quaternion< T, M >::s, and a3d::Quaternion< T, M >::v.

template<class T , class S , class M >
Matrix3<T,M> a3d::operator* ( const S &  o1,
const Matrix3< T, M > &  o2 
)
inline

Matrix scaling operator.

template<class T , class S , class M >
Matrix4<T,M> a3d::operator* ( const S &  o1,
const Matrix4< T, M > &  o2 
)
inline

Matrix scaling operator.

template<class T , class M >
Matrix3<T,M> a3d::operator* ( const Matrix3< T, M > &  o1,
const Matrix3< T, M > &  o2 
)
inline

Matrix matrix multiplication operator.

template<class T , class M >
Matrix4<T,M> a3d::operator* ( const Matrix4< T, M > &  o1,
const Matrix4< T, M > &  o2 
)
inline

Matrix matrix multiplication operator.

template<class T , class M >
Vector3<T,M> a3d::operator* ( const Matrix3< T, M > &  o1,
const Vector3< T, M > &  o2 
)
inline

Matrix vector multiplication operator.

template<class T , class M >
Matrix3<T,M> a3d::operator* ( const Vector3< T, M > &  o1,
const Matrix3< T, M > &  o2 
)
inline

Vector matrix multiplication operator.

template<class T , class M >
Vector4<T,M> a3d::operator* ( const Matrix4< T, M > &  o1,
const Vector4< T, M > &  o2 
)
inline

Matrix vector multiplication operator.

template<class T , class M >
Matrix4<T,M> a3d::operator* ( const Vector4< T, M > &  o1,
const Matrix4< T, M > &  o2 
)
inline

Vector matrix multiplication operator.

template<class S1 , class S2 >
S1& a3d::operator*= ( S1 &  o1,
const S2 &  o2 
)
inline

This operator is defined as o1 = o2 * o1.

This is because in those cases where the multiplication is non-commutative this order is the most common. Examples are vector-matrix or quaternion-quaternion multiplication.

template<class T , class M >
Vector3<T,M> a3d::operator+ ( const Vector3< T, M > &  o1,
const Vector3< T, M > &  o2 
)
inline

Operator.

template<class T , class M >
Vector4<T,M> a3d::operator+ ( const Vector4< T, M > &  o1,
const Vector4< T, M > &  o2 
)
inline

Operator.

template<class T , class M >
Quaternion<T,M> a3d::operator+ ( const Quaternion< T, M > &  o1,
const Quaternion< T, M > &  o2 
)
inline
template<class S1 , class S2 >
S1& a3d::operator+= ( S1 &  o1,
const S2 &  o2 
)
inline

Operator.

template<class T , class M >
Vector3<T,M> a3d::operator- ( const Vector3< T, M > &  o1,
const Vector3< T, M > &  o2 
)
inline

Operator.

template<class T , class M >
Vector4<T,M> a3d::operator- ( const Vector4< T, M > &  o1,
const Vector4< T, M > &  o2 
)
inline

Operator.

template<class T , class M >
Quaternion<T,M> a3d::operator- ( const Quaternion< T, M > &  o1,
const Quaternion< T, M > &  o2 
)
inline

Quaternion substraction operator.

References a3d::Quaternion< T, M >::s, and a3d::Quaternion< T, M >::v.

template<class S1 , class S2 >
S1& a3d::operator-= ( S1 &  o1,
const S2 &  o2 
)
inline

Operator.

template<class S , class T , class M >
Vector3<T,M> a3d::operator/ ( const Vector3< T, M > &  o1,
o2 
)
inline

Vector scaling operator.

template<class S , class T , class M >
Vector4<T,M> a3d::operator/ ( const Vector4< T, M > &  o1,
o2 
)
inline

Vector scaling operator.

template<class S , class T , class M >
Quaternion<T,M> a3d::operator/ ( const Quaternion< T, M > &  o1,
o2 
)
inline

Warning for this operator: a division by a scalar destroys the unity of the quaternion.

template<class T , class M >
Quaternion<T,M> a3d::operator/ ( const Quaternion< T, M > &  o1,
const Quaternion< T, M > &  o2 
)
inline

Warning for this operator: division between two quaternions is not uniquely defined so make sure that you know what you are doing.

This operator defines division, q1 / q2, as q1 x 1/q2. Futhermore, if at least the second operand is unit it is cheaper to do multiplication with the conjugate.

References A3D_WARNING_OPERATOR, and a3d::Quaternion< T, M >::inverse().

Here is the call graph for this function:

template<class T , class S , class M >
Matrix3<T,M> a3d::operator/ ( const Matrix3< T, M > &  o1,
const S &  o2 
)
inline

Matrix scaling operator.

template<class T , class S , class M >
Matrix4<T,M> a3d::operator/ ( const Matrix4< T, M > &  o1,
const S &  o2 
)
inline

Matrix scaling operator.

template<class S1 , class S2 >
S1& a3d::operator/= ( S1 &  o1,
const S2 &  o2 
)
inline

Operator.

template<class T , class M >
std::ostream& a3d::operator<< ( std::ostream &  out,
const Vector3< T, M > &  o 
)
inline

Printing operator.

template<class T , class M >
std::ostream& a3d::operator<< ( std::ostream &  out,
const Vector4< T, M > &  o 
)
inline

Printing operator.

template<class T , class M >
std::ostream& a3d::operator<< ( std::ostream &  out,
const Quaternion< T, M > &  o 
)
inline

Printing operator.

template<class T , class M >
std::ostream& a3d::operator<< ( std::ostream &  out,
const Rotation< T, M > &  o 
)
inline

Printing operator.

template<class T , class M >
std::ostream& a3d::operator<< ( std::ostream &  out,
const Matrix3< T, M > &  o 
)
inline

Printing operator.

template<class T , class M >
std::ostream& a3d::operator<< ( std::ostream &  out,
const Matrix4< T, M > &  o 
)
inline

Printing operator.