11#ifndef PXR_BASE_GF_QUATD_H
12#define PXR_BASE_GF_QUATD_H
18#include "pxr/base/gf/api.h"
21#include "pxr/base/gf/traits.h"
26PXR_NAMESPACE_OPEN_SCOPE
45 typedef double ScalarType;
58 explicit GfQuatd (
double realVal) : _imaginary(0), _real(realVal) {}
61 GfQuatd(
double real,
double i,
double j,
double k)
62 : _imaginary(i, j, k), _real(real)
68 : _imaginary(imaginary), _real(real)
91 void SetReal(
double real) { _real = real; }
98 _imaginary = imaginary;
103 _imaginary.
Set(i, j, k);
166 return !(*
this == q);
190 _imaginary += q._imaginary;
197 _imaginary -= q._imaginary;
246 _GetLengthSquared()
const {
247 return GfDot(*
this, *
this);
271PXR_NAMESPACE_CLOSE_SCOPE
Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients,...
static GfQuatd GetIdentity()
Return the identity quaternion, with real coefficient 1 and an imaginary coefficients all zero.
GfQuatd & operator/=(double s)
Divide this quaternion's coefficients by s.
GfQuatd & operator+=(const GfQuatd &q)
Add quaternion q to this quaternion.
GF_API GfQuatd(class GfQuath const &other)
Implicitly convert from GfQuath.
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 GetNormalized(double eps=GF_MIN_VECTOR_LENGTH) const
length of this quaternion is smaller than eps, return the identity quaternion.
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 & operator-=(const GfQuatd &q)
Component-wise unary difference operator.
friend GfQuatd operator*(const GfQuatd &q1, const GfQuatd &q2)
Returns the product of quaternions q1 and q2.
const GfVec3d & GetImaginary() const
Return the imaginary coefficient.
GF_API double Normalize(double eps=GF_MIN_VECTOR_LENGTH)
Normalizes this quaternion in place to unit length, returning the length before normalization.
GfQuatd operator-() const
Component-wise negation.
double GetReal() const
Return the real coefficient.
GfQuatd GetInverse() const
Return this quaternion's inverse, or reciprocal.
bool operator==(const GfQuatd &q) const
Component-wise quaternion equality test.
GfQuatd GetConjugate() const
Return this quaternion's conjugate, which is the quaternion with the same real coefficient and negate...
GF_API GfQuatd & operator*=(const GfQuatd &q)
Post-multiply quaternion q into this quaternion.
void SetImaginary(const GfVec3d &imaginary)
Set the imaginary coefficients.
static GfQuatd GetZero()
Return the zero quaternion, with real coefficient 0 and an imaginary coefficients all zero.
bool operator!=(const GfQuatd &q) const
Component-wise quaternion inequality test.
GF_API GfQuatd(class GfQuatf const &other)
Implicitly convert from GfQuatf.
friend GfQuatd operator/(const GfQuatd &q, double s)
Returns the product of quaternion q and scalar 1 / s.
void SetImaginary(double i, double j, double k)
Set the imaginary coefficients.
friend size_t hash_value(const GfQuatd &q)
Hash.
GfQuatd()
Default constructor leaves the quaternion undefined.
double GetLength() const
Return geometric length of this quaternion.
void SetReal(double real)
Set the real coefficient.
friend GfQuatd operator+(const GfQuatd &q1, const GfQuatd &q2)
Component-wise binary sum operator.
Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients,...
Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients,...
Basic type for a vector of 3 double components.
GfVec3d & Set(double s0, double s1, double s2)
Set all elements with passed arguments.
static size_t Combine(Args &&... args)
Produce a hash code by combining the hash codes of several objects.
double GfSqrt(double f)
Return sqrt(f).
#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].
GF_API GfQuatd GfSlerp(double alpha, const GfQuatd &q0, const GfQuatd &q1)
Spherically linearly interpolate between q0 and q1.
double GfDot(const GfQuatd &q1, const GfQuatd &q2)
Return the dot (inner) product of two quaternions.
A metafunction with a static const bool member 'value' that is true for GfQuat types and false for al...