This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GfQuatd Class Reference

Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients, stored as a 3-vector. More...

#include <quatd.h>

Public Types

typedef double ScalarType
 
typedef GfVec3d ImaginaryType
 

Public Member Functions

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

Static Public Member Functions

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

Friends

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

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 42 of file quatd.h.

Member Typedef Documentation

◆ ImaginaryType

Definition at line 46 of file quatd.h.

◆ ScalarType

typedef double ScalarType

Definition at line 45 of file quatd.h.

Constructor & Destructor Documentation

◆ GfQuatd() [1/6]

GfQuatd ( )
inline

Default constructor leaves the quaternion undefined.

Definition at line 49 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 58 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 61 of file quatd.h.

◆ GfQuatd() [4/6]

GfQuatd ( double  real,
const GfVec3d imaginary 
)
inline

Initialize the real and imaginary coefficients.

Definition at line 67 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 126 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 85 of file quatd.h.

◆ GetImaginary()

const GfVec3d & GetImaginary ( ) const
inline

Return the imaginary coefficient.

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

◆ GetLength()

double GetLength ( ) const
inline

Return geometric length of this quaternion.

Definition at line 107 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 112 of file quatd.h.

◆ GetReal()

double GetReal ( ) const
inline

Return the real coefficient.

Definition at line 88 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 81 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!=()

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 165 of file quatd.h.

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

◆ operator+=()

GfQuatd & operator+= ( const GfQuatd q)
inline

Add quaternion q to this quaternion.

Definition at line 188 of file quatd.h.

◆ operator-()

GfQuatd operator- ( ) const
inline

Component-wise negation.

Definition at line 152 of file quatd.h.

◆ operator-=()

GfQuatd & operator-= ( const GfQuatd q)
inline

Component-wise unary difference operator.

Definition at line 195 of file quatd.h.

◆ operator/=()

GfQuatd & operator/= ( double  s)
inline

Divide this quaternion's coefficients by s.

Definition at line 181 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 158 of file quatd.h.

◆ SetImaginary() [1/2]

void SetImaginary ( const GfVec3d imaginary)
inline

Set the imaginary coefficients.

Definition at line 97 of file quatd.h.

◆ SetImaginary() [2/2]

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

Set the imaginary coefficients.

Definition at line 102 of file quatd.h.

◆ SetReal()

void SetReal ( double  real)
inline

Set the real coefficient.

Definition at line 91 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 147 of file quatd.h.

◆ operator* [1/3]

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

Returns the product of quaternion q and scalar s.

Definition at line 221 of file quatd.h.

◆ operator* [2/3]

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

Returns the product of quaternions q1 and q2.

Definition at line 215 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 227 of file quatd.h.

◆ operator+

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

Component-wise binary sum operator.

Definition at line 203 of file quatd.h.

◆ operator-

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

Component-wise binary difference operator.

Definition at line 209 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 233 of file quatd.h.


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