HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_QuaternionT< T > Class Template Reference

Quaternion class. More...

#include <UT_Quaternion.h>

Public Types

typedef T value_type
 

Public Member Functions

 UT_QuaternionT (T qx=0, T qy=0, T qz=0, T qw=0)
 
 UT_QuaternionT (const fpreal32 v[tuple_size])
 
 UT_QuaternionT (const fpreal64 v[tuple_size])
 
 UT_QuaternionT (const UT_Vector4T< T > &v)
 
template<typename S >
SYS_FORCE_INLINE UT_QuaternionT (const UT_FixedVector< S, tuple_size > &v)
 Arbitrary UT_FixedVector of the same size. More...
 
 UT_QuaternionT (T angle, const UT_Vector3T< T > &axis, int donormalize=1)
 
 UT_QuaternionT (const UT_QuaternionT< T > &q)
 
 UT_QuaternionT (const UT_Vector3T< T > &rot, const UT_XformOrder &order)
 
template<typename S >
 UT_QuaternionT (const UT_QuaternionT< S > &v)
 
template<typename S >
UT_QuaternionT< T > & operator= (const UT_QuaternionT< S > &v)
 
UT_QuaternionT< T > & operator*= (const UT_QuaternionT< T > &q)
 
UT_QuaternionT< T > & operator*= (T scalar)
 
UT_QuaternionT< T > & operator/= (const UT_QuaternionT< T > &quat)
 
UT_QuaternionT< T > & operator/= (T scalar)
 
UT_QuaternionT< T > & operator+= (const UT_QuaternionT< T > &quat)
 
bool operator== (const UT_QuaternionT< T > &quat) const
 
bool operator!= (const UT_QuaternionT< T > &quat) const
 
T operator() (int idx) const
 
Toperator() (int idx)
 
T operator[] (int idx) const
 
Toperator[] (int idx)
 
bool isEqual (const UT_QuaternionT< T > &quat, T tol=T(SYS_FTOLERANCE)) const
 
void getRotationMatrix (UT_Matrix3 &mat) const
 
void getRotationMatrix (UT_DMatrix3 &mat) const
 
void getInverseRotationMatrix (UT_Matrix3 &mat) const
 
void getInverseRotationMatrix (UT_DMatrix3 &mat) const
 
void getTransformMatrix (UT_Matrix4 &mat) const
 
void getTransformMatrix (UT_DMatrix4 &mat) const
 
UT_QuaternionT< Tinterpolate (const UT_QuaternionT< T > &target, T t, T b=0.0f) const
 Interpolates between this quat (t==0) and the target (t==1) More...
 
void interpolate (const UT_QuaternionT< T > *q, const T *w, exint n, T tol=T(1e-6))
 
void lerp (const UT_QuaternionT< T > &target, T t)
 Do component-wise lerp between this quat (t=0) and the target (t=1). More...
 
void lerp (const UT_QuaternionT< T > &src, const UT_QuaternionT< T > &dst, T t)
 Do component-wise lerp between this src (t=0) and dst (t=1). More...
 
void assign (T qx, T qy, T qz, T qw)
 
void identity ()
 
void conjugate ()
 
void negate ()
 
T normal () const
 
void normalize ()
 
T length () const
 
void invert ()
 
UT_QuaternionT< Texp () const
 
UT_QuaternionT< Tln () const
 
UT_QuaternionT< Tlog () const
 
void updateFromVectors (const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2)
 
void updateFromArbitraryMatrix (const UT_Matrix3 &)
 
void updateFromArbitraryMatrix (const UT_Matrix3D &)
 
void updateFromRotationMatrix (const UT_Matrix3 &)
 
void updateFromRotationMatrix (const UT_Matrix3D &)
 
void updateFromAngleAxis (T angle, const UT_Vector3T< T > &axis, int normalize=1)
 
void getAngleAxis (T &angle, UT_Vector3T< T > &axis) const
 
void updateFromLogMap (const UT_Vector3T< T > &v)
 
void getLogMap (UT_Vector3T< T > &v) const
 
void updateFromEuler (const UT_Vector3T< T > &rot, const UT_XformOrder &order)
 
void computeDerivative (const UT_Vector3T< T > &omega, UT_QuaternionT< T > &q_prime)
 
UT_Vector3T< TcomputeAngVel (const UT_QuaternionT< T > &dest, T time) const
 
void integrate (const UT_Vector3T< T > &angvel, T timestep, bool accurate=true)
 
UT_Vector3T< TcomputeRotations (const UT_XformOrder &) const
 
UT_Vector3T< Trotate (const UT_Vector3T< T > &) const
 
UT_Vector3T< TrotateInverse (const UT_Vector3T< T > &) const
 
void multAngle (T s)
 
Tx ()
 
Ty ()
 
Tz ()
 
