Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

gmtl Namespace Reference

Meta programming classes. More...


Compounds

class  gmtl::AABox
 Describes an axially aligned box in 3D space. More...

class  gmtl::AxisAngle
 AxisAngle: Represents a "twist about an axis" AxisAngle is used to specify a rotation in 3-space. More...

struct  gmtl::CompareIndexPointProjections
class  gmtl::Coord
 coord is a position/rotation pair. More...

class  gmtl::Eigen
class  gmtl::EulerAngle
 EulerAngle: Represents a group of euler angles. More...

class  gmtl::LineSeg
 Describes a line segment. More...

class  gmtl::Matrix
 Matrix: 4x4 Matrix class (OpenGL ordering). More...

class  gmtl::OOBox
class  gmtl::Plane
 Plane: Defines a geometrical plane. More...

class  gmtl::Point
 Point Use points when you need to represent a position. More...

class  gmtl::Quat
 Quat: Class to encapsulate quaternion behaviors. More...

class  gmtl::Ray
 Describes a ray. More...

struct  gmtl::RotationOrderBase
 Base class for Rotation orders. More...

class  gmtl::Matrix::RowAccessor
 Helper class for Matrix op[]. More...

class  gmtl::Sphere
 Describes a sphere in 3D space by its center point and its radius. More...

struct  gmtl::static_assert_test
struct  gmtl::STATIC_ASSERTION_FAILURE< true >
class  gmtl::Tri
 This class defines a triangle as a set of 3 points order in CCW fashion. More...

struct  gmtl::Type2Type
 A lightweight identifier you can pass to overloaded functions to typefy them. More...

class  gmtl::Vec
 A representation of a vector with SIZE components using DATA_TYPE as the data type for each component. More...

class  gmtl::VecBase
 Base type for vector-like objects including Points and Vectors. More...

struct  gmtl::XYZ
 XYZ Rotation order. More...

struct  gmtl::ZXY
 ZXY Rotation order. More...

struct  gmtl::ZYX
 ZYX Rotation order. More...


AABox Comparitors

template<class DATA_TYPE> bool operator== (const AABox< DATA_TYPE > &b1, const AABox< DATA_TYPE > &b2)
 Compare two AABoxes to see if they are EXACTLY the same. More...

template<class DATA_TYPE> bool operator!= (const AABox< DATA_TYPE > &b1, const AABox< DATA_TYPE > &b2)
 Compare two AABoxes to see if they are not EXACTLY the same. More...

template<class DATA_TYPE> bool isEqual (const AABox< DATA_TYPE > &b1, const AABox< DATA_TYPE > &b2, const DATA_TYPE &eps)
 Compare two AABoxes to see if they are the same within the given tolerance. More...


AxisAngle Comparitors

template<class DATA_TYPE> bool operator== (const AxisAngle< DATA_TYPE > &a1, const AxisAngle< DATA_TYPE > &a2)
 Compares 2 AxisAngles to see if they are exactly the same. More...

template<class DATA_TYPE> bool operator!= (const AxisAngle< DATA_TYPE > &a1, const AxisAngle< DATA_TYPE > &a2)
 Compares 2 AxisAngles to see if they are NOT exactly the same. More...

template<class DATA_TYPE> bool isEqual (const AxisAngle< DATA_TYPE > &a1, const AxisAngle< DATA_TYPE > &a2, const DATA_TYPE &eps=(DATA_TYPE) 0)
 Compares a1 and a2 to see if they are the same within the given epsilon tolerance. More...


Coord Comparitors

template<typename POS_TYPE, typename ROT_TYPE> bool operator== (const Coord< POS_TYPE, ROT_TYPE > &c1, const Coord< POS_TYPE, ROT_TYPE > &c2)
 Compare two coordinate frames for equality. More...

template<typename POS_TYPE, typename ROT_TYPE> bool operator!= (const Coord< POS_TYPE, ROT_TYPE > &c1, const Coord< POS_TYPE, ROT_TYPE > &c2)
 Compare two coordinate frames for not-equality. More...

template<typename POS_TYPE, typename ROT_TYPE> bool isEqual (const Coord< POS_TYPE, ROT_TYPE > &c1, const Coord< POS_TYPE, ROT_TYPE > &c2, typename Coord< POS_TYPE, ROT_TYPE >::DataType tol=(typename Coord< POS_TYPE, ROT_TYPE >::DataType) 0.0)
 Compare two coordinate frames for equality with a given tolerance. More...


EulerAngle Comparitors

template<class DATA_TYPE, typename ROT_ORDER> bool operator== (const EulerAngle< DATA_TYPE, ROT_ORDER > &e1, const EulerAngle< DATA_TYPE, ROT_ORDER > &e2)
 Compares 2 EulerAngles (component-wise) to see if they are exactly the same. More...

template<class DATA_TYPE, typename ROT_ORDER> bool operator!= (const EulerAngle< DATA_TYPE, ROT_ORDER > &e1, const EulerAngle< DATA_TYPE, ROT_ORDER > &e2)
 Compares e1 and e2 (component-wise) to see if they are NOT exactly the same. More...

template<class DATA_TYPE, typename ROT_ORDER> bool isEqual (const EulerAngle< DATA_TYPE, ROT_ORDER > &e1, const EulerAngle< DATA_TYPE, ROT_ORDER > &e2, const DATA_TYPE &eps=(DATA_TYPE) 0)
 Compares e1 and e2 (component-wise) to see if they are the same within a given tolerance. More...


Generic Generators (any type)

template<typename TARGET_TYPE, typename SOURCE_TYPE> TARGET_TYPE make (const SOURCE_TYPE &src, Type2Type< TARGET_TYPE > t=Type2Type< TARGET_TYPE >())
 Construct an object from another object of a different type. More...

template<typename ROTATION_TYPE, typename SOURCE_TYPE> ROTATION_TYPE makeRot (const SOURCE_TYPE &coord, Type2Type< ROTATION_TYPE > t=Type2Type< ROTATION_TYPE >())
 Create a rotation datatype from another rotation datatype. More...

template<typename ROTATION_TYPE> ROTATION_TYPE 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. More...

template<typename TRANS_TYPE, typename SRC_TYPE> TRANS_TYPE makeTrans (const SRC_TYPE &arg, Type2Type< TRANS_TYPE > t=Type2Type< TRANS_TYPE >())
 Make a translation datatype from another translation datatype. More...

template<typename ROTATION_TYPE> ROTATION_TYPE 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. More...

template<typename DEST_TYPE, typename DATA_TYPE> DEST_TYPE & 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. More...


Vec Generators

template<typename DATA_TYPE> Vec< DATA_TYPE, 3 > makeVec (const Quat< DATA_TYPE > &quat)
 create a vector from the vector component of a quaternion. More...

template<typename DATA_TYPE, unsigned SIZE> Vec< DATA_TYPE, SIZE > makeNormal (Vec< DATA_TYPE, SIZE > vec)
 create a normalized vector from the given vector. More...

template<typename VEC_TYPE, typename DATA_TYPE, unsigned ROWS, unsigned COLS> VEC_TYPE & setTrans (VEC_TYPE &result, const Matrix< DATA_TYPE, ROWS, COLS > &arg)
 Set vector using translation portion of the matrix. More...


Quat Generators

template<typename DATA_TYPE> Quat< DATA_TYPE > & setPure (Quat< DATA_TYPE > &quat, const Vec< DATA_TYPE, 3 > &vec)
 Set pure quaternion. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > makePure (const Vec< DATA_TYPE, 3 > &vec)
 create a pure quaternion. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > makeNormal (const Quat< DATA_TYPE > &quat)
 Normalize a quaternion. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > makeConj (const Quat< DATA_TYPE > &quat)
 quaternion complex conjugate. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > makeInvert (const Quat< DATA_TYPE > &quat)
 create quaternion from the inverse of another quaternion. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > & set (Quat< DATA_TYPE > &result, const AxisAngle< DATA_TYPE > &axisAngle)
 Convert an AxisAngle to a Quat. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > & 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. More...

template<typename DATA_TYPE, typename ROT_ORDER> Quat< DATA_TYPE > & set (Quat< DATA_TYPE > &result, const EulerAngle< DATA_TYPE, ROT_ORDER > &euler)
 Convert an EulerAngle rotation to a Quaternion rotation. More...

template<typename DATA_TYPE, typename ROT_ORDER> Quat< DATA_TYPE > & 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. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Quat< DATA_TYPE > & set (Quat< DATA_TYPE > &quat, const Matrix< DATA_TYPE, ROWS, COLS > &mat)
 Convert a Matrix to a Quat. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Quat< DATA_TYPE > & 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. More...


AxisAngle Generators

template<typename DATA_TYPE> AxisAngle< DATA_TYPE > & set (AxisAngle< DATA_TYPE > &axisAngle, Quat< DATA_TYPE > quat)
 Convert a rotation quaternion to an AxisAngle. More...

template<typename DATA_TYPE> AxisAngle< DATA_TYPE > & setRot (AxisAngle< DATA_TYPE > &result, Quat< DATA_TYPE > quat)
 Redundant duplication of the set(axisangle,quat) function, this is provided only for template compatibility. More...

template<typename DATA_TYPE> AxisAngle< DATA_TYPE > makeNormal (const AxisAngle< DATA_TYPE > &a)
 make the axis of an AxisAngle normalized. More...


EulerAngle Generators

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS, typename ROT_ORDER> EulerAngle< DATA_TYPE, ROT_ORDER > & set (EulerAngle< DATA_TYPE, ROT_ORDER > &euler, const Matrix< DATA_TYPE, ROWS, COLS > &mat)
 Convert Matrix to EulerAngle. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS, typename ROT_ORDER> EulerAngle< DATA_TYPE, ROT_ORDER > & 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. More...


Matrix Generators

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS, unsigned SIZE> Matrix< DATA_TYPE, ROWS, COLS > & setTrans (Matrix< DATA_TYPE, ROWS, COLS > &result, const Vec< DATA_TYPE, SIZE > &trans)
 Set matrix translation from vec. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS, unsigned SIZE> Matrix< DATA_TYPE, ROWS, COLS > & setScale (Matrix< DATA_TYPE, ROWS, COLS > &result, const Vec< DATA_TYPE, SIZE > &scale)
 Set the scale part of a matrix. More...

template<typename MATRIX_TYPE, unsigned SIZE> MATRIX_TYPE makeScale (const Vec< typename MATRIX_TYPE::DataType, SIZE > &scale, Type2Type< MATRIX_TYPE > t=Type2Type< MATRIX_TYPE >())
 Create a scale matrix. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Matrix< DATA_TYPE, ROWS, COLS > & setScale (Matrix< DATA_TYPE, ROWS, COLS > &result, const DATA_TYPE scale)
 Sets the scale part of a matrix. More...

template<typename MATRIX_TYPE> MATRIX_TYPE makeScale (const typename MATRIX_TYPE::DataType scale, Type2Type< MATRIX_TYPE > t=Type2Type< MATRIX_TYPE >())
 Create a scale matrix. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Matrix< DATA_TYPE, ROWS, COLS > & 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). More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Matrix< DATA_TYPE, ROWS, COLS > & set (Matrix< DATA_TYPE, ROWS, COLS > &result, const AxisAngle< DATA_TYPE > &axisAngle)
 Convert an AxisAngle to a rotation matrix. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS, typename ROT_ORDER> Matrix< DATA_TYPE, ROWS, COLS > & 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). More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS, typename ROT_ORDER> Matrix< DATA_TYPE, ROWS, COLS > & set (Matrix< DATA_TYPE, ROWS, COLS > &result, const EulerAngle< DATA_TYPE, ROT_ORDER > &euler)
 Convert an EulerAngle to a rotation matrix. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> DATA_TYPE makeYRot (const Matrix< DATA_TYPE, ROWS, COLS > &mat)
 Extracts the Y axis rotation information from the matrix. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> DATA_TYPE makeXRot (const Matrix< DATA_TYPE, ROWS, COLS > &mat)
 Extracts the X-axis rotation information from the matrix. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> DATA_TYPE makeZRot (const Matrix< DATA_TYPE, ROWS, COLS > &mat)
 Extracts the Z-axis rotation information from the matrix. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Matrix< DATA_TYPE, ROWS, COLS > & 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. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Matrix< DATA_TYPE, ROWS, COLS > & 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. More...

template<typename ROTATION_TYPE> ROTATION_TYPE 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. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Matrix< DATA_TYPE, ROWS, COLS > makeTranspose (const Matrix< DATA_TYPE, ROWS, COLS > &m)
 create a matrix transposed from the source. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Matrix< DATA_TYPE, ROWS, COLS > makeInverse (const Matrix< DATA_TYPE, ROWS, COLS > &src)
 Creates a matrix that is the inverse of the given source matrix. More...

template<typename DATATYPE, typename POS_TYPE, typename ROT_TYPE, unsigned MATCOLS, unsigned MATROWS> Matrix< DATATYPE, MATROWS,
MATCOLS > & 
set (Matrix< DATATYPE, MATROWS, MATCOLS > &mat, const Coord< POS_TYPE, ROT_TYPE > &coord)
 Convert a Coord to a Matrix. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Matrix< DATA_TYPE, ROWS, COLS > & setRot (Matrix< DATA_TYPE, ROWS, COLS > &mat, const Quat< DATA_TYPE > &q)
 Set the rotation portion of a matrix (3x3) from a rotation quaternion. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Matrix< DATA_TYPE, ROWS, COLS > & set (Matrix< DATA_TYPE, ROWS, COLS > &mat, const Quat< DATA_TYPE > &q)
 Convert a Quat to a rotation Matrix. More...


Coord Generators

template<typename DATATYPE, typename POS_TYPE, typename ROT_TYPE, unsigned MATCOLS, unsigned MATROWS> Coord< POS_TYPE, ROT_TYPE > & set (Coord< POS_TYPE, ROT_TYPE > &eulercoord, const Matrix< DATATYPE, MATROWS, MATCOLS > &mat)
 convert Matrix to Coord. More...

