All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 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 ( )
inline

Default constructor leaves the quaternion undefined.

Definition at line 67 of file quatf.h.

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 ( float  real,
float  i,
float  j,
float  k 
)
inline

Initialize the real and imaginary coefficients.

Definition at line 79 of file quatf.h.

GfQuatf ( float  real,
const GfVec3f imaginary 
)
inline

Initialize the real and imaginary coefficients.

Definition at line 85 of file quatf.h.

GF_API GfQuatf ( class GfQuatd const &  other)
explicit

Construct from GfQuatd.

GF_API GfQuatf ( class GfQuath const &  other)

Implicitly convert from GfQuath.

Member Function Documentation

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 140 of file quatf.h.

static GfQuatf GetIdentity ( )
inlinestatic

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

Definition at line 99 of file quatf.h.

const GfVec3f& GetImaginary ( ) const
inline

Return the imaginary coefficient.

Definition at line 108 of file quatf.h.

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 146 of file quatf.h.

float GetLength ( ) const
inline

Return geometric length of this quaternion.

Definition at line 121 of file quatf.h.

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 126 of file quatf.h.

float GetReal ( ) const
inline

Return the real coefficient.

Definition at line 102 of file quatf.h.

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.

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 181 of file quatf.h.

GF_API GfQuatf& operator*= ( const GfQuatf q)

Post-multiply quaternion q into this quaternion.

GfQuatf& operator*= ( float  s)
inline

Multiply this quaternion's coefficients by s.

Definition at line 190 of file quatf.h.

GfQuatf& operator+= ( const GfQuatf q)
inline

Add quaternion q to this quaternion.

Definition at line 204 of file quatf.h.

GfQuatf operator- ( ) const
inline

Component-wise negation.

Definition at line 168 of file quatf.h.

GfQuatf& operator-= ( const GfQuatf q)
inline

Component-wise unary difference operator.

Definition at line 211 of file quatf.h.

GfQuatf& operator/= ( float  s)
inline

Divide this quaternion's coefficients by s.

Definition at line 197 of file quatf.h.

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 174 of file quatf.h.

void SetImaginary ( const GfVec3f imaginary)
inline

Set the imaginary coefficients.

Definition at line 111 of file quatf.h.

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

Set the imaginary coefficients.

Definition at line 116 of file quatf.h.

void SetReal ( float  real)
inline

Set the real coefficient.

Definition at line 105 of file quatf.h.

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

size_t hash_value ( const GfQuatf q)
friend

Hash.

Definition at line 161 of file quatf.h.

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

Returns the product of quaternions q1 and q2.

Definition at line 231 of file quatf.h.

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

Returns the product of quaternion q and scalar s.

Definition at line 237 of file quatf.h.

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

Returns the product of quaternion q and scalar s.

Definition at line 243 of file quatf.h.

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

Component-wise binary sum operator.

Definition at line 219 of file quatf.h.

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

Component-wise binary difference operator.

Definition at line 225 of file quatf.h.

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

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

Definition at line 249 of file quatf.h.


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