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

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

Public Types

typedef GfHalf ScalarType
 
typedef GfVec3h ImaginaryType
 

Public Member Functions

 GfQuath ()
 Default constructor leaves the quaternion undefined. More...
 
 GfQuath (GfHalf realVal)
 Initialize the real coefficient to realVal and the imaginary coefficients to zero. More...
 
 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
 length of this quaternion is smaller than eps, return the identity quaternion. More...
 
GF_API GfHalf Normalize (GfHalf eps=GF_MIN_VECTOR_LENGTH)
 Normalizes this quaternion in place to unit length, returning the length before normalization. More...
 
GfQuath GetConjugate () const
 Return this quaternion's conjugate, which is the quaternion with the same real coefficient and negated imaginary coefficients. More...
 
GfQuath GetInverse () const
 Return this quaternion's inverse, or reciprocal. More...
 
GF_API GfVec3h Transform (const GfVec3h &point) const
 Transform the GfVec3h point. More...
 
GfQuath operator- () const
 Component-wise negation. More...
 
bool operator== (const GfQuath &q) const
 Component-wise quaternion equality test. More...
 
bool operator!= (const GfQuath &q) const
 Component-wise quaternion inequality test. More...
 
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 GetIdentity ()
 Return the identity quaternion, with real coefficient 1 and an imaginary coefficients all zero. More...
 

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 61 of file quath.h.

Constructor & Destructor Documentation

GfQuath ( )
inline

Default constructor leaves the quaternion undefined.

Definition at line 68 of file quath.h.

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 77 of file quath.h.

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

Initialize the real and imaginary coefficients.

Definition at line 80 of file quath.h.

GfQuath ( GfHalf  real,
const GfVec3h imaginary 
)
inline

Initialize the real and imaginary coefficients.

Definition at line 86 of file quath.h.

GF_API GfQuath ( class GfQuatd const &  other)
explicit

Construct from GfQuatd.

GF_API GfQuath ( class GfQuatf const &  other)
explicit

Construct from GfQuatf.

Member Function Documentation

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 141 of file quath.h.

static GfQuath GetIdentity ( )
inlinestatic

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

Definition at line 100 of file quath.h.

const GfVec3h& GetImaginary ( ) const
inline

Return the imaginary coefficient.

Definition at line 109 of file quath.h.

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 147 of file quath.h.

GfHalf GetLength ( ) const
inline

Return geometric length of this quaternion.

Definition at line 122 of file quath.h.

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 127 of file quath.h.

GfHalf GetReal ( ) const
inline

Return the real coefficient.

Definition at line 103 of file quath.h.

GF_API GfHalf 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 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 182 of file quath.h.

GF_API GfQuath& operator*= ( const GfQuath q)

Post-multiply quaternion q into this quaternion.

GfQuath& operator*= ( GfHalf  s)
inline

Multiply this quaternion's coefficients by s.

Definition at line 191 of file quath.h.

GfQuath& operator+= ( const GfQuath q)
inline

Add quaternion q to this quaternion.

Definition at line 205 of file quath.h.

GfQuath operator- ( ) const
inline

Component-wise negation.

Definition at line 169 of file quath.h.

GfQuath& operator-= ( const GfQuath q)
inline

Component-wise unary difference operator.

Definition at line 212 of file quath.h.

GfQuath& operator/= ( GfHalf  s)
inline

Divide this quaternion's coefficients by s.

Definition at line 198 of file quath.h.

bool 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 175 of file quath.h.

void SetImaginary ( const GfVec3h imaginary)
inline

Set the imaginary coefficients.

Definition at line 112 of file quath.h.

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

Set the imaginary coefficients.

Definition at line 117 of file quath.h.

void SetReal ( GfHalf  real)
inline

Set the real coefficient.

Definition at line 106 of file quath.h.

GF_API GfVec3h 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 162 of file quath.h.

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

Returns the product of quaternions q1 and q2.

Definition at line 232 of file quath.h.

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

Returns the product of quaternion q and scalar s.

Definition at line 238 of file quath.h.

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

Returns the product of quaternion q and scalar s.

Definition at line 244 of file quath.h.

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

Component-wise binary sum operator.

Definition at line 220 of file quath.h.

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

Component-wise binary difference operator.

Definition at line 226 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 250 of file quath.h.


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