Tw ()
 
T x () const
 
T y () const
 
T z () const
 
T w () const
 
void save (std::ostream &os, int binary=0) const
 
bool load (UT_IStream &is)
 
const Tdata (void) const
 
Tdata (void)
 
unsigned hash () const
 Compute a hash. More...
 
bool save (UT_JSONWriter &w) const
 
bool save (UT_JSONValue &v) const
 
bool load (UT_JSONParser &p)
 

Static Public Member Functions

static int entries ()
 

Static Public Attributes

static const int tuple_size = 4
 

Protected Member Functions

void initialize (T qx=0, T qy=0, T qz=0, T qw=0)
 

Friends

std::ostream & operator<< (std::ostream &os, const UT_QuaternionT< T > &v)
 

Detailed Description

template<typename T>
class UT_QuaternionT< T >

Quaternion class.

Definition at line 44 of file UT_Quaternion.h.

Member Typedef Documentation

template<typename T>
typedef T UT_QuaternionT< T >::value_type

Definition at line 48 of file UT_Quaternion.h.

Constructor & Destructor Documentation

template<typename T>
UT_QuaternionT< T >::UT_QuaternionT ( T  qx = 0,
T  qy = 0,
T  qz = 0,
T  qw = 0 
)
inline

Definition at line 51 of file UT_Quaternion.h.

template<typename T>
UT_QuaternionT< T >::UT_QuaternionT ( const fpreal32  v[tuple_size])
inline

Definition at line 57 of file UT_Quaternion.h.

template<typename T>
UT_QuaternionT< T >::UT_QuaternionT ( const fpreal64  v[tuple_size])
inline

Definition at line 62 of file UT_Quaternion.h.

template<typename T>
UT_QuaternionT< T >::UT_QuaternionT ( const UT_Vector4T< T > &  v)
inline

Definition at line 67 of file UT_Quaternion.h.

template<typename T>
template<typename S >
SYS_FORCE_INLINE UT_QuaternionT< T >::UT_QuaternionT ( const UT_FixedVector< S, tuple_size > &  v)
inlineexplicit

Arbitrary UT_FixedVector of the same size.

Definition at line 74 of file UT_Quaternion.h.

template<typename T>
UT_QuaternionT< T >::UT_QuaternionT ( T  angle,
const UT_Vector3T< T > &  axis,
int  donormalize = 1 
)
template<typename T>
UT_QuaternionT< T >::UT_QuaternionT ( const UT_QuaternionT< T > &  q)
inline

Definition at line 82 of file UT_Quaternion.h.

template<typename T>
UT_QuaternionT< T >::UT_QuaternionT ( const UT_Vector3T< T > &  rot,
const UT_XformOrder order 
)
inline

Definition at line 89 of file UT_Quaternion.h.

template<typename T>
template<typename S >
UT_QuaternionT< T >::UT_QuaternionT ( const UT_QuaternionT< S > &  v)
inline

Definition at line 97 of file UT_Quaternion.h.

Member Function Documentation

template<typename T>
void UT_QuaternionT< T >::assign ( T  qx,
T  qy,
T  qz,
T  qw 
)
inline

Definition at line 160 of file UT_Quaternion.h.

template<typename T>
UT_Vector3T<T> UT_QuaternionT< T >::computeAngVel ( const UT_QuaternionT< T > &  dest,
T  time 
) const
template<typename T>
void UT_QuaternionT< T >::computeDerivative ( const UT_Vector3T< T > &  omega,
UT_QuaternionT< T > &  q_prime 
)
template<typename T>
UT_Vector3T<T> UT_QuaternionT< T >::computeRotations ( const UT_XformOrder ) const
template<typename T>
void UT_QuaternionT< T >::conjugate ( )
inline

Definition at line 171 of file UT_Quaternion.h.

template<typename T>
const T* UT_QuaternionT< T >::data ( void  ) const
inline

Definition at line 317 of file UT_Quaternion.h.

template<typename T>
T* UT_QuaternionT< T >::data ( void  )
inline

Definition at line 318 of file UT_Quaternion.h.

template<typename T>
static int UT_QuaternionT< T >::entries ( void  )
inlinestatic

Definition at line 320 of file UT_Quaternion.h.

template<typename T>
UT_QuaternionT<T> UT_QuaternionT< T >::exp ( ) const
template<typename T>
void UT_QuaternionT< T >::getAngleAxis ( T angle,
UT_Vector3T< T > &  axis 
) const
template<typename T>
void UT_QuaternionT< T >::getInverseRotationMatrix ( UT_Matrix3 mat) const
template<typename T>
void UT_QuaternionT< T >::getInverseRotationMatrix ( UT_DMatrix3 mat) const
template<typename T>
void UT_QuaternionT< T >::getLogMap ( UT_Vector3T< T > &  v) const
template<typename T>
void UT_QuaternionT< T >::getRotationMatrix ( UT_Matrix3 mat) const
template<typename T>
void UT_QuaternionT< T >::getRotationMatrix ( UT_DMatrix3 mat) const
template<typename T>
void UT_QuaternionT< T >::getTransformMatrix ( UT_Matrix4 mat) const
template<typename T>
void UT_QuaternionT< T >::getTransformMatrix ( UT_DMatrix4 mat) const
template<typename T>
unsigned UT_QuaternionT< T >::hash ( ) const
inline

