![]() |
|
Basic type: complex number with scalar real part and vector imaginary part. More...
#include <quaternion.h>
Public Member Functions | |
GfQuaternion () | |
The default constructor leaves the quaternion undefined. | |
GfQuaternion (int realVal) | |
This constructor initializes the real part to the argument and the imaginary parts to zero. | |
GfQuaternion (double real, const GfVec3d &imaginary) | |
This constructor initializes the real and imaginary parts. | |
void | SetReal (double real) |
Sets the real part of the quaternion. | |
void | SetImaginary (const GfVec3d &imaginary) |
Sets the imaginary part of the quaternion. | |
double | GetReal () const |
Returns the real part of the quaternion. | |
const GfVec3d & | GetImaginary () const |
Returns the imaginary part of the quaternion. | |
GF_API double | GetLength () const |
Returns geometric length of this quaternion. | |
GF_API GfQuaternion | GetNormalized (double eps=GF_MIN_VECTOR_LENGTH) const |
Returns a normalized (unit-length) version of this quaternion. | |
GF_API double | Normalize (double eps=GF_MIN_VECTOR_LENGTH) |
Normalizes this quaternion in place to unit length, returning the length before normalization. | |
GF_API GfQuaternion | GetInverse () const |
Returns the inverse of this quaternion. | |
bool | operator== (const GfQuaternion &q) const |
Component-wise quaternion equality test. | |
bool | operator!= (const GfQuaternion &q) const |
Component-wise quaternion inequality test. | |
GF_API GfQuaternion & | operator*= (const GfQuaternion &q) |
Post-multiplies quaternion q into this quaternion. | |
GF_API GfQuaternion & | operator*= (double s) |
Scales this quaternion by s . | |
GfQuaternion & | operator/= (double s) |
Scales this quaternion by 1 / s . | |
GfQuaternion & | operator+= (const GfQuaternion &q) |
Component-wise unary sum operator. | |
GfQuaternion & | operator-= (const GfQuaternion &q) |
Component-wise unary difference operator. | |
Static Public Member Functions | |
static GfQuaternion | GetZero () |
Returns the zero quaternion, which has a real part of 0 and an imaginary part of (0,0,0). | |
static GfQuaternion | GetIdentity () |
Returns the identity quaternion, which has a real part of 1 and an imaginary part of (0,0,0). | |
Friends | |
size_t | hash_value (const GfQuaternion &q) |
Hash. | |
GfQuaternion | operator+ (const GfQuaternion &q1, const GfQuaternion &q2) |
Component-wise binary sum operator. | |
GfQuaternion | operator- (const GfQuaternion &q1, const GfQuaternion &q2) |
Component-wise binary difference operator. | |
GfQuaternion | operator* (const GfQuaternion &q1, const GfQuaternion &q2) |
Returns the product of quaternions q1 and q2 . | |
GfQuaternion | operator* (const GfQuaternion &q, double s) |
Returns the product of quaternion q and scalar s . | |
GfQuaternion | operator* (double s, const GfQuaternion &q) |
Returns the product of quaternion q and scalar s . | |
GfQuaternion | operator/ (const GfQuaternion &q, double s) |
Returns the product of quaternion q and scalar 1 / s . | |
GF_API friend GfQuaternion | GfSlerp (double alpha, const GfQuaternion &q0, const GfQuaternion &q1) |
Spherically interpolate between q0 and q1 . | |
GF_API GfQuaternion | GfSlerp (const GfQuaternion &q0, const GfQuaternion &q1, double alpha) |
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.
|
inline |
The default constructor leaves the quaternion undefined.
Definition at line 54 of file quaternion.h.
|
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.
|
inline |
This constructor initializes the real and imaginary parts.
Definition at line 69 of file quaternion.h.
|
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.
|
inline |
Returns the imaginary part of the quaternion.
Definition at line 89 of file quaternion.h.
GF_API GfQuaternion GetInverse | ( | ) | const |
Returns the inverse of this quaternion.
GF_API double GetLength | ( | ) | const |
Returns geometric length of this quaternion.
GF_API 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.
|
inline |
Returns the real part of the quaternion.
Definition at line 84 of file quaternion.h.
|
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 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.
|
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 & operator*= | ( | const GfQuaternion & | q | ) |
Post-multiplies quaternion q
into this quaternion.
GF_API GfQuaternion & operator*= | ( | double | s | ) |
Scales this quaternion by s
.
|
inline |
Component-wise unary sum operator.
Definition at line 157 of file quaternion.h.
|
inline |
Component-wise unary difference operator.
Definition at line 164 of file quaternion.h.
|
inline |
Scales this quaternion by 1 / s
.
Definition at line 152 of file quaternion.h.
|
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.
|
inline |
Sets the imaginary part of the quaternion.
Definition at line 79 of file quaternion.h.
|
inline |
Sets the real part of the quaternion.
Definition at line 74 of file quaternion.h.
|
friend |
Spherically interpolate between q0
and q1
.
If the interpolant alpha
is zero, then the result is q0
, while alpha
of one yields q1
.
|
friend |
Hash.
Definition at line 126 of file quaternion.h.
|
friend |
Returns the product of quaternion q
and scalar s
.
Definition at line 192 of file quaternion.h.
|
friend |
Returns the product of quaternions q1
and q2
.
Definition at line 185 of file quaternion.h.
|
friend |
Returns the product of quaternion q
and scalar s
.
Definition at line 198 of file quaternion.h.
|
friend |
Component-wise binary sum operator.
Definition at line 171 of file quaternion.h.
|
friend |
Component-wise binary difference operator.
Definition at line 178 of file quaternion.h.
|
friend |
Returns the product of quaternion q
and scalar 1 / s
.
Definition at line 204 of file quaternion.h.