HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GfQuath Class Reference

#include <quath.h>

Public Types

typedef GfHalf ScalarType
 
typedef GfVec3h ImaginaryType
 

Public Member Functions

 GfQuath ()
 Default constructor leaves the quaternion undefined. More...
 
 GfQuath (GfHalf realVal)
 
 GfQuath (GfHalf real, GfHalf i, GfHalf j, GfHalf k)
 Initialize the real and imaginary coefficients. More...
 
 GfQuath (GfHalf real, const GfVec3h &imaginary)
 Initialize the real and imaginary coefficients. More...
 
GF_API GfQuath (class GfQuatd const &other)
 Construct from GfQuatd. More...
 
GF_API GfQuath (class GfQuatf const &other)
 Construct from GfQuatf. More...
 
GfHalf GetReal () const
 Return the real coefficient. More...
 
void SetReal (GfHalf real)
 Set the real coefficient. More...
 
const GfVec3hGetImaginary () const
 Return the imaginary coefficient. More...
 
void SetImaginary (const GfVec3h &imaginary)
 Set the imaginary coefficients. More...
 
void SetImaginary (GfHalf i, GfHalf j, GfHalf k)
 Set the imaginary coefficients. More...
 
GfHalf GetLength () const
 Return geometric length of this quaternion. More...
 
GfQuath GetNormalized (GfHalf eps=GF_MIN_VECTOR_LENGTH) const
 
GF_API GfHalf Normalize (GfHalf eps=GF_MIN_VECTOR_LENGTH)
 
GfQuath GetConjugate () const
 
GfQuath GetInverse () const
 
GF_API GfVec3h Transform (const GfVec3h &point) const
 
GfQuath operator- () const
 Component-wise negation. More...
 
bool operator== (const GfQuath &q) const
 
bool operator!= (const GfQuath &q) const
 
GF_API GfQuathoperator*= (const GfQuath &q)
 Post-multiply quaternion q into this quaternion. More...
 
GfQuathoperator*= (GfHalf s)
 Multiply this quaternion's coefficients by s. More...
 
GfQuathoperator/= (GfHalf s)
 Divide this quaternion's coefficients by s. More...
 
GfQuathoperator+= (const GfQuath &q)
 Add quaternion q to this quaternion. More...
 
GfQuathoperator-= (const GfQuath &q)
 Component-wise unary difference operator. More...
 

Static Public Member Functions

static GfQuath GetZero ()
 
static GfQuath GetIdentity ()
 

Friends

size_t hash_value (const GfQuath &q)
 Hash. More...
 
GfQuath operator+ (const GfQuath &q1, const GfQuath &q2)
 Component-wise binary sum operator. More...
 
GfQuath operator- (const GfQuath &q1, const GfQuath &q2)
 Component-wise binary difference operator. More...
 
GfQuath operator* (const GfQuath &q1, const GfQuath &q2)
 Returns the product of quaternions q1 and q2. More...
 
GfQuath operator* (const GfQuath &q, GfHalf s)
 Returns the product of quaternion q and scalar s. More...
 
GfQuath operator* (GfHalf s, const GfQuath &q)
 Returns the product of quaternion q and scalar s. More...
 
GfQuath operator/ (const GfQuath &q, GfHalf s)
 Returns the product of quaternion q and scalar 1 / s. More...
 

Detailed Description

Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients, stored as a 3-vector.

Definition at line 60 of file quath.h.

Member Typedef Documentation

Definition at line 64 of file quath.h.

Definition at line 63 of file quath.h.

Constructor & Destructor Documentation

GfQuath::GfQuath ( )
inline

Default constructor leaves the quaternion undefined.

Definition at line 67 of file quath.h.

GfQuath::GfQuath ( GfHalf  realVal)
inlineexplicit

Initialize the real coefficient to realVal and the imaginary coefficients to zero.

Since quaternions typically must be normalized, reasonable values for realVal are -1, 0, or 1. Other values are legal but are likely to be meaningless.

Definition at line 76 of file quath.h.

GfQuath::GfQuath ( GfHalf  real,
GfHalf  i,
GfHalf  j,
GfHalf  k 
)
inline

Initialize the real and imaginary coefficients.

Definition at line 79 of file quath.h.

GfQuath::GfQuath ( GfHalf  real,
const GfVec3h imaginary 
)
inline

Initialize the real and imaginary coefficients.

Definition at line 85 of file quath.h.

GF_API GfQuath::GfQuath ( class GfQuatd const &  other)
explicit

Construct from GfQuatd.

GF_API GfQuath::GfQuath ( class GfQuatf const &  other)
explicit

Construct from GfQuatf.

Member Function Documentation

GfQuath GfQuath::GetConjugate ( ) const
inline

Return this quaternion's conjugate, which is the quaternion with the same real coefficient and negated imaginary coefficients.

