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 GetZero ()
 Return the zero quaternion, with real coefficient 0 and an imaginary coefficients all zero. More...
 
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() [1/6]

GfQuath ( )
inline

Default constructor leaves the quaternion undefined.

Definition at line 68 of file quath.h.

◆ GfQuath() [2/6]

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() [3/6]

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() [4/6]

GfQuath ( GfHalf  real,
const GfVec3h imaginary 
)
inline

Initialize the real and imaginary coefficients.

Definition at line 86 of file quath.h.

◆ GfQuath() [5/6]

GF_API GfQuath ( class GfQuatd const &  other)
explicit

Construct from GfQuatd.

◆ GfQuath() [6/6]

GF_API GfQuath ( class GfQuatf const &  other)
explicit

Construct from GfQuatf.

Member Function Documentation

◆ GetConjugate()

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

◆ GetIdentity()

static GfQuath GetIdentity ( )
inlinestatic

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

Definition at line 104 of file quath.h.

◆ GetImaginary()

const GfVec3h& GetImaginary ( ) const
inline

Return the imaginary coefficient.

Definition at line 113 of file quath.h.

◆ GetInverse()

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

◆ GetLength()

GfHalf GetLength ( ) const
inline

Return geometric length of this quaternion.

Definition at line 126 of file quath.h.

◆ GetNormalized()

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

◆ GetReal()

GfHalf GetReal ( ) const
inline

Return the real coefficient.

Definition at line 107 of file quath.h.

◆ GetZero()

static GfQuath GetZero ( )
inlinestatic

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

Definition at line 100 of file quath.h.

◆ Normalize()

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.

◆ operator *=() [1/2]

GF_API GfQuath& operator *= ( const GfQuath q)

Post-multiply quaternion q into this quaternion.

◆ operator *=() [2/2]

GfQuath& operator *= ( GfHalf  s)
inline

Multiply this quaternion's coefficients by s.

Definition at line 195 of file quath.h.

◆ operator -=()

GfQuath& operator -= ( const GfQuath q)
inline

Component-wise unary difference operator.

Definition at line 216 of file quath.h.

◆ operator!=()

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

◆ operator+=()

GfQuath& operator+= ( const GfQuath q)
inline

Add quaternion q to this quaternion.

Definition at line 209 of file quath.h.

◆ operator-()

GfQuath operator- ( ) const
inline

Component-wise negation.

Definition at line 173 of file quath.h.

◆ operator/=()

GfQuath& operator/= ( GfHalf  s)
inline

Divide this quaternion's coefficients by s.

Definition at line 202 of file quath.h.

◆ operator==()

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

◆ SetImaginary() [1/2]

void SetImaginary ( const GfVec3h imaginary)
inline

Set the imaginary coefficients.

Definition at line 116 of file quath.h.

◆ SetImaginary() [2/2]

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

Set the imaginary coefficients.

Definition at line 121 of file quath.h.

◆ SetReal()

void SetReal ( GfHalf  real)
inline

Set the real coefficient.

Definition at line 110 of file quath.h.

◆ Transform()

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

◆ hash_value

size_t hash_value ( const GfQuath q)
friend

Hash.

Definition at line 166 of file quath.h.

◆ operator * [1/3]

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

Returns the product of quaternions q1 and q2.

Definition at line 236 of file quath.h.

◆ operator * [2/3]

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

Returns the product of quaternion q and scalar s.

Definition at line 242 of file quath.h.

◆ operator * [3/3]

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

Returns the product of quaternion q and scalar s.

Definition at line 248 of file quath.h.

◆ operator -

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

Component-wise binary difference operator.

Definition at line 230 of file quath.h.

◆ operator+

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

Component-wise binary sum operator.

Definition at line 224 of file quath.h.

◆ operator/

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

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

Definition at line 254 of file quath.h.


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