28 #ifndef PXR_BASE_GF_QUATD_H
29 #define PXR_BASE_GF_QUATD_H
35 #include "pxr/base/gf/api.h"
38 #include "pxr/base/gf/traits.h"
40 #include <boost/functional/hash.hpp>
44 PXR_NAMESPACE_OPEN_SCOPE
63 typedef double ScalarType;
76 explicit GfQuatd (
double realVal) : _imaginary(0), _real(realVal) {}
79 GfQuatd(
double real,
double i,
double j,
double k)
80 : _imaginary(i, j, k), _real(real)
86 : _imaginary(imaginary), _real(real)
112 _imaginary = imaginary;
117 _imaginary.
Set(i, j, k);
162 size_t h = boost::hash<ScalarType>()(q.
GetReal());
182 return !(*
this == q);
206 _imaginary += q._imaginary;
213 _imaginary -= q._imaginary;
262 _GetLengthSquared()
const {
263 return GfDot(*
this, *
this);
287 PXR_NAMESPACE_CLOSE_SCOPE
289 #endif // PXR_BASE_GF_QUATD_H
GfQuatd()
Default constructor leaves the quaternion undefined.
Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients...
void SetImaginary(double i, double j, double k)
Set the imaginary coefficients.
double GetReal() const
Return the real coefficient.
GfQuatd GetConjugate() const
Return this quaternion's conjugate, which is the quaternion with the same real coefficient and negate...
bool operator==(const GfQuatd &q) const
Component-wise quaternion equality test.
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.
const GfVec3d & GetImaginary() const
Return the imaginary coefficient.
GF_API GfQuatd & operator*=(const GfQuatd &q)
Post-multiply quaternion q into this quaternion.
void SetImaginary(const GfVec3d &imaginary)
Set the imaginary coefficients.
Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients...
GF_API GfQuatd GfSlerp(double alpha, const GfQuatd &q0, const GfQuatd &q1)
Spherically linearly interpolate between q0 and q1.
double GetLength() const
Return geometric length of this quaternion.
GfVec3d & Set(double s0, double s1, double s2)
Set all elements with passed arguments.
static GfQuatd GetIdentity()
Return the identity quaternion, with real coefficient 1 and an imaginary coefficients all zero...
decltype(std::declval< Left >()*std::declval< Right >()) GfDot(Left left, Right right)
Returns the dot (inner) product of two vectors.
GfQuatd & operator+=(const GfQuatd &q)
Add quaternion q to this quaternion.
GfQuatd & operator-=(const GfQuatd &q)
Component-wise unary difference operator.
void SetReal(double real)
Set the real coefficient.
double GfSqrt(double f)
Return sqrt(f).
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
bool operator!=(const GfQuatd &q) const
Component-wise quaternion inequality test.
GfQuatd GetInverse() const
Return this quaternion's inverse, or reciprocal.
A metafunction with a static const bool member 'value' that is true for GfQuat types and false for al...
friend GfQuatd operator+(const GfQuatd &q1, const GfQuatd &q2)
Component-wise binary sum operator.
Basic type for a vector of 3 double components.
friend size_t hash_value(const GfQuatd &q)
Hash.
friend GfQuatd operator*(const GfQuatd &q1, const GfQuatd &q2)
Returns the product of quaternions q1 and q2.
GfQuatd operator-() const
Component-wise negation.
Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients...
GfQuatd(double real, const GfVec3d &imaginary)
Initialize the real and imaginary coefficients.
GF_API GfVec3d Transform(const GfVec3d &point) const
Transform the GfVec3d point.
GfQuatd(double realVal)
Initialize the real coefficient to realVal and the imaginary coefficients to zero.
GfQuatd & operator/=(double s)
Divide this quaternion's coefficients by s.
friend GfQuatd operator/(const GfQuatd &q, double s)
Returns the product of quaternion q and scalar 1 / s.
GfQuatd(double real, double i, double j, double k)
Initialize the real and imaginary coefficients.
#define GF_MIN_VECTOR_LENGTH
This constant is used to determine whether the length of a vector is too small to handle accurately...