HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
openvdb::OPENVDB_VERSION_NAME::math::Quat< T > Class Template Reference

#include <Mat.h>

Public Types

using value_type = T
 
using ValueType = T
 

Public Member Functions

 Quat ()=default
 
 Quat (T x, T y, T z, T w)
 Constructor with four arguments, e.g. Quatf q(1,2,3,4);. More...
 
 Quat (T *a)
 Constructor with array argument, e.g. float a[4]; Quatf q(a);. More...
 
 Quat (const Vec3< T > &axis, T angle)
 
 Quat (math::Axis axis, T angle)
 Constructor given rotation as axis and angle. More...
 
template<typename T1 >
 Quat (const Mat3< T1 > &rot)
 Constructor given a rotation matrix. More...
 
T & x ()
 Reference to the component, e.g. q.x() = 4.5f;. More...
 
T & y ()
 
T & z ()
 
T & w ()
 
x () const
 Get the component, e.g. float f = q.w();. More...
 
y () const
 
z () const
 
w () const
 
T & operator[] (int i)
 Array style reference to the components, e.g. q[3] = 1.34f;. More...
 
operator[] (int i) const
 Array style constant reference to the components, e.g. float f = q[1];. More...
 
 operator T * ()
 Cast to T*. More...
 
 operator const T * () const
 
T & operator() (int i)
 Alternative indexed reference to the elements. More...
 
operator() (int i) const
 Alternative indexed constant reference to the elements,. More...
 
angle () const
 Return angle of rotation. More...
 
Vec3< T > axis () const
 Return axis of rotation. More...
 
Quatinit (T x, T y, T z, T w)
 "this" quaternion gets initialized to [x, y, z, w] More...
 
Quatinit ()
 "this" quaternion gets initialized to identity, same as setIdentity() More...
 
QuatsetAxisAngle (const Vec3< T > &axis, T angle)
 
QuatsetZero ()
 Set "this" vector to zero. More...
 
QuatsetIdentity ()
 Set "this" vector to identity. More...
 
Vec3< T > eulerAngles (RotationOrder rotationOrder) const
 Returns vector of x,y,z rotational components. More...
 
bool operator== (const Quat &q) const
 Equality operator, does exact floating point comparisons. More...
 
bool eq (const Quat &q, T eps=1.0e-7) const
 Test if "this" is equivalent to q with tolerance of eps value. More...
 
Quatoperator+= (const Quat &q)
 Add quaternion q to "this" quaternion, e.g. q += q1;. More...
 
Quatoperator-= (const Quat &q)
 Subtract quaternion q from "this" quaternion, e.g. q -= q1;. More...
 
Quatoperator*= (T scalar)
 Scale "this" quaternion by scalar, e.g. q *= scalar;. More...
 
Quat operator+ (const Quat &q) const
 Return (this+q), e.g. q = q1 + q2;. More...
 
Quat operator- (const Quat &q) const
 Return (this-q), e.g. q = q1 - q2;. More...
 
Quat operator* (const Quat &q) const
 Return (this*q), e.g. q = q1 * q2;. More...
 
Quat operator*= (const Quat &q)
 Assigns this to (this*q), e.g. q *= q1;. More...
 
Quat operator* (T scalar) const
 Return (this*scalar), e.g. q = q1 * scalar;. More...
 
Quat operator/ (T scalar) const
 Return (this/scalar), e.g. q = q1 / scalar;. More...
 
Quat operator- () const
 Negation operator, e.g. q = -q;. More...
 
Quatadd (const Quat &q1, const Quat &q2)
 
Quatsub (const Quat &q1, const Quat &q2)
 
Quatmult (const Quat &q1, const Quat &q2)
 
Quatscale (T scale, const Quat &q)
 
dot (const Quat &q) const
 Dot product. More...
 
Quat derivative (const Vec3< T > &omega) const
 
bool normalize (T eps=T(1.0e-8))
 this = normalized this More...
 
Quat unit () const
 this = normalized this More...
 
Quat inverse (T tolerance=T(0)) const
 returns inverse of this More...
 
Quat conjugate () const
 
Vec3< T > rotateVector (const Vec3< T > &v) const
 Return rotated vector by "this" quaternion. More...
 
std::string str () const
 
void write (std::ostream &os) const
 
void read (std::istream &is)
 

Static Public Member Functions

static unsigned numElements ()
 
static Quat zero ()
 Predefined constants, e.g. Quat q = Quat::identity();. More...
 
static Quat identity ()
 

Static Public Attributes

static const int size = 4
 

Protected Attributes

mm [4]
 

Friends

std::ostream & operator<< (std::ostream &stream, const Quat &q)
 Output to the stream, e.g. std::cout << q << std::endl;. More...
 
Quat slerp (const Quat &q1, const Quat &q2, T t, T tolerance)
 Linear interpolation between the two quaternions. More...
 

Detailed Description

template<typename T>
class openvdb::OPENVDB_VERSION_NAME::math::Quat< T >

Definition at line 164 of file Mat.h.

Member Typedef Documentation

template<typename T>
using openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::value_type = T

Definition at line 81 of file Quat.h.