Compute a hash.

Definition at line 323 of file UT_Quaternion.h.

template<typename T>
void UT_QuaternionT< T >::identity ( )
inline

Definition at line 166 of file UT_Quaternion.h.

template<typename T>
void UT_QuaternionT< T >::initialize ( T  qx = 0,
T  qy = 0,
T  qz = 0,
T  qw = 0 
)
inlineprotected

Definition at line 326 of file UT_Quaternion.h.

template<typename T>
void UT_QuaternionT< T >::integrate ( const UT_Vector3T< T > &  angvel,
T  timestep,
bool  accurate = true 
)
template<typename T>
UT_QuaternionT<T> UT_QuaternionT< T >::interpolate ( const UT_QuaternionT< T > &  target,
T  t,
T  b = 0.0f 
) const

Interpolates between this quat (t==0) and the target (t==1)

template<typename T>
void UT_QuaternionT< T >::interpolate ( const UT_QuaternionT< T > *  q,
const T w,
exint  n,
T  tol = T(1e-6) 
)

Interpolates between the n quaternions in q, with weights w, to within tolerance tol. NOTE: The q's must be normalized, and the weights may need to sum to 1.

template<typename T>
void UT_QuaternionT< T >::invert ( )
inline

Definition at line 205 of file UT_Quaternion.h.

template<typename T>
bool UT_QuaternionT< T >::isEqual ( const UT_QuaternionT< T > &  quat,
T  tol = T(SYS_FTOLERANCE) 
) const

Does a comparison with a tolerance. This also returns true if quat.negated() is equal to us, unlike operator==().

template<typename T>
T UT_QuaternionT< T >::length ( void  ) const
inline

Definition at line 201 of file UT_Quaternion.h.

template<typename T>
void UT_QuaternionT< T >::lerp ( const UT_QuaternionT< T > &  target,
T  t 
)
inline

Do component-wise lerp between this quat (t=0) and the target (t=1).

Definition at line 142 of file UT_Quaternion.h.

template<typename T>
void UT_QuaternionT< T >::lerp ( const UT_QuaternionT< T > &  src,
const UT_QuaternionT< T > &  dst,
T  t 
)
inline

Do component-wise lerp between this src (t=0) and dst (t=1).

Definition at line 150 of file UT_Quaternion.h.

template<typename T>
UT_QuaternionT<T> UT_QuaternionT< T >::ln ( ) const
template<typename T>
bool UT_QuaternionT< T >::load ( UT_IStream is)
template<typename T>
bool UT_QuaternionT< T >::load ( UT_JSONParser p)

Methods to serialize to a JSON stream. The vector is stored as an array of 4 reals.

template<typename T>
UT_QuaternionT<T> UT_QuaternionT< T >::log ( ) const
inline

Definition at line 221 of file UT_Quaternion.h.

template<typename T>
void UT_QuaternionT< T >::multAngle ( T  s)
template<typename T>
void UT_QuaternionT< T >::negate ( )
inline

Definition at line 177 of file UT_Quaternion.h.

template<typename T>
T UT_QuaternionT< T >::normal ( ) const
inline

Definition at line 184 of file UT_Quaternion.h.

template<typename T>
void UT_QuaternionT< T >::normalize ( )
inline

Definition at line 191 of file UT_Quaternion.h.

template<typename T>
bool UT_QuaternionT< T >::operator!= ( const UT_QuaternionT< T > &  quat) const
template<typename T>
T UT_QuaternionT< T >::operator() ( int  idx) const
inline

Definition at line 110 of file UT_Quaternion.h.

template<typename T>
T& UT_QuaternionT< T >::operator() ( int  idx)
inline

Definition at line 112 of file UT_Quaternion.h.

template<typename T>
UT_QuaternionT< T > & UT_QuaternionT< T >::operator*= ( const UT_QuaternionT< T > &  q)
inline

Definition at line 420 of file UT_Quaternion.h.

template<typename T>
UT_QuaternionT< T > & UT_QuaternionT< T >::operator*= ( T  scalar)
inline

Definition at line 438 of file UT_Quaternion.h.

template<typename T>
UT_QuaternionT< T > & UT_QuaternionT< T >::operator+= ( const UT_QuaternionT< T > &  quat)
inline

