GfQuatf 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 float ScalarType
 
typedef GfVec3f ImaginaryType
 

Public Member Functions

 GfQuatf ()
 Default constructor leaves the quaternion undefined. More...
 
 GfQuatf (float realVal)
 Initialize the real coefficient to realVal and the imaginary coefficients to zero. More...
 
 GfQuatf (float real, float i, float j, float k)
 Initialize the real and imaginary coefficients. More...
 
 GfQuatf (float real, const GfVec3f &imaginary)
 Initialize the real and imaginary coefficients. More...
 
GF_API GfQuatf (class GfQuatd const &other)
 Construct from GfQuatd. More...
 
GF_API GfQuatf (class GfQuath const &other)
 Implicitly convert from GfQuath. More...
 
float GetReal () const
 Return the real coefficient. More...
 
void SetReal (float real)
 Set the real coefficient. More...
 
const GfVec3fGetImaginary () const
 Return the imaginary coefficient. More...
 
void SetImaginary (const GfVec3f &imaginary)
 Set the imaginary coefficients. More...
 
void SetImaginary (float i, float j, float k)
 Set the imaginary coefficients. More...
 
float GetLength () const
 Return geometric length of this quaternion. More...
 
GfQuatf GetNormalized (float eps=GF_MIN_VECTOR_LENGTH) const
 length of this quaternion is smaller than eps, return the identity quaternion. More...
 
GF_API float Normalize (float eps=GF_MIN_VECTOR_LENGTH)
 Normalizes this quaternion in place to unit length, returning the length before normalization. More...
 
GfQuatf GetConjugate () const
 Return this quaternion's conjugate, which is the quaternion with the same real coefficient and negated imaginary coefficients. More...
 
GfQuatf GetInverse () const
 Return this quaternion's inverse, or reciprocal. More...
 
GF_API GfVec3f Transform (const GfVec3f &point) const
 Transform the GfVec3f point. More...
 
GfQuatf operator- () const
 Component-wise negation. More...
 
bool operator== (const GfQuatf &q) const
 Component-wise quaternion equality test. More...
 
bool operator!= (const GfQuatf &q) const
 Component-wise quaternion inequality test. More...
 
GF_API GfQuatfoperator *= (const GfQuatf &q)
 Post-multiply quaternion q into this quaternion. More...
 
GfQuatfoperator *= (float s)
 Multiply this quaternion's coefficients by s. More...
 
GfQuatfoperator/= (float s)
 Divide this quaternion's coefficients by s. More...
 
GfQuatfoperator+= (const GfQuatf &q)
 Add quaternion q to this quaternion. More...
 
GfQuatfoperator -= (const GfQuatf &q)
 Component-wise unary difference operator. More...
 

Static Public Member Functions

static GfQuatf GetZero ()
 Return the zero quaternion, with real coefficient 0 and an imaginary coefficients all zero. More...
 
static GfQuatf GetIdentity ()
 Return the identity quaternion, with real coefficient 1 and an imaginary coefficients all zero. More...
 

Friends

size_t hash_value (const GfQuatf &q)
 Hash. More...
 
GfQuatf operator+ (const GfQuatf &q1, const GfQuatf &q2)
 Component-wise binary sum operator. More...
 
GfQuatf operator - (const GfQuatf &q1, const GfQuatf &q2)
 Component-wise binary difference operator. More...
 
GfQuatf operator * (const GfQuatf &q1, const GfQuatf &q2)
 Returns the product of quaternions q1 and q2. More...
 
GfQuatf operator * (const GfQuatf &q, float s)
 Returns the product of quaternion q and scalar s. More...
 
GfQuatf operator * (float s, const GfQuatf &q)
 Returns the product of quaternion q and scalar s. More...
 