template<typename T>
using openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::ValueType = T

Definition at line 82 of file Quat.h.

Constructor & Destructor Documentation

template<typename T>
openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::Quat ( )
default

Trivial constructor, the quaternion is NOT initialized

Note
destructor, copy constructor, assignment operator and move constructor are left to be defined by the compiler (default)
template<typename T>
openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::Quat ( x,
y,
z,
w 
)
inline

Constructor with four arguments, e.g. Quatf q(1,2,3,4);.

Definition at line 91 of file Quat.h.

template<typename T>
openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::Quat ( T *  a)
inline

Constructor with array argument, e.g. float a[4]; Quatf q(a);.

Definition at line 101 of file Quat.h.

template<typename T>
openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::Quat ( const Vec3< T > &  axis,
angle 
)
inline

Constructor given rotation as axis and angle, the axis must be unit vector

Definition at line 112 of file Quat.h.

template<typename T>
openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::Quat ( math::Axis  axis,
angle 
)
inline

Constructor given rotation as axis and angle.

Definition at line 127 of file Quat.h.

template<typename T>
template<typename T1 >
openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::Quat ( const Mat3< T1 > &  rot)
inline

Constructor given a rotation matrix.

Definition at line 140 of file Quat.h.

Member Function Documentation

template<typename T>
Quat& openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::add ( const Quat< T > &  q1,
const Quat< T > &  q2 
)
inline

this = q1 + q2 "this", q1 and q2 need not be distinct objects, e.g. q.add(q1,q);

Definition at line 400 of file Quat.h.

template<typename T>
T openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::angle ( ) const
inline

Return angle of rotation.

Definition at line 224 of file Quat.h.

template<typename T>
Vec3<T> openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::axis ( ) const
inline

Return axis of rotation.

Definition at line 239 of file Quat.h.

template<typename T>
Quat openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::conjugate ( ) const
inline

Return the conjugate of "this", same as invert without unit quaternion test

Definition at line 500 of file Quat.h.

template<typename T>
Quat openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::derivative ( const Vec3< T > &  omega) const
inline

Return the quaternion rate corrsponding to the angular velocity omega and "this" current rotation

Definition at line 458 of file Quat.h.

template<typename T>
T openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::dot ( const Quat< T > &  q) const
inline

Dot product.

Definition at line 451 of file Quat.h.

template<typename T>
bool openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::eq ( const Quat< T > &  q,
eps = 1.0e-7 
) const
inline

Test if "this" is equivalent to q with tolerance of eps value.

Definition at line 310 of file Quat.h.

template<typename T>
Vec3<T> openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::eulerAngles ( RotationOrder  rotationOrder) const
inline

Returns vector of x,y,z rotational components.

Definition at line 297 of file Quat.h.

template<typename T>
static Quat openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::identity ( )
inlinestatic

Definition at line 514 of file Quat.h.

template<typename T>
Quat& openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::init ( x,
y,
z,
w 
)
inline

"this" quaternion gets initialized to [x, y, z, w]

Definition at line 256 of file Quat.h.

template<typename T>
Quat& openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::init ( )
inline

"this" quaternion gets initialized to identity, same as setIdentity()

Definition at line 263 of file Quat.h.

template<typename T>
Quat openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::inverse ( tolerance = T(0)) const
inline

returns inverse of this

Definition at line 486 of file Quat.h.

template<typename T>
Quat& openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::mult ( const Quat< T > &  q1,
const Quat< T > &  q2 
)
inline

this = q1 * q2 q1 and q2 must be distinct objects than "this", e.g. q.mult(q1,q2);

Definition at line 424 of file Quat.h.

template<typename T>
bool openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::normalize ( eps = T(1.0e-8))
inline

this = normalized this

Definition at line 467 of file Quat.h.

template<typename T>
static unsigned openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::numElements ( )
inlinestatic

Definition at line 205 of file Quat.h.

template<typename T>
openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::operator const T * ( ) const
inline

Definition at line 215 of file Quat.h.

template<typename T>
openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::operator T * ( )
inline

Cast to T*.

Definition at line 214 of file Quat.h.

template<typename T>
T& openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::operator() ( int  i)
inline

Alternative indexed reference to the elements.

Definition at line 218 of file Quat.h.

template<typename T>
T openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::operator() ( int  i) const
inline

Alternative indexed constant reference to the elements,.

Definition at line 221 of file Quat.h.

template<typename T>
Quat openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::operator* ( const Quat< T > &  q) const
inline

Return (this*q), e.g. q = q1 * q2;.

Definition at line 362 of file Quat.h.

template<typename T>
Quat openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::operator* ( scalar) const
inline

Return (this*scalar), e.g. q = q1 * scalar;.

Definition at line 383 of file Quat.h.

template<typename T>
Quat& openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::operator*= ( scalar)
inline

Scale "this" quaternion by scalar, e.g. q *= scalar;.

Definition at line 339 of file Quat.h.

template<typename T>
Quat openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::operator*= ( const Quat< T > &  q)
inline

Assigns this to (this*q), e.g. q *= q1;.

Definition at line 376 of file Quat.h.