Definition at line 368 of file UT_Quaternion.h.

template<typename T>
UT_QuaternionT< T > & UT_QuaternionT< T >::operator/= ( const UT_QuaternionT< T > &  quat)
inline

Definition at line 471 of file UT_Quaternion.h.

template<typename T>
UT_QuaternionT< T > & UT_QuaternionT< T >::operator/= ( T  scalar)
inline

Definition at line 483 of file UT_Quaternion.h.

template<typename T>
template<typename S >
UT_QuaternionT<T>& UT_QuaternionT< T >::operator= ( const UT_QuaternionT< S > &  v)
inline

Definition at line 100 of file UT_Quaternion.h.

template<typename T>
bool UT_QuaternionT< T >::operator== ( const UT_QuaternionT< T > &  quat) const
template<typename T>
T UT_QuaternionT< T >::operator[] ( int  idx) const
inline

Definition at line 114 of file UT_Quaternion.h.

template<typename T>
T& UT_QuaternionT< T >::operator[] ( int  idx)
inline

Definition at line 116 of file UT_Quaternion.h.

template<typename T>
UT_Vector3T<T> UT_QuaternionT< T >::rotate ( const UT_Vector3T< T > &  ) const

Rotates a vector by this quaternion Requires that this is normalized.

template<typename T>
UT_Vector3T<T> UT_QuaternionT< T >::rotateInverse ( const UT_Vector3T< T > &  ) const

rotates a vector by the inverse of this quaternion. Requires that this is normalized.

template<typename T>
void UT_QuaternionT< T >::save ( std::ostream &  os,
int  binary = 0 
) const
template<typename T>
bool UT_QuaternionT< T >::save ( UT_JSONWriter w) const

Methods to serialize to a JSON stream. The vector is stored as an array of 4 reals.

template<typename T>
bool UT_QuaternionT< T >::save ( UT_JSONValue v) const

Methods to serialize to a JSON stream. The vector is stored as an array of 4 reals.

template<typename T>
void UT_QuaternionT< T >::updateFromAngleAxis ( T  angle,
const UT_Vector3T< T > &  axis,
int  normalize = 1 
)
template<typename T>
void UT_QuaternionT< T >::updateFromArbitraryMatrix ( const UT_Matrix3 )

Form the quaternion from the rotation component of an arbitrary 3x3 matrix.

template<typename T>
void UT_QuaternionT< T >::updateFromArbitraryMatrix ( const UT_Matrix3D )
template<typename T>
void UT_QuaternionT< T >::updateFromEuler ( const UT_Vector3T< T > &  rot,
const UT_XformOrder order 
)
template<typename T>
void UT_QuaternionT< T >::updateFromLogMap ( const UT_Vector3T< T > &  v)
template<typename T>
void UT_QuaternionT< T >::updateFromRotationMatrix ( const UT_Matrix3 )

Form the quaternion from a rotation matrix WARNING: This will produce incorrect results if given a non-rotation matrix! Use updateFromArbitraryMatrix if you may have a non-rotation matrix.

template<typename T>
void UT_QuaternionT< T >::updateFromRotationMatrix ( const UT_Matrix3D )
template<typename T>
void UT_QuaternionT< T >::updateFromVectors ( const UT_Vector3T< T > &  v1,
const UT_Vector3T< T > &  v2 
)
template<typename T>
T& UT_QuaternionT< T >::w ( )
inline

Definition at line 299 of file UT_Quaternion.h.

template<typename T>
T UT_QuaternionT< T >::w ( ) const
inline

Definition at line 304 of file UT_Quaternion.h.

template<typename T>
T& UT_QuaternionT< T >::x ( )
inline

Definition at line 296 of file UT_Quaternion.h.

template<typename T>
T UT_QuaternionT< T >::x ( ) const
inline

Definition at line 301 of file UT_Quaternion.h.

template<typename T>
T& UT_QuaternionT< T >::y ( )
inline

Definition at line 297 of file UT_Quaternion.h.

template<typename T>
T UT_QuaternionT< T >::y ( ) const
inline

Definition at line 302 of file UT_Quaternion.h.

template<typename T>
T& UT_QuaternionT< T >::z ( )
inline

Definition at line 298 of file UT_Quaternion.h.

template<typename T>
T UT_QuaternionT< T >::z ( ) const
inline

Definition at line 303 of file UT_Quaternion.h.

Friends And Related Function Documentation

template<typename T>
std::ostream& operator<< ( std::ostream &  os,
const UT_QuaternionT< T > &  v 
)
friend

Definition at line 334 of file UT_Quaternion.h.

Member Data Documentation

template<typename T>
const int UT_QuaternionT< T >::tuple_size = 4
static

Definition at line 49 of file UT_Quaternion.h.


The documentation for this class was generated from the following file: