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

#include <quaternion.h>

Public Member Functions

 GfQuaternion ()
 The default constructor leaves the quaternion undefined. More...
 
 GfQuaternion (int realVal)
 
 GfQuaternion (double real, const GfVec3d &imaginary)
 This constructor initializes the real and imaginary parts. More...
 
void SetReal (double real)
 Sets the real part of the quaternion. More...
 
void SetImaginary (const GfVec3d &imaginary)
 Sets the imaginary part of the quaternion. More...
 
double GetReal () const
 Returns the real part of the quaternion. More...
 
const GfVec3dGetImaginary () const
 Returns the imaginary part of the quaternion. More...
 
GF_API double GetLength () const
 Returns geometric length of this quaternion. More...
 
GF_API GfQuaternion GetNormalized (double eps=GF_MIN_VECTOR_LENGTH) const
 
GF_API double Normalize (double eps=GF_MIN_VECTOR_LENGTH)
 
GF_API GfQuaternion GetInverse () const
 Returns the inverse of this quaternion. More...
 
bool operator== (const GfQuaternion &q) const
 
bool operator!= (const GfQuaternion &q) const
 
GF_API GfQuaternionoperator*= (const GfQuaternion &q)
 Post-multiplies quaternion q into this quaternion. More...
 
GF_API GfQuaternionoperator*= (double s)
 Scales this quaternion by s. More...
 
GfQuaternionoperator/= (double s)
 Scales this quaternion by 1 / s. More...
 
GfQuaternionoperator+= (const GfQuaternion &q)
 Component-wise unary sum operator. More...
 
GfQuaternionoperator-= (const GfQuaternion &q)
 Component-wise unary difference operator. More...
 

Static Public Member Functions

static GfQuaternion GetIdentity ()
 

Friends

size_t hash_value (const GfQuaternion &q)
 Hash. More...
 
GfQuaternion operator+ (const GfQuaternion &q1, const GfQuaternion &q2)
 Component-wise binary sum operator. More...
 
GfQuaternion operator- (const GfQuaternion &q1, const GfQuaternion &q2)
 Component-wise binary difference operator. More...
 
GfQuaternion operator* (const GfQuaternion &q1, const GfQuaternion &q2)
 Returns the product of quaternions q1 and q2. More...
 
GfQuaternion operator* (const GfQuaternion &q, double s)
 Returns the product of quaternion q and scalar s. More...
 
GfQuaternion operator* (double s, const GfQuaternion &q)
 Returns the product of quaternion q and scalar s. More...
 
GfQuaternion operator/ (const GfQuaternion &q, double s)
 Returns the product of quaternion q and scalar 1 / s. More...
 
GF_API friend GfQuaternion GfSlerp (double alpha, const GfQuaternion &q0, const GfQuaternion &q1)
 
GF_API GfQuaternion GfSlerp (const GfQuaternion &q0, const GfQuaternion &q1, double alpha)
 

Detailed Description

Basic type: complex number with scalar real part and vector imaginary part.

This class represents a generalized complex number that has a scalar real part and a vector of three imaginary values. Quaternions are used by the GfRotation class to represent arbitrary-axis rotations.

Definition at line 50 of file quaternion.h.

Constructor & Destructor Documentation

GfQuaternion::GfQuaternion ( )
inline

The default constructor leaves the quaternion undefined.

Definition at line 55 of file quaternion.h.

GfQuaternion::GfQuaternion ( int  realVal)
inlineexplicit

This constructor initializes the real part to the argument and the imaginary parts to zero.

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

Definition at line 64 of file quaternion.h.

GfQuaternion::GfQuaternion ( double  real,
const GfVec3d imaginary 
)
inline

This constructor initializes the real and imaginary parts.

Definition at line 70 of file quaternion.h.

Member Function Documentation

static GfQuaternion GfQuaternion::GetIdentity ( )
inlinestatic

Returns the identity quaternion, which has a real part of 1 and an imaginary part of (0,0,0).

Definition at line 96 of file quaternion.h.

const GfVec3d& GfQuaternion::GetImaginary ( ) const
inline

Returns the imaginary part of the quaternion.

Definition at line 90 of file quaternion.h.

GF_API GfQuaternion GfQuaternion::GetInverse ( ) const

Returns the inverse of this quaternion.

GF_API double GfQuaternion::GetLength ( ) const

Returns geometric length of this quaternion.

GF_API GfQuaternion GfQuaternion::GetNormalized ( double  eps = GF_MIN_VECTOR_LENGTH) const

Returns a normalized (unit-length) version of this quaternion. direction as this. If the length of this quaternion is smaller than eps, this returns the identity quaternion.

double GfQuaternion::GetReal ( ) const
inline

Returns the real part of the quaternion.

Definition at line 85 of file quaternion.h.

GF_API double GfQuaternion::Normalize ( double  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 GfQuaternion::operator!= ( const GfQuaternion 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 137 of file quaternion.h.

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

Post-multiplies quaternion q into this quaternion.

GF_API GfQuaternion& GfQuaternion::operator*= ( double  s)

Scales this quaternion by s.

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

Component-wise unary sum operator.

Definition at line 155 of file quaternion.h.

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

Component-wise unary difference operator.

Definition at line 162 of file quaternion.h.

GfQuaternion& GfQuaternion::operator/= ( double  s)
inline

Scales this quaternion by 1 / s.

Definition at line 150 of file quaternion.h.

bool GfQuaternion::operator== ( const GfQuaternion 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 130 of file quaternion.h.

void GfQuaternion::SetImaginary ( const GfVec3d imaginary)
inline

Sets the imaginary part of the quaternion.

Definition at line 80 of file quaternion.h.

void GfQuaternion::SetReal ( double  real)
inline

Sets the real part of the quaternion.

Definition at line 75 of file quaternion.h.

Friends And Related Function Documentation

GF_API friend GfQuaternion GfSlerp ( double  alpha,
const GfQuaternion q0,
const GfQuaternion q1 
)
friend

Spherically interpolate between q0 and q1.

If the interpolant alpha is zero, then the result is q0, while alpha of one yields q1.

GF_API GfQuaternion GfSlerp ( const GfQuaternion q0,
const GfQuaternion q1,
double  alpha 
)
friend
size_t hash_value ( const GfQuaternion q)
friend

Hash.

Definition at line 121 of file quaternion.h.

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

Returns the product of quaternions q1 and q2.

Definition at line 183 of file quaternion.h.

GfQuaternion operator* ( const GfQuaternion q,
double  s 
)
friend

Returns the product of quaternion q and scalar s.

Definition at line 190 of file quaternion.h.

GfQuaternion operator* ( double  s,
const GfQuaternion q 
)
friend

Returns the product of quaternion q and scalar s.

Definition at line 196 of file quaternion.h.

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

Component-wise binary sum operator.

Definition at line 169 of file quaternion.h.

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

Component-wise binary difference operator.

Definition at line 176 of file quaternion.h.

GfQuaternion operator/ ( const GfQuaternion q,
double  s 
)
friend

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

Definition at line 202 of file quaternion.h.


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