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

Quaternion class. More...

#include <GEO_Detail.h>

Public Types

typedef T value_type
 
typedef UT_QuaternionT< TThisType
 

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)
 
 UT_QuaternionT (T angle, const UT_Vector3T< T > &axis, int donormalize=1)
 
 UT_QuaternionT (const UT_Vector3T< T > &rot, const UT_XformOrder &order)
 
SYS_FORCE_INLINE UT_QuaternionT (const ThisType &that)=default
 
SYS_FORCE_INLINE UT_QuaternionT (ThisType &&that)=default
 
SYS_FORCE_INLINE ThisTypeoperator= (const ThisType &that)=default
 
SYS_FORCE_INLINE ThisTypeoperator= (ThisType &&that)=default
 
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)
 
void swingTwistDecompose (const UT_Vector3T< T > &axis, UT_QuaternionT< T > &swing, UT_QuaternionT< T > &twist, const bool reverse=false) const
 
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 () const
 
Tdata ()
 
T distance2 (const UT_QuaternionT< T > &b) const noexcept
 
T distance (const UT_QuaternionT< T > &b) const noexcept
 
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 constexpr 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 48 of file GEO_Detail.h.

Member Typedef Documentation

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

Definition at line 88 of file UT_Quaternion.h.

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

Definition at line 55 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 58 of file UT_Quaternion.h.

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

Definition at line 64 of file UT_Quaternion.h.

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

Definition at line 69 of file UT_Quaternion.h.

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

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 
)
inline

Definition at line 363 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 82 of file UT_Quaternion.h.

template<typename T>
SYS_FORCE_INLINE UT_QuaternionT< T >::UT_QuaternionT ( const ThisType that)
default
template<typename T>
SYS_FORCE_INLINE UT_QuaternionT< T >::UT_QuaternionT ( ThisType &&  that)
default
template<typename T>
template<typename S >
UT_QuaternionT< T >::UT_QuaternionT ( const UT_QuaternionT< S > &  v)
inline

Definition at line 96 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 159 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 170 of file UT_Quaternion.h.

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

Definition at line 324 of file UT_Quaternion.h.

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

Definition at line 325 of file UT_Quaternion.h.

template<typename T>
T UT_QuaternionT< T >::distance ( const UT_QuaternionT< T > &  b) const
inlinenoexcept

Definition at line 331 of file UT_Quaternion.h.

template<typename T>
T UT_QuaternionT< T >::distance2 ( const UT_QuaternionT< T > &  b) const
inlinenoexcept

Definition at line 327 of file UT_Quaternion.h.

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

Definition at line 336 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 ( void  ) const
inline

Compute a hash.

Definition at line 339 of file UT_Quaternion.h.

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

Definition at line 165 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 342 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 204 of file UT_Quaternion.h.

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

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

Definition at line 388 of file UT_Quaternion.h.

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

Definition at line 200 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 141 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 149 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 220 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 176 of file UT_Quaternion.h.

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

Definition at line 183 of file UT_Quaternion.h.

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

Definition at line 190 of file UT_Quaternion.h.

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

Definition at line 381 of file UT_Quaternion.h.

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

Definition at line 109 of file UT_Quaternion.h.

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

Definition at line 111 of file UT_Quaternion.h.

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

Definition at line 478 of file UT_Quaternion.h.

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

Definition at line 496 of file UT_Quaternion.h.

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

Definition at line 426 of file UT_Quaternion.h.

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

Definition at line 529 of file UT_Quaternion.h.

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

Definition at line 541 of file UT_Quaternion.h.

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

Definition at line 99 of file UT_Quaternion.h.

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

Definition at line 371 of file UT_Quaternion.h.

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

Definition at line 113 of file UT_Quaternion.h.

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

Definition at line 115 of file UT_Quaternion.h.

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

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

Definition at line 555 of file UT_Quaternion.h.

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

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

Definition at line 565 of file UT_Quaternion.h.

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 >::swingTwistDecompose ( const UT_Vector3T< T > &  axis,
UT_QuaternionT< T > &  swing,
UT_QuaternionT< T > &  twist,
const bool  reverse = false 
) const
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 306 of file UT_Quaternion.h.

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

Definition at line 311 of file UT_Quaternion.h.

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

Definition at line 303 of file UT_Quaternion.h.

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

Definition at line 308 of file UT_Quaternion.h.

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

Definition at line 304 of file UT_Quaternion.h.

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

Definition at line 309 of file UT_Quaternion.h.

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

Definition at line 305 of file UT_Quaternion.h.

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

Definition at line 310 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 350 of file UT_Quaternion.h.

Member Data Documentation

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

Definition at line 56 of file UT_Quaternion.h.


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