template<typename DATATYPE, typename POS_TYPE, typename ROT_TYPE, unsigned MATCOLS, unsigned MATROWS> Coord< POS_TYPE, ROT_TYPE > & 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. More...


Matrix Operations

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Matrix< DATA_TYPE, ROWS, COLS > & identity (Matrix< DATA_TYPE, ROWS, COLS > &result)
 Make identity matrix out the matrix. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Matrix< DATA_TYPE, ROWS, COLS > & zero (Matrix< DATA_TYPE, ROWS, COLS > &result)
 zero out the matrix. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned INTERNAL, unsigned COLS> Matrix< DATA_TYPE, ROWS, COLS > & mult (Matrix< DATA_TYPE, ROWS, COLS > &result, const Matrix< DATA_TYPE, ROWS, INTERNAL > &lhs, const Matrix< DATA_TYPE, INTERNAL, COLS > &rhs)
 matrix multiply. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned INTERNAL, unsigned COLS> Matrix< DATA_TYPE, ROWS, COLS > operator * (const Matrix< DATA_TYPE, ROWS, INTERNAL > &lhs, const Matrix< DATA_TYPE, INTERNAL, COLS > &rhs)
 matrix * matrix. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Matrix< DATA_TYPE, ROWS, COLS > & sub (Matrix< DATA_TYPE, ROWS, COLS > &result, const Matrix< DATA_TYPE, ROWS, COLS > &lhs, const Matrix< DATA_TYPE, ROWS, COLS > &rhs)
 matrix subtraction (algebraic operation for matrix). More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Matrix< DATA_TYPE, ROWS, COLS > & add (Matrix< DATA_TYPE, ROWS, COLS > &result, const Matrix< DATA_TYPE, ROWS, COLS > &lhs, const Matrix< DATA_TYPE, ROWS, COLS > &rhs)
 matrix addition (algebraic operation for matrix). More...

template<typename DATA_TYPE, unsigned SIZE> Matrix< DATA_TYPE, SIZE, SIZE > & postMult (Matrix< DATA_TYPE, SIZE, SIZE > &result, const Matrix< DATA_TYPE, SIZE, SIZE > &operand)
 matrix postmultiply. More...

template<typename DATA_TYPE, unsigned SIZE> Matrix< DATA_TYPE, SIZE, SIZE > & preMult (Matrix< DATA_TYPE, SIZE, SIZE > &result, const Matrix< DATA_TYPE, SIZE, SIZE > &operand)
 matrix preMultiply. More...

template<typename DATA_TYPE, unsigned SIZE> Matrix< DATA_TYPE, SIZE, SIZE > & operator *= (Matrix< DATA_TYPE, SIZE, SIZE > &result, const Matrix< DATA_TYPE, SIZE, SIZE > &operand)
 matrix postmult (operator *=). More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Matrix< DATA_TYPE, ROWS, COLS > & mult (Matrix< DATA_TYPE, ROWS, COLS > &result, const Matrix< DATA_TYPE, ROWS, COLS > &mat, float scalar)
 matrix scalar mult. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Matrix< DATA_TYPE, ROWS, COLS > & mult (Matrix< DATA_TYPE, ROWS, COLS > &result, DATA_TYPE scalar)
 matrix scalar mult. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Matrix< DATA_TYPE, ROWS, COLS > & operator *= (Matrix< DATA_TYPE, ROWS, COLS > &result, DATA_TYPE scalar)
 matrix scalar mult (operator *=). More...

