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 GetZero ()
 
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 49 of file quaternion.h.

Constructor & Destructor Documentation

GfQuaternion::GfQuaternion ( )
inline

The default constructor leaves the quaternion undefined.

Definition at line 54 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 63 of file quaternion.h.

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

This constructor initializes the real and imaginary parts.

Definition at line 69 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 101 of file quaternion.h.

const GfVec3d& GfQuaternion::GetImaginary ( ) const
inline

Returns the imaginary part of the quaternion.

Definition at line 89 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 84 of file quaternion.h.

static GfQuaternion GfQuaternion::GetZero ( )
inlinestatic

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

Definition at line 95 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 139 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 157 of file quaternion.h.

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

Component-wise unary difference operator.

Definition at line 164 of file quaternion.h.

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

Scales this quaternion by 1 / s.

Definition at line 152 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 132 of file quaternion.h.

void GfQuaternion::SetImaginary ( const GfVec3d imaginary)
inline

Sets the imaginary part of the quaternion.

Definition at line 79 of file quaternion.h.

void GfQuaternion::SetReal ( double  real)
inline

Sets the real part of the quaternion.

Definition at line 74 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 126 of file quaternion.h.

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

Returns the product of quaternions q1 and q2.

Definition at line 185 of file quaternion.h.

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

Returns the product of quaternion q and scalar s.

Definition at line 192 of file quaternion.h.

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

Returns the product of quaternion q and scalar s.

Definition at line 198 of file quaternion.h.

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

Component-wise binary sum operator.

Definition at line 171 of file quaternion.h.

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

Component-wise binary difference operator.

Definition at line 178 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 204 of file quaternion.h.


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