7#ifndef PXR_BASE_GF_QUATERNION_H
8#define PXR_BASE_GF_QUATERNION_H
14#include "pxr/base/gf/api.h"
20PXR_NAMESPACE_OPEN_SCOPE
47 : _real(realVal), _imaginary(0)
53 : _real(real), _imaginary(imaginary) {
63 _imaginary = imaginary;
123 return ! (*
this == q);
136 return (*
this) *= 1.0 / s;
142 _imaginary += q._imaginary;
149 _imaginary -= q._imaginary;
214 double _GetLengthSquared()
const {
215 return (_real * _real +
GfDot(_imaginary, _imaginary));
234PXR_NAMESPACE_CLOSE_SCOPE
Basic type: complex number with scalar real part and vector imaginary part.
static GfQuaternion GetZero()
Returns the zero quaternion, which has a real part of 0 and an imaginary part of (0,...
GfQuaternion(int realVal)
This constructor initializes the real part to the argument and the imaginary parts to zero.
GfQuaternion & operator/=(double s)
Scales this quaternion by 1 / s.
friend GfQuaternion operator-(const GfQuaternion &q1, const GfQuaternion &q2)
Component-wise binary difference operator.
GfQuaternion(double real, const GfVec3d &imaginary)
This constructor initializes the real and imaginary parts.
friend size_t hash_value(const GfQuaternion &q)
Hash.
const GfVec3d & GetImaginary() const
Returns the imaginary part of the quaternion.
GF_API double Normalize(double eps=GF_MIN_VECTOR_LENGTH)
Normalizes this quaternion in place to unit length, returning the length before normalization.
static GfQuaternion GetIdentity()
Returns the identity quaternion, which has a real part of 1 and an imaginary part of (0,...
bool operator!=(const GfQuaternion &q) const
Component-wise quaternion inequality test.
double GetReal() const
Returns the real part of the quaternion.
bool operator==(const GfQuaternion &q) const
Component-wise quaternion equality test.
GfQuaternion & operator-=(const GfQuaternion &q)
Component-wise unary difference operator.
GF_API GfQuaternion & operator*=(const GfQuaternion &q)
Post-multiplies quaternion q into this quaternion.
friend GfQuaternion operator*(const GfQuaternion &q1, const GfQuaternion &q2)
Returns the product of quaternions q1 and q2.
void SetImaginary(const GfVec3d &imaginary)
Sets the imaginary part of the quaternion.
GfQuaternion()
The default constructor leaves the quaternion undefined.
GfQuaternion & operator+=(const GfQuaternion &q)
Component-wise unary sum operator.
friend 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.
friend GfQuaternion operator+(const GfQuaternion &q1, const GfQuaternion &q2)
Component-wise binary sum operator.
GF_API double GetLength() const
Returns geometric length of this quaternion.
void SetReal(double real)
Sets the real part of the quaternion.
GF_API GfQuaternion GetNormalized(double eps=GF_MIN_VECTOR_LENGTH) const
Returns a normalized (unit-length) version of this quaternion.
GF_API GfQuaternion GetInverse() const
Returns the inverse of this quaternion.
Basic type for a vector of 3 double components.
static size_t Combine(Args &&... args)
Produce a hash code by combining the hash codes of several objects.
#define GF_MIN_VECTOR_LENGTH
This constant is used to determine whether the length of a vector is too small to handle accurately.
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
double GfDot(const GfQuaternion &q1, const GfQuaternion &q2)
Returns the dot (inner) product of two quaternions.
GF_API GfQuaternion GfSlerp(double alpha, const GfQuaternion &q0, const GfQuaternion &q1)