template<typename T>
Quat openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::operator+ ( const Quat< T > &  q) const
inline

Return (this+q), e.g. q = q1 + q2;.

Definition at line 350 of file Quat.h.

template<typename T>
Quat& openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::operator+= ( const Quat< T > &  q)
inline

Add quaternion q to "this" quaternion, e.g. q += q1;.

Definition at line 317 of file Quat.h.

template<typename T>
Quat openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::operator- ( const Quat< T > &  q) const
inline

Return (this-q), e.g. q = q1 - q2;.

Definition at line 356 of file Quat.h.

template<typename T>
Quat openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::operator- ( ) const
inline

Negation operator, e.g. q = -q;.

Definition at line 395 of file Quat.h.

template<typename T>
Quat& openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::operator-= ( const Quat< T > &  q)
inline

Subtract quaternion q from "this" quaternion, e.g. q -= q1;.

Definition at line 328 of file Quat.h.

template<typename T>
Quat openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::operator/ ( scalar) const
inline

Return (this/scalar), e.g. q = q1 / scalar;.

Definition at line 389 of file Quat.h.

template<typename T>
bool openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::operator== ( const Quat< T > &  q) const
inline

Equality operator, does exact floating point comparisons.

Definition at line 301 of file Quat.h.

template<typename T>
T& openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::operator[] ( int  i)
inline

Array style reference to the components, e.g. q[3] = 1.34f;.

Definition at line 208 of file Quat.h.

template<typename T>
T openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::operator[] ( int  i) const
inline

Array style constant reference to the components, e.g. float f = q[1];.

Definition at line 211 of file Quat.h.

template<typename T>
void openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::read ( std::istream &  is)
inline

Definition at line 544 of file Quat.h.

template<typename T>
Vec3<T> openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::rotateVector ( const Vec3< T > &  v) const
inline

Return rotated vector by "this" quaternion.

Definition at line 506 of file Quat.h.

template<typename T>
Quat& openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::scale ( scale,
const Quat< T > &  q 
)
inline

this = scalar*q, q need not be distinct object than "this", e.g. q.scale(1.5,q1);

Definition at line 440 of file Quat.h.

template<typename T>
Quat& openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::setAxisAngle ( const Vec3< T > &  axis,
angle 
)
inline

Set "this" quaternion to rotation specified by axis and angle, the axis must be unit vector

Definition at line 267 of file Quat.h.

template<typename T>
Quat& openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::setIdentity ( )
inline

Set "this" vector to identity.

Definition at line 289 of file Quat.h.

template<typename T>
Quat& openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::setZero ( )
inline

Set "this" vector to zero.

Definition at line 282 of file Quat.h.

template<typename T>
std::string openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::str ( ) const
inline
Returns
string representation of Classname

Definition at line 517 of file Quat.h.

template<typename T>
Quat& openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::sub ( const Quat< T > &  q1,
const Quat< T > &  q2 
)
inline

this = q1 - q2 "this", q1 and q2 need not be distinct objects, e.g. q.sub(q1,q);

Definition at line 412 of file Quat.h.

template<typename T>
Quat openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::unit ( ) const
inline

this = normalized this

Definition at line 476 of file Quat.h.

template<typename T>
T& openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::w ( )
inline

Definition at line 196 of file Quat.h.

template<typename T>
T openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::w ( ) const
inline

Definition at line 202 of file Quat.h.

template<typename T>
void openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::write ( std::ostream &  os) const
inline

Definition at line 543 of file Quat.h.

template<typename T>
T& openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::x ( )
inline

Reference to the component, e.g. q.x() = 4.5f;.

Definition at line 193 of file Quat.h.

template<typename T>
T openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::x ( ) const
inline

Get the component, e.g. float f = q.w();.

Definition at line 199 of file Quat.h.

template<typename T>
T& openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::y ( )
inline

Definition at line 194 of file Quat.h.

template<typename T>
T openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::y ( ) const
inline

Definition at line 200 of file Quat.h.

template<typename T>
T& openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::z ( )
inline

Definition at line 195 of file Quat.h.

template<typename T>
T openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::z ( ) const
inline

Definition at line 201 of file Quat.h.

template<typename T>
static Quat openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::zero ( )
inlinestatic

Predefined constants, e.g. Quat q = Quat::identity();.

Definition at line 513 of file Quat.h.

Friends And Related Function Documentation

template<typename T>
std::ostream& operator<< ( std::ostream &  stream,
const Quat< T > &  q 
)
friend

Output to the stream, e.g. std::cout << q << std::endl;.

Definition at line 535 of file Quat.h.

template<typename T>
Quat slerp ( const Quat< T > &  q1,
const Quat< T > &  q2,
t,
tolerance = 0.00001 
)
friend

Linear interpolation between the two quaternions.

Definition at line 27 of file Quat.h.

Member Data Documentation

template<typename T>
T openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::mm[4]
protected

Definition at line 547 of file Quat.h.

template<typename T>
const int openvdb::OPENVDB_VERSION_NAME::math::Quat< T >::size = 4
static

Definition at line 83 of file Quat.h.


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