GfQuatd 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 double ScalarType
 
typedef GfVec3d ImaginaryType
 

Public Member Functions

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

Static Public Member Functions

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

Friends

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

Constructor & Destructor Documentation

◆ GfQuatd() [1/6]

GfQuatd ( )
inline

Default constructor leaves the quaternion undefined.

Definition at line 67 of file quatd.h.

◆ GfQuatd() [2/6]

GfQuatd ( double  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 quatd.h.

◆ GfQuatd() [3/6]

GfQuatd ( double  real,
double  i,
double  j,
double  k 
)
inline

Initialize the real and imaginary coefficients.

Definition at line 79 of file quatd.h.

◆ GfQuatd() [4/6]

GfQuatd ( double  real,
const GfVec3d imaginary 
)
inline

Initialize the real and imaginary coefficients.

Definition at line 85 of file quatd.h.

◆ GfQuatd() [5/6]

GF_API GfQuatd ( class GfQuatf const &  other)

Implicitly convert from GfQuatf.

◆ GfQuatd() [6/6]

GF_API GfQuatd ( class GfQuath const &  other)

Implicitly convert from GfQuath.

Member Function Documentation

◆ GetConjugate()

GfQuatd 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 quatd.h.

◆ GetIdentity()

static GfQuatd GetIdentity ( )
inlinestatic

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

Definition at line 103 of file quatd.h.

◆ GetImaginary()

const GfVec3d& GetImaginary ( ) const
inline

Return the imaginary coefficient.

Definition at line 112 of file quatd.h.

◆ GetInverse()

GfQuatd 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 quatd.h.

◆ GetLength()

double GetLength ( ) const
inline

Return geometric length of this quaternion.

Definition at line 125 of file quatd.h.

◆ GetNormalized()

GfQuatd GetNormalized ( double  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 quatd.h.

◆ GetReal()

double GetReal ( ) const
inline

Return the real coefficient.

Definition at line 106 of file quatd.h.

◆ GetZero()

static GfQuatd GetZero ( )
inlinestatic

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

Definition at line 99 of file quatd.h.

◆ Normalize()

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.

◆ operator *=() [1/2]

GF_API GfQuatd& operator *= ( const GfQuatd q)

Post-multiply quaternion q into this quaternion.

◆ operator *=() [2/2]

GfQuatd& operator *= ( double  s)
inline

Multiply this quaternion's coefficients by s.

Definition at line 194 of file quatd.h.

◆ operator -=()

GfQuatd& operator -= ( const GfQuatd q)
inline

Component-wise unary difference operator.

Definition at line 215 of file quatd.h.

◆ operator!=()

bool operator!= ( const GfQuatd 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 quatd.h.

◆ operator+=()

GfQuatd& operator+= ( const GfQuatd q)
inline

Add quaternion q to this quaternion.

Definition at line 208 of file quatd.h.

◆ operator-()

GfQuatd operator- ( ) const
inline

Component-wise negation.

Definition at line 172 of file quatd.h.

◆ operator/=()

GfQuatd& operator/= ( double  s)
inline

Divide this quaternion's coefficients by s.

Definition at line 201 of file quatd.h.

◆ operator==()

bool operator== ( const GfQuatd 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 quatd.h.

◆ SetImaginary() [1/2]

void SetImaginary ( const GfVec3d imaginary)
inline

Set the imaginary coefficients.

Definition at line 115 of file quatd.h.

◆ SetImaginary() [2/2]

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

Set the imaginary coefficients.

Definition at line 120 of file quatd.h.

◆ SetReal()

void SetReal ( double  real)
inline

Set the real coefficient.

Definition at line 109 of file quatd.h.

◆ Transform()

GF_API GfVec3d Transform ( const GfVec3d point) const

Transform the GfVec3d point.

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

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

but is more efficient.

Friends And Related Function Documentation

◆ hash_value

size_t hash_value ( const GfQuatd q)
friend

Hash.

Definition at line 165 of file quatd.h.

◆ operator * [1/3]

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

Returns the product of quaternions q1 and q2.

Definition at line 235 of file quatd.h.

◆ operator * [2/3]

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

Returns the product of quaternion q and scalar s.

Definition at line 241 of file quatd.h.

◆ operator * [3/3]

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

Returns the product of quaternion q and scalar s.

Definition at line 247 of file quatd.h.

◆ operator -

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

Component-wise binary difference operator.

Definition at line 229 of file quatd.h.

◆ operator+

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

Component-wise binary sum operator.

Definition at line 223 of file quatd.h.

◆ operator/

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

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

Definition at line 253 of file quatd.h.


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