#include <gmtl/Defines.h>
#include <gmtl/Util/Assert.h>
#include <gmtl/Util/StaticAssert.h>
#include <gmtl/Vec.h>
#include <gmtl/VecOps.h>
#include <gmtl/Quat.h>
#include <gmtl/QuatOps.h>
#include <gmtl/Coord.h>
#include <gmtl/Matrix.h>
#include <gmtl/Util/Meta.h>
#include <gmtl/Math.h>
#include <gmtl/Xforms.h>
#include <gmtl/EulerAngle.h>
#include <gmtl/AxisAngle.h>
Go to the source code of this file.
Namespaces | |
namespace | gmtl |
Meta programming classes. | |
Functions | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS> | |
void | gmtl::setRow (Vec< DATA_TYPE, COLS > &dest, const Matrix< DATA_TYPE, ROWS, COLS > &src, unsigned row) |
Accesses a particular row in the matrix by copying the values in the row into the given vector. | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS> | |
Vec< DATA_TYPE, COLS > | gmtl::makeRow (const Matrix< DATA_TYPE, ROWS, COLS > &src, unsigned row) |
Accesses a particular row in the matrix by creating a new vector containing the values in the given matrix. | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS> | |
void | gmtl::setColumn (Vec< DATA_TYPE, ROWS > &dest, const Matrix< DATA_TYPE, ROWS, COLS > &src, unsigned col) |
Accesses a particular column in the matrix by copying the values in the column into the given vector. | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS> | |
Vec< DATA_TYPE, ROWS > | gmtl::makeColumn (const Matrix< DATA_TYPE, ROWS, COLS > &src, unsigned col) |
Accesses a particular column in the matrix by creating a new vector containing the values in the given matrix. | |
Vec Generators | |
template<typename DATA_TYPE > | |
Vec< DATA_TYPE, 3 > | gmtl::makeVec (const Quat< DATA_TYPE > &quat) |
create a vector from the vector component of a quaternion | |
template<typename DATA_TYPE , unsigned SIZE> | |
Vec< DATA_TYPE, SIZE > | gmtl::makeNormal (Vec< DATA_TYPE, SIZE > vec) |
create a normalized vector from the given vector. | |
template<class DATA_TYPE > | |
Vec< DATA_TYPE, 3 > | gmtl::makeCross (const Vec< DATA_TYPE, 3 > &v1, const Vec< DATA_TYPE, 3 > &v2) |
Computes the cross product between v1 and v2 and returns the result. | |
template<typename VEC_TYPE , typename DATA_TYPE , unsigned ROWS, unsigned COLS> | |
VEC_TYPE & | gmtl::setTrans (VEC_TYPE &result, const Matrix< DATA_TYPE, ROWS, COLS > &arg) |
Set vector using translation portion of the matrix. | |
Quat Generators | |
template<typename DATA_TYPE > | |
Quat< DATA_TYPE > & | gmtl::setPure (Quat< DATA_TYPE > &quat, const Vec< DATA_TYPE, 3 > &vec) |
Set pure quaternion. | |
template<typename DATA_TYPE > | |
Quat< DATA_TYPE > | gmtl::makePure (const Vec< DATA_TYPE, 3 > &vec) |
create a pure quaternion | |
template<typename DATA_TYPE > | |
Quat< DATA_TYPE > | gmtl::makeNormal (const Quat< DATA_TYPE > &quat) |
Normalize a quaternion. | |
template<typename DATA_TYPE > | |
Quat< DATA_TYPE > | gmtl::makeConj (const Quat< DATA_TYPE > &quat) |
quaternion complex conjugate. | |
template<typename DATA_TYPE > | |
Quat< DATA_TYPE > | gmtl::makeInvert (const Quat< DATA_TYPE > &quat) |
create quaternion from the inverse of another quaternion. | |
template<typename DATA_TYPE > | |
Quat< DATA_TYPE > & | gmtl::set (Quat< DATA_TYPE > &result, const AxisAngle< DATA_TYPE > &axisAngle) |
Convert an AxisAngle to a Quat. | |
template<typename DATA_TYPE > | |
Quat< DATA_TYPE > & | gmtl::setRot (Quat< DATA_TYPE > &result, const AxisAngle< DATA_TYPE > &axisAngle) |
Redundant duplication of the set(quat,axisangle) function, this is provided only for template compatibility. | |
template<typename DATA_TYPE , typename ROT_ORDER > | |
Quat< DATA_TYPE > & | gmtl::set (Quat< DATA_TYPE > &result, const EulerAngle< DATA_TYPE, ROT_ORDER > &euler) |
Convert an EulerAngle rotation to a Quaternion rotation. | |
template<typename DATA_TYPE , typename ROT_ORDER > | |
Quat< DATA_TYPE > & | gmtl::setRot (Quat< DATA_TYPE > &result, const EulerAngle< DATA_TYPE, ROT_ORDER > &euler) |
Redundant duplication of the set(quat,eulerangle) function, this is provided only for template compatibility. | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS> | |
Quat< DATA_TYPE > & | gmtl::set (Quat< DATA_TYPE > &quat, const Matrix< DATA_TYPE, ROWS, COLS > &mat) |
Convert a Matrix to a Quat. | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS> | |
Quat< DATA_TYPE > & | gmtl::setRot (Quat< DATA_TYPE > &result, const Matrix< DATA_TYPE, ROWS, COLS > &mat) |
Redundant duplication of the set(quat,mat) function, this is provided only for template compatibility. | |
AxisAngle Generators | |
template<typename DATA_TYPE > | |
AxisAngle< DATA_TYPE > & | gmtl::set (AxisAngle< DATA_TYPE > &axisAngle, Quat< DATA_TYPE > quat) |
Convert a rotation quaternion to an AxisAngle. | |
template<typename DATA_TYPE > | |
AxisAngle< DATA_TYPE > & | gmtl::setRot (AxisAngle< DATA_TYPE > &result, Quat< DATA_TYPE > quat) |
Redundant duplication of the set(axisangle,quat) function, this is provided only for template compatibility. | |
template<typename DATA_TYPE > | |
AxisAngle< DATA_TYPE > | gmtl::makeNormal (const AxisAngle< DATA_TYPE > &a) |
make the axis of an AxisAngle normalized | |
EulerAngle Generators | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS, typename ROT_ORDER > | |
EulerAngle< DATA_TYPE, ROT_ORDER > & | gmtl::set (EulerAngle< DATA_TYPE, ROT_ORDER > &euler, const Matrix< DATA_TYPE, ROWS, COLS > &mat) |
Convert Matrix to EulerAngle. | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS, typename ROT_ORDER > | |
EulerAngle< DATA_TYPE, ROT_ORDER > & | gmtl::setRot (EulerAngle< DATA_TYPE, ROT_ORDER > &result, const Matrix< DATA_TYPE, ROWS, COLS > &mat) |
Redundant duplication of the set(eulerangle,quat) function, this is provided only for template compatibility. | |
Matrix Generators | |
template<typename T > | |
Matrix< T, 4, 4 > & | gmtl::setFrustum (Matrix< T, 4, 4 > &result, T left, T top, T right, T bottom, T nr, T fr) |
Set an arbitrary projection matrix. | |
template<typename T > | |
Matrix< T, 4, 4 > & | gmtl::setOrtho (Matrix< T, 4, 4 > &result, T left, T top, T right, T bottom, T nr, T fr) |
Set an orthographic projection matrix creates a transformation that produces a parallel projection matrix. | |
template<typename T > | |
Matrix< T, 4, 4 > & | gmtl::setPerspective (Matrix< T, 4, 4 > &result, T fovy, T aspect, T nr, T fr) |
Set a symmetric perspective projection matrix. | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS, unsigned SIZE, typename REP > | |
Matrix< DATA_TYPE, ROWS, COLS > & | gmtl::setTrans (Matrix< DATA_TYPE, ROWS, COLS > &result, const VecBase< DATA_TYPE, SIZE, REP > &trans) |
Set matrix translation from vec. | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS, unsigned SIZE> | |
Matrix< DATA_TYPE, ROWS, COLS > & | gmtl::setScale (Matrix< DATA_TYPE, ROWS, COLS > &result, const Vec< DATA_TYPE, SIZE > &scale) |
Set the scale part of a matrix. | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS> | |
Matrix< DATA_TYPE, ROWS, COLS > & | gmtl::setScale (Matrix< DATA_TYPE, ROWS, COLS > &result, const DATA_TYPE scale) |
Sets the scale part of a matrix. | |
template<typename MATRIX_TYPE , typename INPUT_TYPE > | |
MATRIX_TYPE | gmtl::makeScale (const INPUT_TYPE &scale, Type2Type< MATRIX_TYPE > t=Type2Type< MATRIX_TYPE >()) |
Create a scale matrix. | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS> | |
Matrix< DATA_TYPE, ROWS, COLS > & | gmtl::setRot (Matrix< DATA_TYPE, ROWS, COLS > &result, const AxisAngle< DATA_TYPE > &axisAngle) |
Set the rotation portion of a rotation matrix using an axis and an angle (in radians). | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS, typename ROT_ORDER > | |
Matrix< DATA_TYPE, ROWS, COLS > & | gmtl::setRot (Matrix< DATA_TYPE, ROWS, COLS > &result, const EulerAngle< DATA_TYPE, ROT_ORDER > &euler) |
Set (only) the rotation part of a matrix using an EulerAngle (angles are in radians). | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS> | |
Matrix< DATA_TYPE, ROWS, COLS > & | gmtl::set (Matrix< DATA_TYPE, ROWS, COLS > &result, const AxisAngle< DATA_TYPE > &axisAngle) |
Convert an AxisAngle to a rotation matrix. | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS, typename ROT_ORDER > | |
Matrix< DATA_TYPE, ROWS, COLS > & | gmtl::set (Matrix< DATA_TYPE, ROWS, COLS > &result, const EulerAngle< DATA_TYPE, ROT_ORDER > &euler) |
Convert an EulerAngle to a rotation matrix. | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS> | |
DATA_TYPE | gmtl::makeYRot (const Matrix< DATA_TYPE, ROWS, COLS > &mat) |
Extracts the Y axis rotation information from the matrix. | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS> | |
DATA_TYPE | gmtl::makeXRot (const Matrix< DATA_TYPE, ROWS, COLS > &mat) |
Extracts the X-axis rotation information from the matrix. | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS> | |
DATA_TYPE | gmtl::makeZRot (const Matrix< DATA_TYPE, ROWS, COLS > &mat) |
Extracts the Z-axis rotation information from the matrix. | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS> | |
Matrix< DATA_TYPE, ROWS, COLS > & | gmtl::setDirCos (Matrix< DATA_TYPE, ROWS, COLS > &result, const Vec< DATA_TYPE, 3 > &xDestAxis, const Vec< DATA_TYPE, 3 > &yDestAxis, const Vec< DATA_TYPE, 3 > &zDestAxis, const Vec< DATA_TYPE, 3 > &xSrcAxis=Vec< DATA_TYPE, 3 >(1, 0, 0), const Vec< DATA_TYPE, 3 > &ySrcAxis=Vec< DATA_TYPE, 3 >(0, 1, 0), const Vec< DATA_TYPE, 3 > &zSrcAxis=Vec< DATA_TYPE, 3 >(0, 0, 1)) |
create a rotation matrix that will rotate from SrcAxis to DestAxis. | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS> | |
Matrix< DATA_TYPE, ROWS, COLS > & | gmtl::setAxes (Matrix< DATA_TYPE, ROWS, COLS > &result, const Vec< DATA_TYPE, 3 > &xAxis, const Vec< DATA_TYPE, 3 > &yAxis, const Vec< DATA_TYPE, 3 > &zAxis) |
set the matrix given the raw coordinate axes. | |
template<typename ROTATION_TYPE > | |
ROTATION_TYPE | gmtl::makeAxes (const Vec< typename ROTATION_TYPE::DataType, 3 > &xAxis, const Vec< typename ROTATION_TYPE::DataType, 3 > &yAxis, const Vec< typename ROTATION_TYPE::DataType, 3 > &zAxis, Type2Type< ROTATION_TYPE > t=Type2Type< ROTATION_TYPE >()) |
set the matrix given the raw coordinate axes. | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS> | |
Matrix< DATA_TYPE, ROWS, COLS > | gmtl::makeTranspose (const Matrix< DATA_TYPE, ROWS, COLS > &m) |
create a matrix transposed from the source. | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS> | |
Matrix< DATA_TYPE, ROWS, COLS > | gmtl::makeInvert (const Matrix< DATA_TYPE, ROWS, COLS > &src) |
Creates a matrix that is the inverse of the given source matrix. | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS> | |
Matrix< DATA_TYPE, ROWS, COLS > & | gmtl::setRot (Matrix< DATA_TYPE, ROWS, COLS > &mat, const Quat< DATA_TYPE > &q) |
Set the rotation portion of a matrix (3x3) from a rotation quaternion. | |
template<typename DATATYPE , typename POS_TYPE , typename ROT_TYPE , unsigned MATCOLS, unsigned MATROWS> | |
Matrix< DATATYPE, MATROWS, MATCOLS > & | gmtl::set (Matrix< DATATYPE, MATROWS, MATCOLS > &mat, const Coord< POS_TYPE, ROT_TYPE > &coord) |
Convert a Coord to a Matrix Note: It is set directly, but this is equivalent to T*R where T is the translation matrix and R is the rotation matrix. | |
template<typename DATA_TYPE , unsigned ROWS, unsigned COLS> | |
Matrix< DATA_TYPE, ROWS, COLS > & | gmtl::set (Matrix< DATA_TYPE, ROWS, COLS > &mat, const Quat< DATA_TYPE > &q) |
Convert a Quat to a rotation Matrix. | |
Coord Generators | |
template<typename DATATYPE , typename POS_TYPE , typename ROT_TYPE , unsigned MATCOLS, unsigned MATROWS> | |
Coord< POS_TYPE, ROT_TYPE > & | gmtl::set (Coord< POS_TYPE, ROT_TYPE > &eulercoord, const Matrix< DATATYPE, MATROWS, MATCOLS > &mat) |
convert Matrix to Coord | |
template<typename DATATYPE , typename POS_TYPE , typename ROT_TYPE , unsigned MATCOLS, unsigned MATROWS> | |
Coord< POS_TYPE, ROT_TYPE > & | gmtl::setRot (Coord< POS_TYPE, ROT_TYPE > &result, const Matrix< DATATYPE, MATROWS, MATCOLS > &mat) |
Redundant duplication of the set(coord,mat) function, this is provided only for template compatibility. | |
Generic Generators (any type) | |
template<typename TARGET_TYPE , typename SOURCE_TYPE > | |
TARGET_TYPE | gmtl::make (const SOURCE_TYPE &src, Type2Type< TARGET_TYPE > t=Type2Type< TARGET_TYPE >()) |
Construct an object from another object of a different type. | |
template<typename ROTATION_TYPE , typename SOURCE_TYPE > | |
ROTATION_TYPE | gmtl::makeRot (const SOURCE_TYPE &coord, Type2Type< ROTATION_TYPE > t=Type2Type< ROTATION_TYPE >()) |
Create a rotation datatype from another rotation datatype. | |
template<typename ROTATION_TYPE > | |
ROTATION_TYPE | gmtl::makeDirCos (const Vec< typename ROTATION_TYPE::DataType, 3 > &xDestAxis, const Vec< typename ROTATION_TYPE::DataType, 3 > &yDestAxis, const Vec< typename ROTATION_TYPE::DataType, 3 > &zDestAxis, const Vec< typename ROTATION_TYPE::DataType, 3 > &xSrcAxis=Vec< typename ROTATION_TYPE::DataType, 3 >(1, 0, 0), const Vec< typename ROTATION_TYPE::DataType, 3 > &ySrcAxis=Vec< typename ROTATION_TYPE::DataType, 3 >(0, 1, 0), const Vec< typename ROTATION_TYPE::DataType, 3 > &zSrcAxis=Vec< typename ROTATION_TYPE::DataType, 3 >(0, 0, 1), Type2Type< ROTATION_TYPE > t=Type2Type< ROTATION_TYPE >()) |
Create a rotation matrix or quaternion (or any other rotation data type) using direction cosines. | |
template<typename TRANS_TYPE , typename SRC_TYPE > | |
TRANS_TYPE | gmtl::makeTrans (const SRC_TYPE &arg, Type2Type< TRANS_TYPE > t=Type2Type< TRANS_TYPE >()) |
Make a translation datatype from another translation datatype. | |
template<typename ROTATION_TYPE > | |
ROTATION_TYPE | gmtl::makeRot (const Vec< typename ROTATION_TYPE::DataType, 3 > &from, const Vec< typename ROTATION_TYPE::DataType, 3 > &to) |
Create a rotation datatype that will xform first vector to the second. | |
template<typename DEST_TYPE , typename DATA_TYPE > | |
DEST_TYPE & | gmtl::setRot (DEST_TYPE &result, const Vec< DATA_TYPE, 3 > &from, const Vec< DATA_TYPE, 3 > &to) |
set a rotation datatype that will xform first vector to the second. |