GfQuatf operator/ (const GfQuatf &q, float 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 quatf.h.

Constructor & Destructor Documentation

◆ GfQuatf() [1/6]

GfQuatf ( )
inline

Default constructor leaves the quaternion undefined.

Definition at line 67 of file quatf.h.

◆ GfQuatf() [2/6]

GfQuatf ( float  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 quatf.h.

◆ GfQuatf() [3/6]

GfQuatf ( float  real,
float  i,
float  j,
float  k 
)
inline

Initialize the real and imaginary coefficients.

Definition at line 79 of file quatf.h.

◆ GfQuatf() [4/6]

GfQuatf ( float  real,
const GfVec3f imaginary 
)
inline

Initialize the real and imaginary coefficients.

Definition at line 85 of file quatf.h.

◆ GfQuatf() [5/6]

GF_API GfQuatf ( class GfQuatd const &  other)
explicit

Construct from GfQuatd.

◆ GfQuatf() [6/6]

GF_API GfQuatf ( class GfQuath const &  other)

Implicitly convert from GfQuath.

Member Function Documentation

◆ GetConjugate()

GfQuatf 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 quatf.h.

◆ GetIdentity()

static GfQuatf GetIdentity ( )
inlinestatic

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

Definition at line 103 of file quatf.h.

◆ GetImaginary()

const GfVec3f& GetImaginary ( ) const
inline

Return the imaginary coefficient.

Definition at line 112 of file quatf.h.

◆ GetInverse()

GfQuatf 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 quatf.h.

◆ GetLength()

float GetLength ( ) const
inline

Return geometric length of this quaternion.

Definition at line 125 of file quatf.h.

◆ GetNormalized()

GfQuatf GetNormalized ( float  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 quatf.h.

◆ GetReal()

float GetReal ( ) const
inline

Return the real coefficient.

Definition at line 106 of file quatf.h.

◆ GetZero()

static GfQuatf GetZero ( )
inlinestatic

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

Definition at line 99 of file quatf.h.

◆ Normalize()

GF_API float Normalize ( float  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 GfQuatf& operator *= ( const GfQuatf q)

Post-multiply quaternion q into this quaternion.

◆ operator *=() [2/2]

GfQuatf& operator *= ( float  s)
inline

Multiply this quaternion's coefficients by s.

Definition at line 194 of file quatf.h.

◆ operator -=()

GfQuatf& operator -= ( const GfQuatf q)
inline

Component-wise unary difference operator.

Definition at line 215 of file quatf.h.

◆ operator!=()

bool operator!= ( const GfQuatf 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 185 of file quatf.h.

◆ operator+=()

GfQuatf& operator+= ( const GfQuatf q)
inline

Add quaternion q to this quaternion.

Definition at line 208 of file quatf.h.

◆ operator-()

GfQuatf operator- ( ) const
inline

Component-wise negation.

Definition at line 172 of file quatf.h.

◆ operator/=()

GfQuatf& operator/= ( float  s)
inline

Divide this quaternion's coefficients by s.

Definition at line 201 of file quatf.h.

◆ operator==()

bool operator== ( const GfQuatf 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 178 of file quatf.h.

◆ SetImaginary() [1/2]

void SetImaginary ( const GfVec3f imaginary)
inline

Set the imaginary coefficients.

Definition at line 115 of file quatf.h.

◆ SetImaginary() [2/2]

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

Set the imaginary coefficients.

Definition at line 120 of file quatf.h.

◆ SetReal()

void SetReal ( float  real)
inline

Set the real coefficient.

Definition at line 109 of file quatf.h.

◆ Transform()

GF_API GfVec3f Transform ( const GfVec3f point) const

Transform the GfVec3f point.

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

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

but is more efficient.

Friends And Related Function Documentation

◆ hash_value

size_t hash_value ( const GfQuatf q)
friend

Hash.

Definition at line 165 of file quatf.h.

◆ operator * [1/3]

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

Returns the product of quaternions q1 and q2.

Definition at line 235 of file quatf.h.

◆ operator * [2/3]

GfQuatf operator * ( const GfQuatf q,
float  s 
)
friend

Returns the product of quaternion q and scalar s.

Definition at line 241 of file quatf.h.

◆ operator * [3/3]

GfQuatf operator * ( float  s,
const GfQuatf q 
)
friend

Returns the product of quaternion q and scalar s.

Definition at line 247 of file quatf.h.

◆ operator -

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

Component-wise binary difference operator.

Definition at line 229 of file quatf.h.

◆ operator+

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

Component-wise binary sum operator.

Definition at line 223 of file quatf.h.

◆ operator/

GfQuatf operator/ ( const GfQuatf q,
float  s 
)
friend

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

Definition at line 253 of file quatf.h.


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