template<typename DATA_TYPE, unsigned SIZE> Matrix< DATA_TYPE, SIZE, SIZE > & transpose (Matrix< DATA_TYPE, SIZE, SIZE > &result)
 matrix transpose in place. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Matrix< DATA_TYPE, ROWS, COLS > & transpose (Matrix< DATA_TYPE, ROWS, COLS > &result, const Matrix< DATA_TYPE, COLS, ROWS > &source)
 matrix transpose from one type to another (i.e. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Matrix< DATA_TYPE, ROWS, COLS > & invertFull (Matrix< DATA_TYPE, ROWS, COLS > &result, const Matrix< DATA_TYPE, ROWS, COLS > &src)
 full matrix inversion. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Matrix< DATA_TYPE, ROWS, COLS > & invert (Matrix< DATA_TYPE, ROWS, COLS > &result, const Matrix< DATA_TYPE, ROWS, COLS > &src)
 smart matrix inversion. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Matrix< DATA_TYPE, ROWS, COLS > & invert (Matrix< DATA_TYPE, ROWS, COLS > &result)
 smart matrix inversion (in place) Does matrix inversion by intelligently selecting what type of inversion to use depending on the types of operations your Matrix has been through. More...


Matrix Comparitors

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> bool operator== (const Matrix< DATA_TYPE, ROWS, COLS > &lhs, const Matrix< DATA_TYPE, ROWS, COLS > &rhs)
 Tests 2 matrices for equality. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> bool operator!= (const Matrix< DATA_TYPE, ROWS, COLS > &lhs, const Matrix< DATA_TYPE, ROWS, COLS > &rhs)
 Tests 2 matrices for inequality. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> bool isEqual (const Matrix< DATA_TYPE, ROWS, COLS > &lhs, const Matrix< DATA_TYPE, ROWS, COLS > &rhs, const DATA_TYPE &eps=(DATA_TYPE) 0)
 Tests 2 matrices for equality within a tolerance. More...


Output Stream Operators

template<class DATA_TYPE, unsigned SIZE> std::ostream & operator<< (std::ostream &out, const VecBase< DATA_TYPE, SIZE > &v)
 Outputs a string representation of the given VecBase type to the given output stream. More...

template<class DATA_TYPE, typename ROTATION_ORDER> std::ostream & operator<< (std::ostream &out, const EulerAngle< DATA_TYPE, ROTATION_ORDER > &e)
 Outputs a string representation of the given EulerAngle type to the given output stream. More...

template<class DATA_TYPE, unsigned ROWS, unsigned COLS> std::ostream & operator<< (std::ostream &out, const Matrix< DATA_TYPE, ROWS, COLS > &m)
 Outputs a string representation of the given Matrix to the given output stream. More...

template<typename DATA_TYPE> std::ostream & operator<< (std::ostream &out, const Quat< DATA_TYPE > &q)
 Outputs a string representation of the given Matrix to the given output stream. More...

template<typename DATA_TYPE> std::ostream & operator<< (std::ostream &out, const Tri< DATA_TYPE > &t)
 Outputs a string representation of the given Tri to the given output stream. More...

template<typename DATA_TYPE> std::ostream & operator<< (std::ostream &out, const Plane< DATA_TYPE > &p)
 Outputs a string representation of the given Plane to the given output stream. More...

template<typename DATA_TYPE> std::ostream & operator<< (std::ostream &out, const Sphere< DATA_TYPE > &s)
 Outputs a string representation of the given Sphere to the given output stream. More...

template<typename DATA_TYPE> std::ostream & operator<< (std::ostream &out, const AABox< DATA_TYPE > &b)
 Outputs a string representation of the given AABox to the given output stream. More...


Plane Operations

template<class DATA_TYPE> DATA_TYPE distance (const Plane< DATA_TYPE > &plane, const Point< DATA_TYPE, 3 > &pt)
 Computes the distance from the plane to the point. More...

template<class DATA_TYPE> PlaneSide whichSide (const Plane< DATA_TYPE > &plane, const Point< DATA_TYPE, 3 > &pt)
 Determines which side of the plane the given point lies. More...

template<class DATA_TYPE> PlaneSide whichSide (const Plane< DATA_TYPE > &plane, const Point< DATA_TYPE, 3 > &pt, const DATA_TYPE &eps)
 Determines which side of the plane the given point lies with the given epsilon tolerance. More...

template<class DATA_TYPE> DATA_TYPE findNearestPt (const Plane< DATA_TYPE > &plane, const Point< DATA_TYPE, 3 > &pt, Point< DATA_TYPE, 3 > &result)
 Finds the point on the plane that is nearest to the given point. More...


Plane Comparitors

template<class DATA_TYPE> bool operator== (const Plane< DATA_TYPE > &p1, const Plane< DATA_TYPE > &p2)
 Compare two planes to see if they are EXACTLY the same. More...

template<class DATA_TYPE> bool operator!= (const Plane< DATA_TYPE > &p1, const Plane< DATA_TYPE > &p2)
 Compare two planes to see if they are not EXACTLY the same. More...

template<class DATA_TYPE> bool isEqual (const Plane< DATA_TYPE > &p1, const Plane< DATA_TYPE > &p2, const DATA_TYPE &eps)
 Compare two planes to see if they are the same within the given tolerance. More...


Quat Operations

template<typename DATA_TYPE> Quat< DATA_TYPE > & mult (Quat< DATA_TYPE > &result, const Quat< DATA_TYPE > &q1, const Quat< DATA_TYPE > &q2)
 product of two quaternions (quaternion product) multiplication of quats is much like multiplication of typical complex numbers. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > operator * (const Quat< DATA_TYPE > &q1, const Quat< DATA_TYPE > &q2)
 product of two quaternions (quaternion product) Does quaternion multiplication. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > & operator *= (Quat< DATA_TYPE > &result, const Quat< DATA_TYPE > &q2)
 quaternion postmult. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > & negate (Quat< DATA_TYPE > &result)
 Vector negation - negate each element in the quaternion vector. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > operator- (const Quat< DATA_TYPE > &quat)
 Vector negation - (operator-) return a temporary that is the negative of the given quat. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > & mult (Quat< DATA_TYPE > &result, const Quat< DATA_TYPE > &q, DATA_TYPE s)
 vector scalar multiplication. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > operator * (const Quat< DATA_TYPE > &q, DATA_TYPE s)
 vector scalar multiplication. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > & operator *= (Quat< DATA_TYPE > &q, DATA_TYPE s)
 vector scalar multiplication. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > & div (Quat< DATA_TYPE > &result, const Quat< DATA_TYPE > &q1, Quat< DATA_TYPE > q2)
 quotient of two quaternions. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > operator/ (const Quat< DATA_TYPE > &q1, Quat< DATA_TYPE > q2)
 quotient of two quaternions. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > & operator/= (Quat< DATA_TYPE > &result, const Quat< DATA_TYPE > &q2)
 quotient of two quaternions. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > & div (Quat< DATA_TYPE > &result, const Quat< DATA_TYPE > &q, DATA_TYPE s)
 quaternion vector scale. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > operator/ (const Quat< DATA_TYPE > &q, DATA_TYPE s)
 vector scalar division. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > & operator/= (const Quat< DATA_TYPE > &q, DATA_TYPE s)
 vector scalar division. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > & add (Quat< DATA_TYPE > &result, const Quat< DATA_TYPE > &q1, const Quat< DATA_TYPE > &q2)
 vector addition. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > operator+ (const Quat< DATA_TYPE > &q1, const Quat< DATA_TYPE > &q2)
 vector addition. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > & operator+= (Quat< DATA_TYPE > &q1, const Quat< DATA_TYPE > &q2)
 vector addition. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > & sub (Quat< DATA_TYPE > &result, const Quat< DATA_TYPE > &q1, const Quat< DATA_TYPE > &q2)
 vector subtraction. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > operator- (const Quat< DATA_TYPE > &q1, const Quat< DATA_TYPE > &q2)
 vector subtraction. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > & operator-= (Quat< DATA_TYPE > &q1, const Quat< DATA_TYPE > &q2)
 vector subtraction. More...

template<typename DATA_TYPE> DATA_TYPE dot (const Quat< DATA_TYPE > &q1, const Quat< DATA_TYPE > &q2)
 vector dot product between two quaternions. More...

template<typename DATA_TYPE> DATA_TYPE lengthSquared (const Quat< DATA_TYPE > &q)
 quaternion "norm" (also known as vector length squared) using this can be faster than using length for some operations... More...

template<typename DATA_TYPE> DATA_TYPE length (const Quat< DATA_TYPE > &q)
 quaternion "absolute" (also known as vector length or magnitude) using this can be faster than using length for some operations... More...

template<typename DATA_TYPE> Quat< DATA_TYPE > & normalize (Quat< DATA_TYPE > &result)
 set self to the normalized quaternion of self. More...

template<typename DATA_TYPE> bool isNormalized (const Quat< DATA_TYPE > &q1, const DATA_TYPE eps=(DATA_TYPE) 0.0001f)
 Determines if the given quaternion is normalized within the given tolerance. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > & conj (Quat< DATA_TYPE > &result)
 quaternion complex conjugate. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > & invert (Quat< DATA_TYPE > &result)
 quaternion multiplicative inverse. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > & exp (Quat< DATA_TYPE > &result)
 complex exponentiation. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > & log (Quat< DATA_TYPE > &result)
 complex logarithm. More...

template<typename DATA_TYPE> void squad (Quat< DATA_TYPE > &result, DATA_TYPE t, const Quat< DATA_TYPE > &q1, const Quat< DATA_TYPE > &q2, const Quat< DATA_TYPE > &a, const Quat< DATA_TYPE > &b)
 WARNING: not implemented (do not use). More...

template<typename DATA_TYPE> void meanTangent (Quat< DATA_TYPE > &result, const Quat< DATA_TYPE > &q1, const Quat< DATA_TYPE > &q2, const Quat< DATA_TYPE > &q3)
 WARNING: not implemented (do not use). More...


Quaternion Interpolation

template<typename DATA_TYPE> Quat< DATA_TYPE > & slerp (Quat< DATA_TYPE > &result, const DATA_TYPE t, const Quat< DATA_TYPE > &from, const Quat< DATA_TYPE > &to, bool adjustSign=true)
 spherical linear interpolation between two rotation quaternions. More...

template<typename DATA_TYPE> Quat< DATA_TYPE > & lerp (Quat< DATA_TYPE > &result, const DATA_TYPE t, const Quat< DATA_TYPE > &from, const Quat< DATA_TYPE > &to)
 linear interpolation between two quaternions. More...


Quat Comparisons

template<typename DATA_TYPE> bool operator== (const Quat< DATA_TYPE > &q1, const Quat< DATA_TYPE > &q2)
 Compare two quaternions for equality. More...

template<typename DATA_TYPE> bool operator!= (const Quat< DATA_TYPE > &q1, const Quat< DATA_TYPE > &q2)
 Compare two quaternions for not-equality. More...

template<typename DATA_TYPE> bool isEqual (const Quat< DATA_TYPE > &q1, const Quat< DATA_TYPE > &q2, DATA_TYPE tol=0.0)
 Compare two quaternions for equality with tolerance. More...

template<typename DATA_TYPE> bool isEquiv (const Quat< DATA_TYPE > &q1, const Quat< DATA_TYPE > &q2, DATA_TYPE tol=0.0)
 Compare two quaternions for geometric equivelence (with tolerance). More...


Sphere Comparitors

template<class DATA_TYPE> bool operator== (const Sphere< DATA_TYPE > &s1, const Sphere< DATA_TYPE > &s2)
 Compare two spheres to see if they are EXACTLY the same. More...

template<class DATA_TYPE> bool operator!= (const Sphere< DATA_TYPE > &s1, const Sphere< DATA_TYPE > &s2)
 Compare two spheres to see if they are not EXACTLY the same. More...

template<class DATA_TYPE> bool isEqual (const Sphere< DATA_TYPE > &s1, const Sphere< DATA_TYPE > &s2, const DATA_TYPE &eps)
 Compare two spheres to see if they are the same within the given tolerance. More...


Triangle Operations

template<class DATA_TYPE> Point< DATA_TYPE, 3 > center (const Tri< DATA_TYPE > &tri)
 Computes the point at the center of the given triangle. More...

template<class DATA_TYPE> Vec< DATA_TYPE, 3 > normal (const Tri< DATA_TYPE > &tri)
 Computes the normal for this triangle. More...


Triangle Comparitors

template<class DATA_TYPE> bool operator== (const Tri< DATA_TYPE > &tri1, const Tri< DATA_TYPE > &tri2)
 Compare two triangles to see if they are EXACTLY the same. More...

template<class DATA_TYPE> bool operator!= (const Tri< DATA_TYPE > &tri1, const Tri< DATA_TYPE > &tri2)
 Compare two triangle to see if they are not EXACTLY the same. More...

template<class DATA_TYPE> bool isEqual (const Tri< DATA_TYPE > &tri1, const Tri< DATA_TYPE > &tri2, const DATA_TYPE &eps)
 Compare two triangles to see if they are the same within the given tolerance. More...


[NOHEADER]

template<class T> void ignore_unused_variable_warning (const T &)

Vector/Point Operations

template<typename DATA_TYPE, unsigned SIZE> Vec< DATA_TYPE, SIZE > operator- (const VecBase< DATA_TYPE, SIZE > &v1)
 Negates v1. More...

template<class DATA_TYPE, unsigned SIZE> VecBase< DATA_TYPE, SIZE > & operator+= (VecBase< DATA_TYPE, SIZE > &v1, const VecBase< DATA_TYPE, SIZE > &v2)
 Adds v2 to v1 and stores the result in v1. More...

template<class DATA_TYPE, unsigned SIZE> VecBase< DATA_TYPE, SIZE > operator+ (const VecBase< DATA_TYPE, SIZE > &v1, const VecBase< DATA_TYPE, SIZE > &v2)
 Adds v2 to v1 and returns the result. More...

template<class DATA_TYPE, unsigned SIZE> VecBase< DATA_TYPE, SIZE > & operator-= (VecBase< DATA_TYPE, SIZE > &v1, const VecBase< DATA_TYPE, SIZE > &v2)
 Subtracts v2 from v1 and stores the result in v1. More...

template<class DATA_TYPE, unsigned SIZE> Vec< DATA_TYPE, SIZE > operator- (const VecBase< DATA_TYPE, SIZE > &v1, const VecBase< DATA_TYPE, SIZE > &v2)
 Subtracts v2 from v1 and returns the result. More...

template<class DATA_TYPE, unsigned SIZE, class SCALAR_TYPE> VecBase< DATA_TYPE, SIZE > & operator *= (VecBase< DATA_TYPE, SIZE > &v1, const SCALAR_TYPE &scalar)
 Multiplies v1 by a scalar value and stores the result in v1. More...

template<class DATA_TYPE, unsigned SIZE, class SCALAR_TYPE> VecBase< DATA_TYPE, SIZE > operator * (const VecBase< DATA_TYPE, SIZE > &v1, const SCALAR_TYPE &scalar)
 Multiplies v1 by a scalar value and returns the result. More...

template<class DATA_TYPE, unsigned SIZE, class SCALAR_TYPE> VecBase< DATA_TYPE, SIZE > operator * (const SCALAR_TYPE &scalar, const VecBase< DATA_TYPE, SIZE > &v1)
 Multiplies v1 by a scalar value and returns the result. More...

template<class DATA_TYPE, unsigned SIZE, class SCALAR_TYPE> VecBase< DATA_TYPE, SIZE > & operator/= (VecBase< DATA_TYPE, SIZE > &v1, const SCALAR_TYPE &scalar)
 Divides v1 by a scalar value and stores the result in v1. More...

template<class DATA_TYPE, unsigned SIZE, class SCALAR_TYPE> VecBase< DATA_TYPE, SIZE > operator/ (const VecBase< DATA_TYPE, SIZE > &v1, const SCALAR_TYPE &scalar)
 Divides v1 by a scalar value and returns the result. More...


Vector Operations

template<class DATA_TYPE, unsigned SIZE> DATA_TYPE dot (const Vec< DATA_TYPE, SIZE > &v1, const Vec< DATA_TYPE, SIZE > &v2)
 Computes dot product of v1 and v2 and returns the result. More...

template<class DATA_TYPE, unsigned SIZE> DATA_TYPE length (const Vec< DATA_TYPE, SIZE > &v1)
 Computes the length of the given vector. More...

template<class DATA_TYPE, unsigned SIZE> DATA_TYPE lengthSquared (const Vec< DATA_TYPE, SIZE > &v1)
 Computes the square of the length of the given vector. More...

template<class DATA_TYPE, unsigned SIZE> DATA_TYPE normalize (Vec< DATA_TYPE, SIZE > &v1)
 Normalizes the given vector in place causing it to be of unit length. More...

template<class DATA_TYPE, unsigned SIZE> bool isNormalized (const Vec< DATA_TYPE, SIZE > &v1, const DATA_TYPE eps=(DATA_TYPE) 0.0001)
 Determines if the given vector is normalized within the given tolerance. More...

template<class DATA_TYPE> Vec< DATA_TYPE, 3 > cross (const Vec< DATA_TYPE, 3 > &v1, const Vec< DATA_TYPE, 3 > &v2)
 Computes the cross product between v1 and v2 and returns the result. More...

template<class DATA_TYPE> Vec< DATA_TYPE, 3 > & cross (Vec< DATA_TYPE, 3 > &result, const Vec< DATA_TYPE, 3 > &v1, const Vec< DATA_TYPE, 3 > &v2)
 Computes the cross product between v1 and v2 and stores the result in result. More...

template<class DATA_TYPE, unsigned SIZE> VecBase< DATA_TYPE, SIZE > & reflect (VecBase< DATA_TYPE, SIZE > &result, const VecBase< DATA_TYPE, SIZE > &vec, const Vec< DATA_TYPE, SIZE > &normal)
 Reflect a vector about a normal. More...


Vector Interpolation

template<typename DATA_TYPE, unsigned SIZE> VecBase< DATA_TYPE, SIZE > & lerp (VecBase< DATA_TYPE, SIZE > &result, const DATA_TYPE &lerpVal, const VecBase< DATA_TYPE, SIZE > &from, const VecBase< DATA_TYPE, SIZE > &to)
 Linearly interpolates between to vectors. More...


Vector Comparitors

template<class DATA_TYPE, unsigned SIZE> bool operator== (const VecBase< DATA_TYPE, SIZE > &v1, const VecBase< DATA_TYPE, SIZE > &v2)
 Compares v1 and v2 to see if they are exactly the same. More...

template<class DATA_TYPE, unsigned SIZE> bool operator!= (const VecBase< DATA_TYPE, SIZE > &v1, const VecBase< DATA_TYPE, SIZE > &v2)
 Compares v1 and v2 to see if they are NOT exactly the same with zero tolerance. More...

template<class DATA_TYPE, unsigned SIZE> bool isEqual (const VecBase< DATA_TYPE, SIZE > &v1, const VecBase< DATA_TYPE, SIZE > &v2, const DATA_TYPE &eps)
 Compares v1 and v2 to see if they are the same within the given epsilon tolerance. More...


Vector Transform (Quaternion)

template<typename DATA_TYPE> VecBase< DATA_TYPE, 3 > & xform (VecBase< DATA_TYPE, 3 > &result, const Quat< DATA_TYPE > &rot, const VecBase< DATA_TYPE, 3 > &vector)
 transform a vector by a rotation quaternion. More...

template<typename DATA_TYPE> VecBase< DATA_TYPE, 3 > operator * (const Quat< DATA_TYPE > &rot, const VecBase< DATA_TYPE, 3 > &vector)
 transform a vector by a rotation quaternion. More...

template<typename DATA_TYPE> VecBase< DATA_TYPE, 3 > operator *= (VecBase< DATA_TYPE, 3 > &vector, const Quat< DATA_TYPE > &rot)
 transform a vector by a rotation quaternion. More...


Vector Transform (Matrix)

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Vec< DATA_TYPE, COLS > & xform (Vec< DATA_TYPE, COLS > &result, const Matrix< DATA_TYPE, ROWS, COLS > &matrix, const Vec< DATA_TYPE, COLS > &vector)
 xform a vector by a matrix. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Vec< DATA_TYPE, COLS > operator * (const Matrix< DATA_TYPE, ROWS, COLS > &matrix, const Vec< DATA_TYPE, COLS > &vector)
 matrix * vector xform. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS, unsigned VEC_SIZE> Vec< DATA_TYPE, VEC_SIZE > & xform (Vec< DATA_TYPE, VEC_SIZE > &result, const Matrix< DATA_TYPE, ROWS, COLS > &matrix, const Vec< DATA_TYPE, VEC_SIZE > &vector)
 partially transform a partially specified vector by a matrix, assumes last elt of vector is 0 (the 0 makes it only partially transformed). More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS, unsigned COLS_MINUS_ONE> Vec< DATA_TYPE, COLS_MINUS_ONE > operator * (const Matrix< DATA_TYPE, ROWS, COLS > &matrix, const Vec< DATA_TYPE, COLS_MINUS_ONE > &vector)
 matrix * partial vector, assumes last elt of vector is 0 (partial transform). More...


Point Transform (Matrix)

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Point< DATA_TYPE, COLS > & xform (Point< DATA_TYPE, COLS > &result, const Matrix< DATA_TYPE, ROWS, COLS > &matrix, const Point< DATA_TYPE, COLS > &point)
 transform point by a matrix. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Point< DATA_TYPE, COLS > operator * (const Matrix< DATA_TYPE, ROWS, COLS > &matrix, const Point< DATA_TYPE, COLS > &point)
 matrix * point. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS, unsigned PNT_SIZE> Point< DATA_TYPE, PNT_SIZE > & xform (Point< DATA_TYPE, PNT_SIZE > &result, const Matrix< DATA_TYPE, ROWS, COLS > &matrix, const Point< DATA_TYPE, PNT_SIZE > &point)
 transform a partially specified point by a matrix, assumes last elt of point is 1. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS, unsigned COLS_MINUS_ONE> Point< DATA_TYPE, COLS_MINUS_ONE > operator * (const Matrix< DATA_TYPE, ROWS, COLS > &matrix, const Point< DATA_TYPE, COLS_MINUS_ONE > &point)
 matrix * partially specified point. More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Point< DATA_TYPE, COLS > operator * (const Point< DATA_TYPE, COLS > &point, const Matrix< DATA_TYPE, ROWS, COLS > &matrix)
 point * a matrix multiplication of [m x k] matrix by a [k x 1] matrix (also known as a Point [with w == 1 for points by definition] ). More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS> Point< DATA_TYPE, COLS > operator *= (Point< DATA_TYPE, COLS > &point, const Matrix< DATA_TYPE, ROWS, COLS > &matrix)
 point *= a matrix multiplication of [m x k] matrix by a [k x 1] matrix (also known as a Point [with w == 1 for points by definition] ). More...

template<typename DATA_TYPE, unsigned ROWS, unsigned COLS, unsigned COLS_MINUS_ONE> Point< DATA_TYPE, COLS_MINUS_ONE > operator *= (Point< DATA_TYPE, COLS_MINUS_ONE > &point, const Matrix< DATA_TYPE, ROWS, COLS > &matrix)
 partial point *= a matrix multiplication of [m x k] matrix by a [k-1 x 1] matrix (also known as a Point [with w == 1 for points by definition] ). More...


Constants

const float GMTL_EPSILON = 1.0e-6f
const float GMTL_MAT_EQUAL_EPSILON = 0.001f
const float GMTL_VEC_EQUAL_EPSILON = 0.0001f

Typedefs

typedef AABox< float > AABoxf
typedef AABox< double > AABoxd
typedef AxisAngle< float > AxisAnglef
typedef AxisAngle< double > AxisAngled
typedef Coord< Vec3d, EulerAngleXYZdCoordVec3EulerAngleXYZd
typedef Coord< Vec3f, EulerAngleXYZfCoordVec3EulerAngleXYZf
typedef Coord< Vec4d, EulerAngleXYZdCoordVec4EulerAngleXYZd
typedef Coord< Vec4f, EulerAngleXYZfCoordVec4EulerAngleXYZf
typedef Coord< Vec3d, EulerAngleZYXdCoordVec3EulerAngleZYXd
typedef Coord< Vec3f, EulerAngleZYXfCoordVec3EulerAngleZYXf
typedef Coord< Vec4d, EulerAngleZYXdCoordVec4EulerAngleZYXd
typedef Coord< Vec4f, EulerAngleZYXfCoordVec4EulerAngleZYXf
typedef Coord< Vec3d, EulerAngleZXYdCoordVec3EulerAngleZXYd
typedef Coord< Vec3f, EulerAngleZXYfCoordVec3EulerAngleZXYf
typedef Coord< Vec4d, EulerAngleZXYdCoordVec4EulerAngleZXYd
typedef Coord< Vec4f, EulerAngleZXYfCoordVec4EulerAngleZXYf
typedef Coord< Vec3d, AxisAngledCoordVec3AxisAngled
typedef Coord< Vec3f, AxisAnglefCoordVec3AxisAnglef
typedef Coord< Vec4d, AxisAngledCoordVec4AxisAngled
typedef Coord< Vec4f, AxisAnglefCoordVec4AxisAnglef
typedef Coord< Vec3f, EulerAngleXYZfCoord3fXYZ
 3 elt types. More...

typedef Coord< Vec3f, EulerAngleZYXfCoord3fZYX
typedef Coord< Vec3f, EulerAngleZXYfCoord3fZXY
typedef Coord< Vec3d, EulerAngleXYZdCoord3dXYZ
typedef Coord< Vec3d, EulerAngleZYXdCoord3dZYX
typedef Coord< Vec3d, EulerAngleZXYdCoord3dZXY
typedef Coord< Vec4f, EulerAngleXYZfCoord4fXYZ
 4 elt types. More...

typedef Coord< Vec4f, EulerAngleZYXfCoord4fZYX
typedef Coord< Vec4f, EulerAngleZXYfCoord4fZXY
typedef Coord< Vec4d, EulerAngleXYZdCoord4dXYZ
typedef Coord< Vec4d, EulerAngleZYXdCoord4dZYX
typedef Coord< Vec4d, EulerAngleZXYdCoord4dZXY
typedef Coord< Vec3f, QuatfCoord3fQuat
 3 elt types. More...

typedef Coord< Vec3d, QuatdCoord3dQuat
typedef Coord< Vec4f, QuatfCoord4fQuat
 4 elt types. More...

typedef Coord< Vec4d, QuatdCoord4dQuat
typedef Coord< Vec3f, AxisAnglefCoord3fAxisAngle
 3 elt types. More...

typedef Coord< Vec3d, AxisAngledCoord3dAxisAngle
typedef Coord< Vec4f, AxisAnglefCoord4fAxisAngle
 4 elt types. More...

typedef Coord< Vec4d, AxisAngledCoord4dAxisAngle
typedef EulerAngle< float,
XYZ
EulerAngleXYZf
typedef EulerAngle< double,
XYZ
EulerAngleXYZd
typedef EulerAngle< float,
ZYX
EulerAngleZYXf
typedef EulerAngle< double,
ZYX
EulerAngleZYXd
typedef EulerAngle< float,
ZXY
EulerAngleZXYf
typedef EulerAngle< double,
ZXY
EulerAngleZXYd
typedef LineSeg< float > LineSegf
typedef LineSeg< double > LineSegd
typedef Matrix< float, 2, 2 > Matrix22f
typedef Matrix< double, 2, 2 > Matrix22d
typedef Matrix< float, 2, 3 > Matrix23f
typedef Matrix< double, 2, 3 > Matrix23d
typedef Matrix< float, 3, 3 > Matrix33f
typedef Matrix< double, 3, 3 > Matrix33d
typedef Matrix< float, 3, 4 > Matrix34f
typedef Matrix< double, 3, 4 > Matrix34d
typedef Matrix< float, 4, 4 > Matrix44f
typedef Matrix< double, 4, 4 > Matrix44d
typedef Plane< float > Planef
typedef Plane< double > Planed
typedef Point< int, 2 > Point2i
typedef Point< float, 2 > Point2f
typedef Point< double, 2 > Point2d
typedef Point< int, 3 > Point3i
typedef Point< float, 3 > Point3f
typedef Point< double, 3 > Point3d
typedef Point< int, 4 > Point4i
typedef Point< float, 4 > Point4f
typedef Point< double, 4 > Point4d
typedef Quat< float > Quatf
typedef Quat< double > Quatd
typedef Ray< float > Rayf
typedef Ray< double > Rayd
typedef Sphere< float > Spheref
typedef Sphere< double > Sphered
typedef Tri< float > Trif
typedef Tri< double > Trid
typedef Tri< int > Trii
typedef Vec< int, 2 > Vec2i
typedef Vec< float, 2 > Vec2f
typedef Vec< double, 2 > Vec2d
typedef Vec< int, 3 > Vec3i
typedef Vec< float, 3 > Vec3f
typedef Vec< double, 3 > Vec3d
typedef Vec< int, 4 > Vec4i
typedef Vec< float, 4 > Vec4f
typedef Vec< double, 4 > Vec4d

Enumerations

enum  VectorIndex { Xelt = 0, Yelt = 1, Zelt = 2, Welt = 3 }
 use the values in this enum to index vector data types (such as Vec, Point, Quat). More...

enum  PlaneSide { ON_PLANE, POS_SIDE, NEG_SIDE }
 Used to describe where a point lies in relationship to a plane. More...


Functions

const AxisAngle< float > AXISANGLE_IDENTITYF (0.0f, 1.0f, 0.0f, 0.0f)
const AxisAngle< double > AXISANGLE_IDENTITYD (0.0, 1.0, 0.0, 0.0)
template<class DATA_TYPE> bool isInVolume (const Sphere< DATA_TYPE > &container, const Point< DATA_TYPE, 3 > &pt)
 Tests if the given point is inside or on the surface of the given spherical volume. More...

template<class DATA_TYPE> bool isInVolume (const Sphere< DATA_TYPE > &container, const Sphere< DATA_TYPE > &sphere)
 Tests if the given sphere is completely inside or on the surface of the given spherical volume. More...

template<class DATA_TYPE> void extendVolume (Sphere< DATA_TYPE > &container, const Point< DATA_TYPE, 3 > &pt)
 Modifies the existing sphere to tightly enclose itself and the given point. More...

template<class DATA_TYPE> void extendVolume (Sphere< DATA_TYPE > &container, const Sphere< DATA_TYPE > &sphere)
 Modifies the container to tightly enclose itself and the given sphere. More...

template<class DATA_TYPE> void makeVolume (Sphere< DATA_TYPE > &container, const std::vector< Point< DATA_TYPE, 3 > > &pts)
 Modifies the given sphere to tightly enclose all points in the given std::vector. More...

template<class DATA_TYPE> bool isOnVolume (const Sphere< DATA_TYPE > &container, const Point< DATA_TYPE, 3 > &pt)
 Tests if the given point is on the surface of the container with zero tolerance. More...

template<class DATA_TYPE> bool isOnVolume (const Sphere< DATA_TYPE > &container, const Point< DATA_TYPE, 3 > &pt, const DATA_TYPE &tol)
 Tests of the given point is on the surface of the container with the given tolerance. More...

template<class DATA_TYPE> bool isInVolume (const AABox< DATA_TYPE > &container, const Point< DATA_TYPE, 3 > &pt)
 Tests if the given point is inside or on the surface of the given AABox volume. More...

template<class DATA_TYPE> bool isInVolume (const AABox< DATA_TYPE > &container, const AABox< DATA_TYPE > &box)
 Tests if the given AABox is completely inside or on the surface of the given AABox container. More...

template<class DATA_TYPE> void extendVolume (AABox< DATA_TYPE > &container, const Point< DATA_TYPE, 3 > &pt)
 Modifies the existing AABox to tightly enclose itself and the given point. More...

template<class DATA_TYPE> void extendVolume (AABox< DATA_TYPE > &container, const AABox< DATA_TYPE > &box)
 Modifies the container to tightly enclose itself and the given AABox. More...

template<class DATA_TYPE> void makeVolume (AABox< DATA_TYPE > &box, const Sphere< DATA_TYPE > &sph)
 Creates an AABox that tightly encloses the given Sphere. More...

const EulerAngle< float, XYZEULERANGLE_IDENTITY_XYZF (0.0f, 0.0f, 0.0f)
const EulerAngle< double,
XYZ
EULERANGLE_IDENTITY_XYZD (0.0, 0.0, 0.0)
const EulerAngle< float, ZYXEULERANGLE_IDENTITY_ZYXF (0.0f, 0.0f, 0.0f)
const EulerAngle< double,
ZYX
EULERANGLE_IDENTITY_ZYXD (0.0, 0.0, 0.0)
const EulerAngle< float, ZXYEULERANGLE_IDENTITY_ZXYF (0.0f, 0.0f, 0.0f)
const EulerAngle< double,
ZXY
EULERANGLE_IDENTITY_ZXYD (0.0, 0.0, 0.0)
Matrix44fset (Matrix44f &mat, const osg::Matrix &osg_mat)
 Convert an opensg matrix to a gmtl::Matrix. More...

osg::Matrix & set (osg::Matrix &osg_mat, const Matrix44f &mat)
 Convert a GMTL matrix to a OpenSG matrix. More...

void GaussPointsFit (int iQuantity, const Point3 *akPoint, Point3 &rkCenter, Vec3 akAxis[3], float afExtent[3])
bool GaussPointsFit (int iQuantity, const Vec3 *akPoint, const bool *abValid, Vec3 &rkCenter, Vec3 akAxis[3], float afExtent[3])
template<class DATA_TYPE> bool intersect (const AABox< DATA_TYPE > &box1, const AABox< DATA_TYPE > &box2)
 Tests if the given AABoxes intersect with each other. More...

template<class DATA_TYPE> bool intersect (const AABox< DATA_TYPE > &box, const Point< DATA_TYPE, 3 > &point)
 Tests if the given AABox and point intersect with each other. More...

template<class DATA_TYPE> bool intersect (const AABox< DATA_TYPE > &box1, const Vec< DATA_TYPE, 3 > &path1, const AABox< DATA_TYPE > &box2, const Vec< DATA_TYPE, 3 > &path2, DATA_TYPE &firstContact, DATA_TYPE &secondContact)
 Tests if the given AABoxes intersect if moved along the given paths. More...

template<class DATA_TYPE> bool intersect (const Sphere< DATA_TYPE > &sph1, const Vec< DATA_TYPE, 3 > &path1, const Sphere< DATA_TYPE > &sph2, const Vec< DATA_TYPE, 3 > &path2, DATA_TYPE &firstContact, DATA_TYPE &secondContact)
 Tests if the given Spheres intersect if moved along the given paths. More...

template<class DATA_TYPE> bool intersect (const AABox< DATA_TYPE > &box, const Sphere< DATA_TYPE > &sph)
 Tests if the given AABox and Sphere intersect with each other. More...

template<class DATA_TYPE> bool intersect (const Sphere< DATA_TYPE > &sph, const AABox< DATA_TYPE > &box)
 Tests if the given AABox and Sphere intersect with each other. More...

template<class DATA_TYPE> bool intersect (const Sphere< DATA_TYPE > &sphere, const Point< DATA_TYPE, 3 > &point)
 intersect point/sphere. More...

template<typename T> bool intersect (const Sphere< T > &sphere, const Ray< T > &ray, int &numhits, float &t0, float &t1)
 intersect ray/sphere. More...

template<typename T> bool intersect (const Sphere< T > &sphere, const LineSeg< T > &lineseg, int &numhits, float &t0, float &t1)
template<class DATA_TYPE> bool intersect (const Plane< DATA_TYPE > &plane, const Ray< DATA_TYPE > &ray, DATA_TYPE &t)
 Tests if the given plane and ray intersect with each other. More...

template<class DATA_TYPE> bool intersect (const Tri< DATA_TYPE > &tri, const Ray< DATA_TYPE > &ray, float &u, float &v, float &t)
 Tests if the given triangle and ray intersect with each other. More...

template<class DATA_TYPE> bool intersect (const Tri< DATA_TYPE > &tri, const LineSeg< DATA_TYPE > &lineseg, float &u, float &v, float &t)
 Tests if the given triangle and line segment intersect with each other. More...

template<class DATA_TYPE> Point< DATA_TYPE, 3 > findNearestPt (const LineSeg< DATA_TYPE > &lineseg, const Point< DATA_TYPE, 3 > &pt)
 Finds the closest point on the line segment to a given point. More...

template<class DATA_TYPE> DATA_TYPE distance (const LineSeg< DATA_TYPE > &lineseg, const Point< DATA_TYPE, 3 > &pt)
 Computes the shortest distance from the line segment to the given point. More...

template<class DATA_TYPE> DATA_TYPE distanceSquared (const LineSeg< DATA_TYPE > &lineseg, const Point< DATA_TYPE, 3 > &pt)
 Computes the shortest distance from the line segment to the given point. More...

template<class DATA_TYPE> bool operator== (const LineSeg< DATA_TYPE > &ls1, const LineSeg< DATA_TYPE > &ls2)
 Compare two line segments to see if they are EXACTLY the same. More...

template<class DATA_TYPE> bool operator!= (const LineSeg< DATA_TYPE > &ls1, const LineSeg< DATA_TYPE > &ls2)
 Compare two line segments to see if they are not EXACTLY the same. More...

template<class DATA_TYPE> bool isEqual (const LineSeg< DATA_TYPE > &ls1, const LineSeg< DATA_TYPE > &ls2, const DATA_TYPE &eps)
 Compare two line segments to see if the are the same within the given tolerance. More...

const Quat< float > QUAT_MULT_IDENTITYF (0.0f, 0.0f, 0.0f, 1.0f)
const Quat< float > QUAT_ADD_IDENTITYF (0.0f, 0.0f, 0.0f, 0.0f)
const Quat< float > QUAT_IDENTITYF (QUAT_MULT_IDENTITYF)
const Quat< double > QUAT_MULT_IDENTITYD (0.0, 0.0, 0.0, 1.0)
const Quat< double > QUAT_ADD_IDENTITYD (0.0, 0.0, 0.0, 0.0)
const Quat< double > QUAT_IDENTITYD (QUAT_MULT_IDENTITYD)
const char * getVersion ()

Variables

const Matrix22f MAT_IDENTITY22F = Matrix22f()
 32bit floating point 2x2 identity matrix. More...

const Matrix22d MAT_IDENTITY22D = Matrix22d()
 64bit floating point 2x2 identity matrix. More...

const Matrix23f MAT_IDENTITY23F = Matrix23f()
 32bit floating point 2x2 identity matrix. More...

const Matrix23d MAT_IDENTITY23D = Matrix23d()
 64bit floating point 2x2 identity matrix. More...

const Matrix33f MAT_IDENTITY33F = Matrix33f()
 32bit floating point 3x3 identity matrix. More...

const Matrix33d MAT_IDENTITY33D = Matrix33d()
 64bit floating point 3x3 identity matrix. More...

const Matrix34f MAT_IDENTITY34F = Matrix34f()
 32bit floating point 3x4 identity matrix. More...

const Matrix34d MAT_IDENTITY34D = Matrix34d()
 64bit floating point 3x4 identity matrix. More...

const Matrix44f MAT_IDENTITY44F = Matrix44f()
 32bit floating point 4x4 identity matrix. More...

const Matrix44d MAT_IDENTITY44D = Matrix44d()
 64bit floating point 4x4 identity matrix. More...


Detailed Description

Meta programming classes.

Typedef Documentation

typedef AABox<double> gmtl::AABoxd
 

Definition at line 165 of file AABox.h.

typedef AABox<float> gmtl::AABoxf
 

Definition at line 164 of file AABox.h.

typedef AxisAngle<double> gmtl::AxisAngled
 

Definition at line 150 of file AxisAngle.h.

typedef AxisAngle<float> gmtl::AxisAnglef
 

Definition at line 149 of file AxisAngle.h.

typedef Coord<Vec3d, AxisAngled> gmtl::Coord3dAxisAngle
 

Definition at line 215 of file Coord.h.

typedef Coord<Vec3d, Quatd> gmtl::Coord3dQuat
 

Definition at line 206 of file Coord.h.

typedef Coord<Vec3d, EulerAngleXYZd> gmtl::Coord3dXYZ
 

Definition at line 192 of file Coord.h.

typedef Coord<Vec3d, EulerAngleZXYd> gmtl::Coord3dZXY
 

Definition at line 194 of file Coord.h.

typedef Coord<Vec3d, EulerAngleZYXd> gmtl::Coord3dZYX
 

Definition at line 193 of file Coord.h.

typedef Coord<Vec3f, AxisAnglef> gmtl::Coord3fAxisAngle
 

3 elt types.

Definition at line 214 of file Coord.h.

typedef Coord<Vec3f, Quatf> gmtl::Coord3fQuat
 

3 elt types.

Definition at line 205 of file Coord.h.

typedef Coord<Vec3f, EulerAngleXYZf> gmtl::Coord3fXYZ
 

3 elt types.

Definition at line 189 of file Coord.h.

typedef Coord<Vec3f, EulerAngleZXYf> gmtl::Coord3fZXY
 

Definition at line 191 of file Coord.h.

typedef Coord<Vec3f, EulerAngleZYXf> gmtl::Coord3fZYX
 

Definition at line 190 of file Coord.h.

typedef Coord<Vec4d, AxisAngled> gmtl::Coord4dAxisAngle
 

Definition at line 219 of file Coord.h.

typedef Coord<Vec4d, Quatd> gmtl::Coord4dQuat
 

Definition at line 210 of file Coord.h.

typedef Coord<Vec4d, EulerAngleXYZd> gmtl::Coord4dXYZ
 

Definition at line 200 of file Coord.h.

typedef Coord<Vec4d, EulerAngleZXYd> gmtl::Coord4dZXY
 

Definition at line 202 of file Coord.h.

typedef Coord<Vec4d, EulerAngleZYXd> gmtl::Coord4dZYX
 

Definition at line 201 of file Coord.h.

typedef Coord<Vec4f, AxisAnglef> gmtl::Coord4fAxisAngle
 

4 elt types.

Definition at line 218 of file Coord.h.

typedef Coord<Vec4f, Quatf> gmtl::Coord4fQuat
 

4 elt types.

Definition at line 209 of file Coord.h.

typedef Coord<Vec4f, EulerAngleXYZf> gmtl::Coord4fXYZ
 

4 elt types.

Definition at line 197 of file Coord.h.

typedef Coord<Vec4f, EulerAngleZXYf> gmtl::Coord4fZXY
 

Definition at line 199 of file Coord.h.

typedef Coord<Vec4f, EulerAngleZYXf> gmtl::Coord4fZYX
 

Definition at line 198 of file Coord.h.

typedef Coord<Vec3d, AxisAngled> gmtl::CoordVec3AxisAngled
 

Definition at line 181 of file Coord.h.

typedef Coord<Vec3f, AxisAnglef> gmtl::CoordVec3AxisAnglef
 

Definition at line 182 of file Coord.h.

typedef Coord<Vec3d, EulerAngleXYZd> gmtl::CoordVec3EulerAngleXYZd
 

Definition at line 166 of file Coord.h.

typedef Coord<Vec3f, EulerAngleXYZf> gmtl::CoordVec3EulerAngleXYZf
 

Definition at line 167 of file Coord.h.

typedef Coord<Vec3d, EulerAngleZXYd> gmtl::CoordVec3EulerAngleZXYd
 

Definition at line 176 of file Coord.h.

typedef Coord<Vec3f, EulerAngleZXYf> gmtl::CoordVec3EulerAngleZXYf
 

Definition at line 177 of file Coord.h.

typedef Coord<Vec3d, EulerAngleZYXd> gmtl::CoordVec3EulerAngleZYXd
 

Definition at line 171 of file Coord.h.

typedef Coord<Vec3f, EulerAngleZYXf> gmtl::CoordVec3EulerAngleZYXf
 

Definition at line 172 of file Coord.h.

typedef Coord<Vec4d, AxisAngled> gmtl::CoordVec4AxisAngled
 

Definition at line 183 of file Coord.h.

typedef Coord<Vec4f, AxisAnglef> gmtl::CoordVec4AxisAnglef
 

Definition at line 184 of file Coord.h.

typedef Coord<Vec4d, EulerAngleXYZd> gmtl::CoordVec4EulerAngleXYZd
 

Definition at line 168 of file Coord.h.

typedef Coord<Vec4f, EulerAngleXYZf> gmtl::CoordVec4EulerAngleXYZf
 

Definition at line 169 of file Coord.h.

typedef Coord<Vec4d, EulerAngleZXYd> gmtl::CoordVec4EulerAngleZXYd
 

Definition at line 178 of file Coord.h.

typedef Coord<Vec4f, EulerAngleZXYf> gmtl::CoordVec4EulerAngleZXYf
 

Definition at line 179 of file Coord.h.

typedef Coord<Vec4d, EulerAngleZYXd> gmtl::CoordVec4EulerAngleZYXd
 

Definition at line 173 of file Coord.h.

typedef Coord<Vec4f, EulerAngleZYXf> gmtl::CoordVec4EulerAngleZYXf
 

Definition at line 174 of file Coord.h.

typedef EulerAngle<double, XYZ> gmtl::EulerAngleXYZd
 

Definition at line 149 of file EulerAngle.h.

typedef EulerAngle<float, XYZ> gmtl::EulerAngleXYZf
 

Definition at line 148 of file EulerAngle.h.

typedef EulerAngle<double, ZXY> gmtl::EulerAngleZXYd
 

Definition at line 153 of file EulerAngle.h.

typedef EulerAngle<float, ZXY> gmtl::EulerAngleZXYf
 

Definition at line 152 of file EulerAngle.h.

typedef EulerAngle<double, ZYX> gmtl::EulerAngleZYXd
 

Definition at line 151 of file EulerAngle.h.

typedef EulerAngle<float, ZYX> gmtl::EulerAngleZYXf
 

Definition at line 150 of file EulerAngle.h.

typedef LineSeg<double> gmtl::LineSegd
 

Definition at line 112 of file LineSeg.h.

typedef LineSeg<float> gmtl::LineSegf
 

Definition at line 111 of file LineSeg.h.

typedef Matrix<double, 2, 2> gmtl::Matrix22d
 

Definition at line 369 of file Matrix.h.

typedef Matrix<float, 2, 2> gmtl::Matrix22f
 

Definition at line 368 of file Matrix.h.

typedef Matrix<double, 2, 3> gmtl::Matrix23d
 

Definition at line 371 of file Matrix.h.

typedef Matrix<float, 2, 3> gmtl::Matrix23f
 

Definition at line 370 of file Matrix.h.

typedef Matrix<double, 3, 3> gmtl::Matrix33d
 

Definition at line 373 of file Matrix.h.

typedef Matrix<float, 3, 3> gmtl::Matrix33f
 

Definition at line 372 of file Matrix.h.

typedef Matrix<double, 3, 4> gmtl::Matrix34d
 

Definition at line 375 of file Matrix.h.

typedef Matrix<float, 3, 4> gmtl::Matrix34f
 

Definition at line 374 of file Matrix.h.

typedef Matrix<double, 4, 4> gmtl::Matrix44d
 

Definition at line 377 of file Matrix.h.

typedef Matrix<float, 4, 4> gmtl::Matrix44f
 

Definition at line 376 of file Matrix.h.

typedef Plane<double> gmtl::Planed
 

Definition at line 186 of file Plane.h.

typedef Plane<float> gmtl::Planef
 

Definition at line 185 of file Plane.h.

typedef Point<double,2> gmtl::Point2d
 

Definition at line 123 of file Point.h.

typedef Point<float,2> gmtl::Point2f
 

Definition at line 122 of file Point.h.

typedef Point<int,2> gmtl::Point2i
 

Definition at line 121 of file Point.h.

typedef Point<double,3> gmtl::Point3d
 

Definition at line 126 of file Point.h.

typedef Point<float,3> gmtl::Point3f
 

Definition at line 125 of file Point.h.

typedef Point<int, 3> gmtl::Point3i
 

Definition at line 124 of file Point.h.

typedef Point<double,4> gmtl::Point4d
 

Definition at line 129 of file Point.h.

typedef Point<float,4> gmtl::Point4f
 

Definition at line 128 of file Point.h.

typedef Point<int, 4> gmtl::Point4i
 

Definition at line 127 of file Point.h.

typedef Quat<double> gmtl::Quatd
 

Definition at line 185 of file Quat.h.

typedef Quat<float> gmtl::Quatf
 

Definition at line 184 of file Quat.h.

typedef Ray<double> gmtl::Rayd
 

Definition at line 143 of file Ray.h.

typedef Ray<float> gmtl::Rayf
 

Definition at line 142 of file Ray.h.

typedef Sphere<double> gmtl::Sphered
 

Definition at line 136 of file Sphere.h.

typedef Sphere<float> gmtl::Spheref
 

Definition at line 135 of file Sphere.h.

typedef Tri<double> gmtl::Trid
 

Definition at line 155 of file Tri.h.

typedef Tri<float> gmtl::Trif
 

Definition at line 154 of file Tri.h.

typedef Tri<int> gmtl::Trii
 

Definition at line 156 of file Tri.h.

typedef Vec<double,2> gmtl::Vec2d
 

Definition at line 124 of file Vec.h.

typedef Vec<float,2> gmtl::Vec2f
 

Definition at line 123 of file Vec.h.

typedef Vec<int, 2> gmtl::Vec2i
 

Definition at line 122 of file Vec.h.

typedef Vec<double,3> gmtl::Vec3d
 

Definition at line 127 of file Vec.h.

typedef Vec<float,3> gmtl::Vec3f
 

Definition at line 126 of file Vec.h.

typedef Vec<int, 3> gmtl::Vec3i
 

Definition at line 125 of file Vec.h.

typedef Vec<double,4> gmtl::Vec4d
 

Definition at line 130 of file Vec.h.

typedef Vec<float,4> gmtl::Vec4f
 

Definition at line 129 of file Vec.h.

typedef Vec<int, 4> gmtl::Vec4i
 

Definition at line 128 of file Vec.h.


Function Documentation

const AxisAngle<double> AXISANGLE_IDENTITYD 0.    0,
1.    0,
0.    0,
0.    0
 

const AxisAngle<float> AXISANGLE_IDENTITYF 0.    0f,
1.    0f,
0.    0f,
0.    0f
 

template<class DATA_TYPE>
DATA_TYPE distance const LineSeg< DATA_TYPE > &    lineseg,
const Point< DATA_TYPE, 3 > &    pt
[inline]
 

Computes the shortest distance from the line segment to the given point.

Parameters:
lineseg  the line segment to test
pt  the point which to test against lineseg
Returns:
the shortest distance from pt to lineseg

Definition at line 68 of file LineSegOps.h.

00070 {
00071    return gmtl::length( pt - findNearestPt( lineseg, pt ) );
00072 }

template<class DATA_TYPE>
DATA_TYPE distanceSquared const LineSeg< DATA_TYPE > &    lineseg,
const Point< DATA_TYPE, 3 > &    pt
[inline]
 

Computes the shortest distance from the line segment to the given point.

Parameters:
lineseg  the line segment to test
pt  the point which to test against lineseg
Returns:
the squared shortest distance from pt to lineseg (value is squared, this func is slightly faster since it doesn't involve a sqrt)

Definition at line 83 of file LineSegOps.h.

00085 {
00086    return gmtl::lengthSquared( pt - findNearestPt( lineseg, pt ) );
00087 }

const EulerAngle<double, XYZ> EULERANGLE_IDENTITY_XYZD 0.    0,
0.    0,
0.    0
 

const EulerAngle<float, XYZ> EULERANGLE_IDENTITY_XYZF 0.    0f,
0.    0f,
0.    0f
 

const EulerAngle<double, ZXY> EULERANGLE_IDENTITY_ZXYD 0.    0,
0.    0,
0.    0
 

const EulerAngle<float, ZXY> EULERANGLE_IDENTITY_ZXYF 0.    0f,
0.    0f,
0.    0f
 

const EulerAngle<double, ZYX> EULERANGLE_IDENTITY_ZYXD 0.    0,
0.    0,
0.    0
 

const EulerAngle<float, ZYX> EULERANGLE_IDENTITY_ZYXF 0.    0f,
0.    0f,
0.    0f
 

template<class DATA_TYPE>
void extendVolume AABox< DATA_TYPE > &    container,
const AABox< DATA_TYPE > &    box
 

Modifies the container to tightly enclose itself and the given AABox.

Parameters:
container  [in,out] the AABox that will be extended
box  [in] the AABox which container should contain

Definition at line 440 of file Containment.h.

00442 {
00443    // Can't extend by an empty box
00444    if (box.isEmpty())
00445    {
00446       return;
00447    }
00448 
00449    // An empty container is extended to be the box
00450    if (container.isEmpty())
00451    {
00452       container = box;
00453    }
00454 
00455    // Just extend by the corners of the box
00456    extendVolume(container, box.getMin());
00457    extendVolume(container, box.getMax());
00458 }

template<class DATA_TYPE>
void extendVolume AABox< DATA_TYPE > &    container,
const Point< DATA_TYPE, 3 > &    pt
 

Modifies the existing AABox to tightly enclose itself and the given point.

Parameters:
container  [in,out] the AABox that will be extended
pt  [in] the point which the AABox should contain

Definition at line 389 of file Containment.h.

00391 {
00392    if (! container.isEmpty())
00393    {
00394       // X coord
00395       if (pt[0] > container.mMax[0])
00396       {
00397          container.mMax[0] = pt[0];
00398       }
00399       else if (pt[0] < container.mMin[0])
00400       {
00401          container.mMin[0] = pt[0];
00402       }
00403 
00404       // Y coord
00405       if (pt[1] > container.mMax[1])
00406       {
00407          container.mMax[1] = pt[1];
00408       }
00409       else if (pt[1] < container.mMin[1])
00410       {
00411          container.mMin[1] = pt[1];
00412       }
00413 
00414       // Z coord
00415       if (pt[2] > container.mMax[2])
00416       {
00417          container.mMax[2] = pt[2];
00418       }
00419       else if (pt[2] < container.mMin[2])
00420       {
00421          container.mMin[2] = pt[2];
00422       }
00423    }
00424    else
00425    {
00426       // Make a box with essentially zero volume at the point
00427       container.setMin(pt);
00428       container.setMax(pt);
00429       container.setEmpty(false);
00430    }
00431 }

template<class DATA_TYPE>
void extendVolume Sphere< DATA_TYPE > &    container,
const Sphere< DATA_TYPE > &    sphere
 

Modifies the container to tightly enclose itself and the given sphere.

Parameters:
container  [in,out] the sphere that will be extended
sphere  [in] the sphere which container should contain

Definition at line 139 of file Containment.h.

00141 {
00142    // check if we already contain the sphere
00143    if ( isInVolume( container, sphere ) )
00144    {
00145       return;
00146    }
00147 
00148    // make a vector pointing from the center of container to sphere. this is the
00149    // direction in which we need to move container's center
00150    Vec<DATA_TYPE, 3> dir = sphere.mCenter - container.mCenter;
00151    DATA_TYPE len = normalize( dir );
00152 
00153    // compute what the new radius should be
00154    DATA_TYPE newRadius = (len + sphere.mRadius + container.mRadius) *
00155                          DATA_TYPE(0.5);
00156 
00157    // compute the new center for container
00158    Point<DATA_TYPE, 3> newCenter = container.mCenter +
00159                                    (dir * (newRadius - container.mRadius));
00160 
00161    // modify container to its new values
00162    container.mCenter = newCenter;
00163    container.mRadius = newRadius;
00164 }

template<class DATA_TYPE>
void extendVolume Sphere< DATA_TYPE > &    container,
const Point< DATA_TYPE, 3 > &    pt
 

Modifies the existing sphere to tightly enclose itself and the given point.

Parameters:
container  [in,out] the sphere that will be extended
pt  [in] the point which the sphere should contain

Definition at line 106 of file Containment.h.

00108 {
00109    // check if we already contain the point
00110    if ( isInVolume( container, pt ) )
00111    {
00112       return;
00113    }
00114 
00115    // make a vector pointing from the center of the sphere to pt. this is the
00116    // direction in which we need to move the sphere's center
00117    Vec<DATA_TYPE, 3> dir = pt - container.mCenter;
00118    DATA_TYPE len = normalize( dir );
00119 
00120    // compute what the new radius should be
00121    DATA_TYPE newRadius =  (len + container.mRadius) * DATA_TYPE(0.5);
00122 
00123    // compute the new center for the sphere
00124    Point<DATA_TYPE, 3> newCenter = container.mCenter +
00125                                    (dir * (newRadius - container.mRadius));
00126 
00127    // modify container to its new values
00128    container.mCenter = newCenter;
00129    container.mRadius = newRadius;
00130 }

template<class DATA_TYPE>
Point<DATA_TYPE, 3> findNearestPt const LineSeg< DATA_TYPE > &    lineseg,
const Point< DATA_TYPE, 3 > &    pt
 

Finds the closest point on the line segment to a given point.

Parameters:
lineseg  the line segment to test
pt  the point which to test against lineseg
Returns:
the point on the line segment closest to pt

Definition at line 51 of file LineSegOps.h.

00053 {
00054    // result = origin + dir * dot((pt-origin), dir)
00055    return ( lineseg.mOrigin + lineseg.mDir *
00056             dot(pt - lineseg.mOrigin, lineseg.mDir) );
00057 }

bool gmtl::GaussPointsFit int    iQuantity,
const Vec3 *    akPoint,
const bool *    abValid,
Vec3 &    rkCenter,
Vec3    akAxis[3],
float    afExtent[3]
 

Definition at line 139 of file GaussPointsFit.h.

00142 {
00143     // compute mean of points
00144     rkCenter = ZeroVec3;
00145     int i, iValidQuantity = 0;
00146     for (i = 0; i < iQuantity; i++)
00147     {
00148         if ( abValid[i] )
00149         {
00150             rkCenter += akPoint[i];
00151             iValidQuantity++;
00152         }
00153     }
00154     if ( iValidQuantity == 0 )
00155         return false;
00156 
00157     float fInvQuantity = 1.0/iValidQuantity;
00158     rkCenter *= fInvQuantity;
00159 
00160     // compute covariances of points
00161     float fSumXX = 0.0, fSumXY = 0.0, fSumXZ = 0.0;
00162     float fSumYY = 0.0, fSumYZ = 0.0, fSumZZ = 0.0;
00163     for (i = 0; i < iQuantity; i++)
00164     {
00165         if ( abValid[i] )
00166         {
00167             Vec3 kDiff = akPoint[i] - rkCenter;
00168             fSumXX += kDiff[Xelt]*kDiff[Xelt];
00169             fSumXY += kDiff[Xelt]*kDiff[Yelt];
00170             fSumXZ += kDiff[Xelt]*kDiff[Zelt];
00171             fSumYY += kDiff[Yelt]*kDiff[Yelt];
00172             fSumYZ += kDiff[Yelt]*kDiff[Zelt];
00173             fSumZZ += kDiff[Zelt]*kDiff[Zelt];
00174         }
00175     }
00176     fSumXX *= fInvQuantity;
00177     fSumXY *= fInvQuantity;
00178     fSumXZ *= fInvQuantity;
00179     fSumYY *= fInvQuantity;
00180     fSumYZ *= fInvQuantity;
00181     fSumZZ *= fInvQuantity;
00182 
00183     // compute eigenvectors for covariance matrix
00184     Eigen kES(3);
00185     kES.Matrix(0,0) = fSumXX;
00186     kES.Matrix(0,1) = fSumXY;
00187     kES.Matrix(0,2) = fSumXZ;
00188     kES.Matrix(1,0) = fSumXY;
00189     kES.Matrix(1,1) = fSumYY;
00190     kES.Matrix(1,2) = fSumYZ;
00191     kES.Matrix(2,0) = fSumXZ;
00192     kES.Matrix(2,1) = fSumYZ;
00193     kES.Matrix(2,2) = fSumZZ;
00194     kES.IncrSortEigenStuff3();
00195 
00196     akAxis[0][Xelt] = kES.GetEigenvector(0,0);
00197     akAxis[0][Yelt] = kES.GetEigenvector(1,0);
00198     akAxis[0][Zelt] = kES.GetEigenvector(2,0);
00199 
00200     akAxis[1][Xelt] = kES.GetEigenvector(0,1);
00201     akAxis[1][Yelt] = kES.GetEigenvector(1,1);
00202     akAxis[1][Zelt] = kES.GetEigenvector(2,1);
00203 
00204     akAxis[2][Xelt] = kES.GetEigenvector(0,2);
00205     akAxis[2][Yelt] = kES.GetEigenvector(1,2);
00206     akAxis[2][Zelt] = kES.GetEigenvector(2,2);
00207 
00208     afExtent[0] = kES.GetEigenvalue(0);
00209     afExtent[1] = kES.GetEigenvalue(1);
00210     afExtent[2] = kES.GetEigenvalue(2);
00211 
00212     return true;
00213 }

void gmtl::GaussPointsFit int    iQuantity,
const Point3 *    akPoint,
Point3 &    rkCenter,
Vec3    akAxis[3],
float    afExtent[3]
 

Definition at line 76 of file GaussPointsFit.h.

00078 {
00079     // compute mean of points
00080     rkCenter = akPoint[0];
00081     unsigned i;
00082     for (i = 1; i < iQuantity; i++)
00083         rkCenter += akPoint[i];
00084     float fInvQuantity = 1.0f/iQuantity;
00085     rkCenter *= fInvQuantity;
00086 
00087     // compute covariances of points
00088     float fSumXX = 0.0, fSumXY = 0.0, fSumXZ = 0.0;
00089     float fSumYY = 0.0, fSumYZ = 0.0, fSumZZ = 0.0;
00090     for (i = 0; i < iQuantity; i++)
00091     {
00092         Vec3 kDiff = akPoint[i] - rkCenter;
00093         fSumXX += kDiff[Xelt]*kDiff[Xelt];
00094         fSumXY += kDiff[Xelt]*kDiff[Yelt];
00095         fSumXZ += kDiff[Xelt]*kDiff[Zelt];
00096         fSumYY += kDiff[Yelt]*kDiff[Yelt];
00097         fSumYZ += kDiff[Yelt]*kDiff[Zelt];
00098         fSumZZ += kDiff[Zelt]*kDiff[Zelt];
00099     }
00100     fSumXX *= fInvQuantity;
00101     fSumXY *= fInvQuantity;
00102     fSumXZ *= fInvQuantity;
00103     fSumYY *= fInvQuantity;
00104     fSumYZ *= fInvQuantity;
00105     fSumZZ *= fInvQuantity;
00106 
00107     // compute eigenvectors for covariance matrix
00108     gmtl::Eigen kES(3);
00109     kES.Matrix(0,0) = fSumXX;
00110     kES.Matrix(0,1) = fSumXY;
00111     kES.Matrix(0,2) = fSumXZ;
00112     kES.Matrix(1,0) = fSumXY;
00113     kES.Matrix(1,1) = fSumYY;
00114     kES.Matrix(1,2) = fSumYZ;
00115     kES.Matrix(2,0) = fSumXZ;
00116     kES.Matrix(2,1) = fSumYZ;
00117     kES.Matrix(2,2) = fSumZZ;
00118     kES.IncrSortEigenStuff3();
00119 
00120     akAxis[0][Xelt] = kES.GetEigenvector(0,0);
00121     akAxis[0][Yelt] = kES.GetEigenvector(1,0);
00122     akAxis[0][Zelt] = kES.GetEigenvector(2,0);
00123 
00124     akAxis[1][Xelt] = kES.GetEigenvector(0,1);
00125     akAxis[1][Yelt] = kES.GetEigenvector(1,1);
00126     akAxis[1][Zelt] = kES.GetEigenvector(2,1);
00127 
00128     akAxis[2][Xelt] = kES.GetEigenvector(0,2);
00129     akAxis[2][Yelt] = kES.GetEigenvector(1,2);
00130     akAxis[2][Zelt] = kES.GetEigenvector(2,2);
00131 
00132     afExtent[0] = kES.GetEigenvalue(0);
00133     afExtent[1] = kES.GetEigenvalue(1);
00134     afExtent[2] = kES.GetEigenvalue(2);
00135 }

const char* getVersion   [inline]
 

Definition at line 140 of file Version.h.

00141    {
00142       return GMTL_XSTR(GMTL_VERSION_STRING);
00143    }

template<class DATA_TYPE>
bool intersect const Tri< DATA_TYPE > &    tri,
const LineSeg< DATA_TYPE > &    lineseg,
float &    u,
float &    v,
float &    t
 

Tests if the given triangle and line segment intersect with each other.

Parameters:
tri  - the triangle (ccw ordering)
lineseg  - the line segment
u,v  - tangent space u/v coordinates of the intersection
t  - an indicator of the intersection point
Postcondition:
t gives you the intersection point: isect = lineseg.getDir() * t + lineseg.getOrigin()
Returns:
true if the line segment intersects the triangle.

Definition at line 489 of file Intersection.h.

00491    {
00492       const DATA_TYPE eps = (DATA_TYPE)0.0001010101;
00493       DATA_TYPE l = length( lineseg.getDir() );
00494       if (eps < l)
00495       {
00496          Ray<DATA_TYPE> temp( lineseg.getOrigin(), lineseg.getDir() / l );
00497          bool result = intersect( tri, temp, u, v, t );
00498          t /= lineseg.getLength(); // need to normalize the result
00499          return result && t <= (DATA_TYPE)1.0;
00500       }
00501       else 
00502          return false;
00503    }

template<class DATA_TYPE>
bool intersect const Tri< DATA_TYPE > &    tri,
const Ray< DATA_TYPE > &    ray,
float &    u,
float &    v,
float &    t
 

Tests if the given triangle and ray intersect with each other.

Parameters:
tri  - the triangle (ccw ordering)
ray  - the ray
u,v  - tangent space u/v coordinates of the intersection
t  - an indicator of the intersection location
Postcondition:
t gives you the intersection point: isect = ray.dir * t + ray.origin
Returns:
true if the ray intersects the triangle.
See also:
from http://www.acm.org/jgt/papers/MollerTrumbore97/code.html

Definition at line 429 of file Intersection.h.

00431    {
00432       const float EPSILON = (DATA_TYPE)0.00001;
00433       Vec<DATA_TYPE, 3> edge1, edge2, tvec, pvec, qvec;
00434       float det,inv_det;
00435 
00436       /* find vectors for two edges sharing vert0 */
00437       edge1 = tri[1] - tri[0];
00438       edge2 = tri[2] - tri[0];
00439 
00440       /* begin calculating determinant - also used to calculate U parameter */
00441       gmtl::cross( pvec, ray.getDir(), edge2 );
00442 
00443       /* if determinant is near zero, ray lies in plane of triangle */
00444       det = gmtl::dot( edge1, pvec );
00445 
00446       if (det < EPSILON)
00447          return false;
00448 
00449       /* calculate distance from vert0 to ray origin */
00450       tvec = ray.getOrigin() - tri[0];
00451 
00452       /* calculate U parameter and test bounds */
00453       u = gmtl::dot( tvec, pvec );
00454       if (u < 0.0 || u > det)
00455          return false;
00456 
00457       /* prepare to test V parameter */
00458       gmtl::cross( qvec, tvec, edge1 );
00459 
00460       /* calculate V parameter and test bounds */
00461       v = gmtl::dot( ray.getDir(), qvec );
00462       if (v < 0.0 || u + v > det)
00463          return false;
00464 
00465       /* calculate t, scale parameters, ray intersects triangle */
00466       t = gmtl::dot( edge2, qvec );
00467       inv_det = ((DATA_TYPE)1.0) / det;
00468       t *= inv_det;
00469       u *= inv_det;
00470       v *= inv_det;
00471       
00472       // test if t is within the ray boundary (when t >= 0)
00473       return t >= (DATA_TYPE)0;
00474    }

template<class DATA_TYPE>
bool intersect const Plane< DATA_TYPE > &    plane,
const Ray< DATA_TYPE > &    ray,
DATA_TYPE &    t
 

Tests if the given plane and ray intersect with each other.

Parameters:
ray  - the Ray
plane  - the Plane
t  - an indicator of intersection position
Postcondition:
t gives you the intersection point: isect_point = ray.origin + ray.dir * t
Returns:
true if the ray intersects the plane, false otherwise

Definition at line 409 of file Intersection.h.

00410    {
00411       Vec<DATA_TYPE, 3> N( plane.getNormal() );
00412       t = dot( N, N * plane.getOffset() - ray.getOrigin() ) / dot( N, ray.getDir() );
00413       return (DATA_TYPE)0 <= t && t <= (DATA_TYPE)1.0; 
00414    }

template<typename T>
bool intersect const Sphere< T > &    sphere,
const LineSeg< T > &    lineseg,
int &    numhits,
float &    t0,
float &    t1
[inline]
 

Definition at line 376 of file Intersection.h.

00377    {
00378       if (intersect( sphere, Ray<T>( lineseg ), numhits, t0, t1 ))
00379       {
00380          // throw out hits that are past 1 in segspace (off the end of the lineseg)
00381          while (0 < numhits && 1.0f < t0) 
00382          {
00383             --numhits;
00384             t0 = t1;
00385          }
00386          if (2 == numhits && 1.0f < t1)
00387          {
00388             --numhits;
00389          }
00390          return 0 < numhits;
00391       }
00392       else
00393       {
00394          return false;
00395       }
00396    }

template<typename T>
bool intersect const Sphere< T > &    sphere,
const Ray< T > &    ray,
int &    numhits,
float &    t0,
float &    t1
[inline]
 

intersect ray/sphere.

note: after calling this, you can find the intersection point with: ray.getOrigin() + ray.getDir() * t

Parameters:
ray  the ray to test
sphere  the sphere to test
Returns:
returns intersection point in t, and the number of hits numhits, t0, t1 are undefined if return value is false

Definition at line 311 of file Intersection.h.

00312    {
00313       numhits = -1;
00314 
00315       // set up quadratic Q(t) = a*t^2 + 2*b*t + c
00316       Vec<T, 3> offset = ray.getOrigin() - sphere.getCenter();
00317       T a = lengthSquared( ray.getDir() );
00318       T b = dot( offset, ray.getDir() );
00319       T c = lengthSquared( offset ) - sphere.getRadius() * sphere.getRadius();
00320 
00321       // no intersection if Q(t) has no real roots
00322       T discriminant = b * b - a * c;
00323       if (discriminant < 0.0f)
00324       {
00325          numhits = 0;
00326          return false;
00327       }
00328       else if (discriminant > 0.0f)
00329       {
00330          T root = Math::sqrt( discriminant );
00331          T invA = T(1) / a;
00332          t0 = (-b - root) * invA;
00333          t1 = (-b + root) * invA;
00334 
00335          // assert: t0 < t1 since A > 0
00336 
00337          if (t0 >= T(0))
00338          {
00339             numhits = 2;
00340             return true;
00341          }
00342          else if (t1 >= 0.0f)
00343          {
00344             numhits = 1;
00345             t0 = t1;
00346             return true;
00347          }
00348          else
00349          {
00350             numhits = 0; 
00351             return false;
00352          }
00353       }
00354       else
00355       {
00356          t0 = -b / a;
00357          if (t0 >= T(0))
00358          {
00359             numhits = 1;
00360             return true;
00361          }
00362          else
00363          {
00364             numhits = 0;
00365             return false;
00366          }
00367       }
00368    }

template<class DATA_TYPE>
bool intersect const Sphere< DATA_TYPE > &    sphere,
const Point< DATA_TYPE, 3 > &    point
 

intersect point/sphere.

Parameters:
point  the point to test
sphere  the sphere to test
Returns:
true if point is in or on sphere

Definition at line 292 of file Intersection.h.

00293    {
00294       gmtl::Vec<DATA_TYPE, 3> offset = point - sphere.getCenter();
00295       DATA_TYPE dist = lengthSquared( offset ) - sphere.getRadius() * sphere.getRadius();
00296       
00297       // point is inside the sphere when true
00298       return  dist <= 0;
00299    }

template<class DATA_TYPE>
bool intersect const Sphere< DATA_TYPE > &    sph,
const AABox< DATA_TYPE > &    box
 

Tests if the given AABox and Sphere intersect with each other.

On an edge IS considered intersection by this algorithm.

Parameters:
sph  the sphere to test
box  the box to test
Returns:
true if the items intersect; false otherwise

Definition at line 280 of file Intersection.h.

00281    {
00282       return intersect(box, sph);
00283    }

template<class DATA_TYPE>
bool intersect const AABox< DATA_TYPE > &    box,
const Sphere< DATA_TYPE > &    sph
 

Tests if the given AABox and Sphere intersect with each other.

On an edge IS considered intersection by this algorithm.

Parameters:
box  the box to test
sph  the sphere to test
Returns:
true if the items intersect; false otherwise

Definition at line 248 of file Intersection.h.

00249    {
00250       DATA_TYPE dist_sqr = DATA_TYPE(0);
00251 
00252       // Compute the square of the distance from the sphere to the box
00253       for (int i=0; i<3; ++i)
00254       {
00255          if (sph.getCenter()[i] < box.getMin()[i])
00256          {
00257             DATA_TYPE s = sph.getCenter()[i] - box.getMin()[i];
00258             dist_sqr += s*s;
00259          }
00260          else if (sph.getCenter()[i] > box.getMax()[i])
00261          {
00262             DATA_TYPE s = sph.getCenter()[i] - box.getMax()[i];
00263             dist_sqr += s*s;
00264          }
00265       }
00266 
00267       return dist_sqr <= (sph.getRadius()*sph.getRadius());
00268    }

template<class DATA_TYPE>
bool intersect const Sphere< DATA_TYPE > &    sph1,
const Vec< DATA_TYPE, 3 > &    path1,
const Sphere< DATA_TYPE > &    sph2,
const Vec< DATA_TYPE, 3 > &    path2,
DATA_TYPE &    firstContact,
DATA_TYPE &    secondContact
 

Tests if the given Spheres intersect if moved along the given paths.

Using the Sphere sweep test, the normalized time of the first and last points of contact are found.

Parameters:
sph1  the first sphere to test
path1  the path the first sphere should travel along
sph2  the second sphere to test
path2  the path the second sphere should travel along
firstContact  set to the normalized time of the first point of contact
secondContact  set to the normalized time of the second point of contact
Returns:
true if the spheres intersect; false otherwise

Definition at line 190 of file Intersection.h.

00193    {
00194       // Algorithm taken from Gamasutra's article, "Simple Intersection Test for
00195       // Games" - http://www.gamasutra.com/features/19991018/Gomez_2.htm
00196       //
00197       // This algorithm is solved from the frame of reference of sph1
00198 
00199       // Get the relative path (in normalized time)
00200       const Vec<DATA_TYPE, 3> path = path2 - path1;
00201 
00202       // Get the vector from sph1's starting point to sph2's starting point
00203       const Vec<DATA_TYPE, 3> start_offset = sph2.getCenter() - sph1.getCenter();
00204 
00205       // Compute the sum of the radii
00206       const DATA_TYPE radius_sum = sph1.getRadius() + sph2.getRadius();
00207 
00208       // u*u coefficient
00209       const DATA_TYPE a = dot(path, path);
00210 
00211       // u coefficient
00212       const DATA_TYPE b = DATA_TYPE(2) * dot(path, start_offset);
00213 
00214       // constant term
00215       const DATA_TYPE c = dot(start_offset, start_offset) - radius_sum * radius_sum;
00216 
00217       // Check if they're already overlapping
00218       if (dot(start_offset, start_offset) <= radius_sum * radius_sum)
00219       {
00220          firstContact = secondContact = DATA_TYPE(0);
00221          return true;
00222       }
00223 
00224       // Find the first and last points of intersection
00225       if (Math::quadraticFormula(firstContact, secondContact, a, b, c))
00226       {
00227          // Swap first and second contacts if necessary
00228          if (firstContact > secondContact)
00229          {
00230             std::swap(firstContact, secondContact);
00231             return true;
00232          }
00233       }
00234 
00235       return false;
00236    }

template<class DATA_TYPE>
bool intersect const AABox< DATA_TYPE > &    box1,
const Vec< DATA_TYPE, 3 > &    path1,
const AABox< DATA_TYPE > &    box2,
const Vec< DATA_TYPE, 3 > &    path2,
DATA_TYPE &    firstContact,
DATA_TYPE &    secondContact
 

Tests if the given AABoxes intersect if moved along the given paths.

Using the AABox sweep test, the normalized time of the first and last points of contact are found.

Parameters:
box1  the first box to test
path1  the path the first box should travel along
box2  the second box to test
path2  the path the second box should travel along
firstContact  set to the normalized time of the first point of contact
secondContact  set to the normalized time of the second point of contact
Returns:
true if the boxes intersect at any time; false otherwise

Definition at line 117 of file Intersection.h.

00120    {
00121       // Algorithm taken from Gamasutra's article, "Simple Intersection Test for
00122       // Games" - http://www.gamasutra.com/features/19991018/Gomez_3.htm
00123       //
00124       // This algorithm is solved from the frame of reference of box1
00125 
00126       // Get the relative path (in normalized time)
00127       Vec<DATA_TYPE, 3> path = path2 - path1;
00128 
00129       // The first time of overlap along each axis
00130       Vec<DATA_TYPE, 3> overlap1(DATA_TYPE(0), DATA_TYPE(0), DATA_TYPE(0));
00131 
00132       // The second time of overlap along each axis
00133       Vec<DATA_TYPE, 3> overlap2(DATA_TYPE(1), DATA_TYPE(1), DATA_TYPE(1));
00134 
00135       // Check if the boxes already overlap
00136       if (intersect(box1, box2))
00137       {
00138          firstContact = secondContact = DATA_TYPE(0);
00139          return true;
00140       }
00141 
00142       // Find the possible first and last times of overlap along each axis
00143       for (int i=0; i<3; ++i)
00144       {
00145          if ((box1.getMax()[i] < box2.getMin()[i]) && (path[i] < DATA_TYPE(0)))
00146          {
00147             overlap1[i] = (box1.getMax()[i] - box2.getMin()[i]) / path[i];
00148          }
00149          else if ((box2.getMax()[i] < box1.getMin()[i]) && (path[i] > DATA_TYPE(0)))
00150          {
00151             overlap1[i] = (box1.getMin()[i] - box2.getMax()[i]) / path[i];
00152          }
00153 
00154          if ((box2.getMax()[i] > box1.getMin()[i]) && (path[i] < DATA_TYPE(0)))
00155          {
00156             overlap2[i] = (box1.getMin()[i] - box2.getMax()[i]) / path[i];
00157          }
00158          else if ((box1.getMax()[i] > box2.getMin()[i]) && (path[i] > DATA_TYPE(0)))
00159          {
00160             overlap2[i] = (box1.getMax()[i] - box2.getMin()[i]) / path[i];
00161          }
00162       }
00163 
00164       // Calculate the first time of overlap
00165       firstContact = Math::Max(overlap1[0], overlap1[1], overlap1[2]);
00166 
00167       // Calculate the second time of overlap
00168       secondContact = Math::Min(overlap2[0], overlap2[1], overlap2[2]);
00169 
00170       // There could only have been a collision if the first overlap time
00171       // occurred before the second overlap time
00172       return firstContact <= secondContact;
00173    }

template<class DATA_TYPE>
bool intersect const AABox< DATA_TYPE > &    box,
const Point< DATA_TYPE, 3 > &    point
 

Tests if the given AABox and point intersect with each other.

On an edge IS considered intersection by this algorithm.

Parameters:
box  the box to test
point  the point to test
Returns:
true if the point is within the box's bounds; false otherwise

Definition at line 87 of file Intersection.h.

00088    {
00089       // Look for a separating axis on each box for each axis
00090       if (box.getMin()[0] > point[0])  return false;
00091       if (box.getMin()[1] > point[1])  return false;
00092       if (box.getMin()[2] > point[2])  return false;
00093 
00094       if (point[0] > box.getMax()[0])  return false;
00095       if (point[1] > box.getMax()[1])  return false;
00096       if (point[2] > box.getMax()[2])  return false;
00097 
00098       // they must intersect
00099       return true;
00100    }

template<class DATA_TYPE>
bool intersect const AABox< DATA_TYPE > &    box1,
const AABox< DATA_TYPE > &    box2
 

Tests if the given AABoxes intersect with each other.

Sharing an edge IS considered intersection by this algorithm.

Parameters:
box1  the first AA box to test
box2  the second AA box to test
Returns:
true if the boxes intersect; false otherwise

Definition at line 62 of file Intersection.h.

00063    {
00064       // Look for a separating axis on each box for each axis
00065       if (box1.getMin()[0] > box2.getMax()[0])  return false;
00066       if (box1.getMin()[1] > box2.getMax()[1])  return false;
00067       if (box1.getMin()[2] > box2.getMax()[2])  return false;
00068 
00069       if (box2.getMin()[0] > box1.getMax()[0])  return false;
00070       if (box2.getMin()[1] > box1.getMax()[1])  return false;
00071       if (box2.getMin()[2] > box1.getMax()[2])  return false;
00072 
00073       // No separating axis ... they must intersect
00074       return true;
00075    }

template<class DATA_TYPE>
bool isEqual const LineSeg< DATA_TYPE > &    ls1,
const LineSeg< DATA_TYPE > &    ls2,
const DATA_TYPE &    eps
[inline]
 

Compare two line segments to see if the are the same within the given tolerance.

Parameters:
ls1  the first lineseg to compare
ls2  the second lineseg to compare
eps  the tolerance value to use
Precondition:
eps must be >= 0
Returns:
true if they are equal within the tolerance, false otherwise

Definition at line 132 of file LineSegOps.h.

00135 {
00136    gmtlASSERT( eps >= 0 );
00137    return ( (isEqual(ls1.mOrigin, ls2.mOrigin, eps)) &&
00138             (isEqual(ls1.mDir, ls2.mDir, eps)) );
00139 }

template<class DATA_TYPE>
bool isInVolume const AABox< DATA_TYPE > &    container,
const AABox< DATA_TYPE > &    box
 

Tests if the given AABox is completely inside or on the surface of the given AABox container.

Parameters:
container  the AABox acting as the container
box  the AABox that may be inside container
Returns:
true if AABox is inside container, false otherwise

Definition at line 360 of file Containment.h.

00362 {
00363    // Empty boxes don't overlap
00364    if (container.isEmpty() || box.isEmpty())
00365    {
00366       return false;
00367    }
00368 
00369    // Test that the boxes are not overlapping on any axis
00370    if (container.mMax[0] < box.mMin[0] || container.mMin[0] > box.mMax[0] ||
00371        container.mMax[1] < box.mMin[1] || container.mMin[1] > box.mMax[1] ||
00372        container.mMax[2] < box.mMin[2] || container.mMin[2] > box.mMax[2])
00373    {
00374       return false;
00375    }
00376    else
00377    {
00378       return true;
00379    }
00380 }

template<class DATA_TYPE>
bool isInVolume const AABox< DATA_TYPE > &    container,
const Point< DATA_TYPE, 3 > &    pt
 

Tests if the given point is inside or on the surface of the given AABox volume.

Parameters:
container  the AABox to test against
pt  the point to test with
Returns:
true if pt is inside container, false otherwise

Definition at line 332 of file Containment.h.

00334 {
00335    if (! container.isEmpty())
00336    {
00337       return ( pt[0] >= container.mMin[0] &&
00338                pt[1] >= container.mMin[1] &&
00339                pt[2] >= container.mMin[2] &&
00340                pt[0] <= container.mMax[0] &&
00341                pt[1] <= container.mMax[1] &&
00342                pt[2] <= container.mMax[2]);
00343    }
00344    else
00345    {
00346       return false;
00347    }
00348 }

template<class DATA_TYPE>
bool isInVolume const Sphere< DATA_TYPE > &    container,
const Sphere< DATA_TYPE > &    sphere
 

Tests if the given sphere is completely inside or on the surface of the given spherical volume.

Parameters:
container  the sphere acting as the container
sphere  the sphere that may be inside container
Returns:
true if sphere is inside container, false otherwise

Definition at line 88 of file Containment.h.

00090 {
00091    // the sphere is inside container if the distance between the centers of the
00092    // spheres plus the radius of the inner sphere is less than or equal to the
00093    // radius of the containing sphere.
00094    // |sphere.center - container.center| + sphere.radius <= container.radius
00095    return ( length(sphere.mCenter - container.mCenter) + sphere.mRadius
00096             <= container.mRadius );
00097 }

template<class DATA_TYPE>
bool isInVolume const Sphere< DATA_TYPE > &    container,
const Point< DATA_TYPE, 3 > &    pt
 

Tests if the given point is inside or on the surface of the given spherical volume.

Parameters:
container  the sphere to test against
pt  the point to test with
Returns:
true if pt is inside container, false otherwise

Definition at line 68 of file Containment.h.

00070 {
00071    // The point is inside the sphere if the vector computed from the center of
00072    // the sphere to the point has a magnitude less than or equal to the radius
00073    // of the sphere.
00074    // |pt - center| <= radius
00075    return ( length(pt - container.mCenter) <= container.mRadius );
00076 }

template<class DATA_TYPE>
bool isOnVolume const Sphere< DATA_TYPE > &    container,
const Point< DATA_TYPE, 3 > &    pt,
const DATA_TYPE &    tol
 

Tests of the given point is on the surface of the container with the given tolerance.

Parameters:
container  the container to test against
pt  the test point
tol  the epsilon tolerance
Returns:
true if pt is on the surface of container, false otherwise

Definition at line 307 of file Containment.h.

00310 {
00311    gmtlASSERT( tol >= 0 && "tolerance must be positive" );
00312 
00313    // abs( |center-pt| - radius ) < tol
00314    return ( Math::abs( length(container.mCenter - pt) - container.mRadius )
00315             <= tol );
00316 }

template<class DATA_TYPE>
bool isOnVolume const Sphere< DATA_TYPE > &    container,
const Point< DATA_TYPE, 3 > &    pt
 

Tests if the given point is on the surface of the container with zero tolerance.

Parameters:
container  the container to test against
pt  the test point
Returns:
true if pt is on the surface of container, false otherwise

Definition at line 289 of file Containment.h.

00291 {
00292    // |center - pt| - radius == 0
00293    return ( length(container.mCenter - pt) - container.mRadius == 0 );
00294 }

template<class DATA_TYPE>
void makeVolume AABox< DATA_TYPE > &    box,
const Sphere< DATA_TYPE > &    sph
 

Creates an AABox that tightly encloses the given Sphere.

Parameters:
box  set to the box

Definition at line 466 of file Containment.h.

00467 {
00468    const gmtl::Point<DATA_TYPE, 3>& center = sph.getCenter();
00469    const DATA_TYPE& radius = sph.getRadius();
00470 
00471    // Calculate the min and max points for the box
00472    gmtl::Point<DATA_TYPE, 3> min_pt(center[0] - radius,
00473                                     center[1] - radius,
00474                                     center[2] - radius);
00475    gmtl::Point<DATA_TYPE, 3> max_pt(center[0] + radius,
00476                                     center[1] + radius,
00477                                     center[2] + radius);
00478 
00479    box.setMin(min_pt);
00480    box.setMax(max_pt);
00481    box.setEmpty(radius == DATA_TYPE(0));
00482 }

template<class DATA_TYPE>
void makeVolume Sphere< DATA_TYPE > &    container,
const std::vector< Point< DATA_TYPE, 3 > > &    pts
 

Modifies the given sphere to tightly enclose all points in the given std::vector.

This operation is O(n) and uses sqrt(..) liberally. :(

Parameters:
container  [out] the sphere that will be modified to tightly enclose all the points in pts
pts  [in] the list of points to contain
Precondition:
pts must contain at least 2 points

Definition at line 177 of file Containment.h.

00179 {
00180    gmtlASSERT( pts.size() > 0  && "pts must contain at least 1 point" );
00181 
00182    // Implementation based on the Sphere Centered at Average of Points algorithm
00183    // found in "3D Game Engine Design" by Devud G, Eberly (pg. 27)
00184    typename std::vector< Point<DATA_TYPE, 3> >::const_iterator itr = pts.begin();
00185 
00186    // compute the average of the points as the center
00187    Point<DATA_TYPE, 3> sum = *itr;
00188    ++itr;
00189    while ( itr != pts.end() )
00190    {
00191       sum += *itr;
00192       ++itr;
00193    }
00194    container.mCenter = sum / pts.size();
00195 
00196    // compute the distance from the computed center to point furthest from that
00197    // center as the radius
00198    DATA_TYPE radiusSqr(0);
00199    for ( itr = pts.begin(); itr != pts.end(); ++itr )
00200    {
00201       float len = lengthSquared( *itr - container.mCenter );
00202       if ( len > radiusSqr )
00203          radiusSqr = len;
00204    }
00205 
00206    container.mRadius = Math::sqrt( radiusSqr );
00207 }

template<class DATA_TYPE>
bool operator!= const LineSeg< DATA_TYPE > &    ls1,
const LineSeg< DATA_TYPE > &    ls2
[inline]
 

Compare two line segments to see if they are not EXACTLY the same.

Parameters:
ls1  the first lineseg to compare
ls2  the second lineseg to compare
Returns:
true if they are not equal, false otherwise

Definition at line 113 of file LineSegOps.h.

00115 {
00116    return ( ! (ls1 == ls2) );
00117 }

template<class DATA_TYPE>
bool operator== const LineSeg< DATA_TYPE > &    ls1,
const LineSeg< DATA_TYPE > &    ls2
[inline]
 

Compare two line segments to see if they are EXACTLY the same.

Parameters:
ls1  the first lineseg to compare
ls2  the second lineseg to compare
Returns:
true if they are equal, false otherwise

Definition at line 99 of file LineSegOps.h.

00100 {
00101    return ( (ls1.mOrigin == ls2.mOrigin) && (ls1.mDir == ls2.mDir) );
00102 }

const Quat<double> QUAT_ADD_IDENTITYD 0.    0,
0.    0,
0.    0,
0.    0
 

const Quat<float> QUAT_ADD_IDENTITYF 0.    0f,
0.    0f,
0.    0f,
0.    0f
 

const Quat<double> QUAT_IDENTITYD QUAT_MULT_IDENTITYD   
 

const Quat<float> QUAT_IDENTITYF QUAT_MULT_IDENTITYF   
 

const Quat<double> QUAT_MULT_IDENTITYD 0.    0,
0.    0,
0.    0,
1.    0
 

const Quat<float> QUAT_MULT_IDENTITYF 0.    0f,
0.    0f,
0.    0f,
1.    0f
 

osg::Matrix& set osg::Matrix &    osg_mat,
const Matrix44f   mat
[inline]
 

Convert a GMTL matrix to a OpenSG matrix.

Parameters:
osg_mat  the matrix to write the GMTL matrix data into
mat  the source GMTL matrix
Returns:
returns the equivalent OpenSG matrix

Definition at line 34 of file OpenSGConvert.h.

00035 {
00036    osg_mat.setValue( mat.getData() );
00037    return osg_mat;
00038 }

Matrix44f& set Matrix44f   mat,
const osg::Matrix &    osg_mat
[inline]
 

Convert an opensg matrix to a gmtl::Matrix.

Parameters:
mat  the matrix to write the OpenSG matrix data into
osg_mat  the source OpenSG matrix
Returns:
returns the equivalent GMTL matrix

Definition at line 22 of file OpenSGConvert.h.

00023 {
00024    mat.set(osg_mat.getValues());
00025    return mat;
00026 }


Variable Documentation

const Matrix22d gmtl::MAT_IDENTITY22D = Matrix22d()
 

64bit floating point 2x2 identity matrix.

Definition at line 383 of file Matrix.h.

const Matrix22f gmtl::MAT_IDENTITY22F = Matrix22f()
 

32bit floating point 2x2 identity matrix.

Definition at line 380 of file Matrix.h.

const Matrix23d gmtl::MAT_IDENTITY23D = Matrix23d()
 

64bit floating point 2x2 identity matrix.

Definition at line 389 of file Matrix.h.

const Matrix23f gmtl::MAT_IDENTITY23F = Matrix23f()
 

32bit floating point 2x2 identity matrix.

Definition at line 386 of file Matrix.h.

const Matrix33d gmtl::MAT_IDENTITY33D = Matrix33d()
 

64bit floating point 3x3 identity matrix.

Definition at line 395 of file Matrix.h.

const Matrix33f gmtl::MAT_IDENTITY33F = Matrix33f()
 

32bit floating point 3x3 identity matrix.

Definition at line 392 of file Matrix.h.

const Matrix34d gmtl::MAT_IDENTITY34D = Matrix34d()
 

64bit floating point 3x4 identity matrix.

Definition at line 401 of file Matrix.h.

const Matrix34f gmtl::MAT_IDENTITY34F = Matrix34f()
 

32bit floating point 3x4 identity matrix.

Definition at line 398 of file Matrix.h.

const Matrix44d gmtl::MAT_IDENTITY44D = Matrix44d()
 

64bit floating point 4x4 identity matrix.

Definition at line 407 of file Matrix.h.

const Matrix44f gmtl::MAT_IDENTITY44F = Matrix44f()
 

32bit floating point 4x4 identity matrix.

Definition at line 404 of file Matrix.h.


Generated on Mon Apr 7 15:29:26 2003 for GenericMathTemplateLibrary by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002