Definition at line 144 of file quath.h.

static GfQuath GfQuath::GetIdentity ( )
inlinestatic

Return the identity quaternion, with real coefficient 1 and an imaginary coefficients all zero.

Definition at line 103 of file quath.h.

const GfVec3h& GfQuath::GetImaginary ( ) const
inline

Return the imaginary coefficient.

Definition at line 112 of file quath.h.

GfQuath GfQuath::GetInverse ( ) const
inline

Return this quaternion's inverse, or reciprocal. This is the quaternion's conjugate divided by it's squared length.

Definition at line 150 of file quath.h.

GfHalf GfQuath::GetLength ( ) const
inline

Return geometric length of this quaternion.

Definition at line 125 of file quath.h.

GfQuath GfQuath::GetNormalized ( GfHalf  eps = GF_MIN_VECTOR_LENGTH) const
inline

length of this quaternion is smaller than eps, return the identity quaternion.

Definition at line 130 of file quath.h.

GfHalf GfQuath::GetReal ( ) const
inline

Return the real coefficient.

Definition at line 106 of file quath.h.

static GfQuath GfQuath::GetZero ( )
inlinestatic

Return the zero quaternion, with real coefficient 0 and an imaginary coefficients all zero.

Definition at line 99 of file quath.h.

GF_API GfHalf GfQuath::Normalize ( GfHalf  eps = GF_MIN_VECTOR_LENGTH)

Normalizes this quaternion in place to unit length, returning the length before normalization. If the length of this quaternion is smaller than eps, this sets the quaternion to identity.

bool GfQuath::operator!= ( const GfQuath q) const
inline

Component-wise quaternion inequality test. The real and imaginary parts must match exactly for quaternions to be considered equal.

Definition at line 183 of file quath.h.

GF_API GfQuath& GfQuath::operator*= ( const GfQuath q)

Post-multiply quaternion q into this quaternion.

GfQuath& GfQuath::operator*= ( GfHalf  s)
inline

Multiply this quaternion's coefficients by s.

Definition at line 192 of file quath.h.

GfQuath& GfQuath::operator+= ( const GfQuath q)
inline

Add quaternion q to this quaternion.

Definition at line 206 of file quath.h.

GfQuath GfQuath::operator- ( ) const
inline

Component-wise negation.

Definition at line 170 of file quath.h.

GfQuath& GfQuath::operator-= ( const GfQuath q)
inline

Component-wise unary difference operator.

Definition at line 213 of file quath.h.

GfQuath& GfQuath::operator/= ( GfHalf  s)
inline

Divide this quaternion's coefficients by s.

Definition at line 199 of file quath.h.

bool GfQuath::operator== ( const GfQuath q) const
inline

Component-wise quaternion equality test. The real and imaginary parts must match exactly for quaternions to be considered equal.

Definition at line 176 of file quath.h.

void GfQuath::SetImaginary ( const GfVec3h imaginary)
inline

Set the imaginary coefficients.

Definition at line 115 of file quath.h.

void GfQuath::SetImaginary ( GfHalf  i,
GfHalf  j,
GfHalf  k 
)
inline

Set the imaginary coefficients.

Definition at line 120 of file quath.h.

void GfQuath::SetReal ( GfHalf  real)
inline

Set the real coefficient.

Definition at line 109 of file quath.h.

GF_API GfVec3h GfQuath::Transform ( const GfVec3h point) const

Transform the GfVec3h point. If the quaternion is normalized, the transformation is a rotation. Given a GfQuath q, q.Transform(point) is equivalent to:

(q * GfQuath(0, point) * q.GetInverse()).GetImaginary()

but is more efficient.

Friends And Related Function Documentation

size_t hash_value ( const GfQuath q)
friend

Hash.

Definition at line 165 of file quath.h.

GfQuath operator* ( const GfQuath q1,
const GfQuath q2 
)
friend

Returns the product of quaternions q1 and q2.

Definition at line 233 of file quath.h.

GfQuath operator* ( const GfQuath q,
GfHalf  s 
)
friend

Returns the product of quaternion q and scalar s.

Definition at line 239 of file quath.h.

GfQuath operator* ( GfHalf  s,
const GfQuath q 
)
friend

Returns the product of quaternion q and scalar s.

Definition at line 245 of file quath.h.

GfQuath operator+ ( const GfQuath q1,
const GfQuath q2 
)
friend

Component-wise binary sum operator.

Definition at line 221 of file quath.h.

GfQuath operator- ( const GfQuath q1,
const GfQuath q2 
)
friend

Component-wise binary difference operator.

Definition at line 227 of file quath.h.

GfQuath operator/ ( const GfQuath q,
GfHalf  s 
)
friend

Returns the product of quaternion q and scalar 1 / s.

Definition at line 251 of file quath.h.


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