28 #ifndef PXR_BASE_GF_QUATH_H 29 #define PXR_BASE_GF_QUATH_H 35 #include "pxr/base/gf/api.h" 38 #include "pxr/base/gf/traits.h" 44 PXR_NAMESPACE_OPEN_SCOPE
80 : _imaginary(i, j, k), _real(real)
86 : _imaginary(imaginary), _real(real)
116 _imaginary = imaginary;
121 _imaginary.
Set(i, j, k);
184 return !(*
this == q);
208 _imaginary += q._imaginary;
215 _imaginary -= q._imaginary;
264 _GetLengthSquared()
const {
265 return GfDot(*
this, *
this);
289 PXR_NAMESPACE_CLOSE_SCOPE
291 #endif // PXR_BASE_GF_QUATH_H Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients,...
GF_API GfHalf Normalize(GfHalf eps=GF_MIN_VECTOR_LENGTH)
Normalizes this quaternion in place to unit length, returning the length before normalization.
friend GfQuath operator+(const GfQuath &q1, const GfQuath &q2)
Component-wise binary sum operator.
bool operator==(const GfQuath &q) const
Component-wise quaternion equality test.
GfQuath & operator/=(GfHalf s)
Divide this quaternion's coefficients by s.
pxr_half::half GfHalf
A 16-bit floating point data type.
void SetReal(GfHalf real)
Set the real coefficient.
This header serves to simply bring in the half float datatype and provide a hash_value function.
void SetImaginary(GfHalf i, GfHalf j, GfHalf k)
Set the imaginary coefficients.
GfQuath & operator *=(GfHalf s)
Multiply this quaternion's coefficients by s.
friend GfQuath operator *(const GfQuath &q, GfHalf s)
Returns the product of quaternion q and scalar s.
Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients,...
GF_API GfVec3h Transform(const GfVec3h &point) const
Transform the GfVec3h point.
GfQuath & operator+=(const GfQuath &q)
Add quaternion q to this quaternion.
GfQuath(GfHalf real, GfHalf i, GfHalf j, GfHalf k)
Initialize the real and imaginary coefficients.
GF_API std::ostream & operator<<(std::ostream &, GfQuath const &)
Output a GfQuatd using the format (re, i, j, k)
static GfQuath GetIdentity()
Return the identity quaternion, with real coefficient 1 and an imaginary coefficients all zero.
GfQuath GetInverse() const
Return this quaternion's inverse, or reciprocal.
GfQuath operator-() const
Component-wise negation.
static size_t Combine(Args &&... args)
Produce a hash code by combining the hash codes of several objects.
GfHalf GetReal() const
Return the real coefficient.
GfQuath()
Default constructor leaves the quaternion undefined.
GfQuath(GfHalf real, const GfVec3h &imaginary)
Initialize the real and imaginary coefficients.
GfQuath(GfHalf realVal)
Initialize the real coefficient to realVal and the imaginary coefficients to zero.
friend size_t hash_value(const GfQuath &q)
Hash.
friend GfQuath operator/(const GfQuath &q, GfHalf s)
Returns the product of quaternion q and scalar 1 / s.
static GfQuath GetZero()
Return the zero quaternion, with real coefficient 0 and an imaginary coefficients all zero.
double GfSqrt(double f)
Return sqrt(f).
GfQuath GetConjugate() const
Return this quaternion's conjugate, which is the quaternion with the same real coefficient and negate...
GfVec3h & Set(GfHalf s0, GfHalf s1, GfHalf s2)
Set all elements with passed arguments.
GfHalf GetLength() const
Return geometric length of this quaternion.
friend GfQuath operator *(GfHalf s, const GfQuath &q)
Returns the product of quaternion q and scalar s.
friend GfQuath operator *(const GfQuath &q1, const GfQuath &q2)
Returns the product of quaternions q1 and q2.
const GfVec3h & GetImaginary() const
Return the imaginary coefficient.
GfQuath & operator -=(const GfQuath &q)
Component-wise unary difference operator.
bool operator!=(const GfQuath &q) const
Component-wise quaternion inequality test.
A metafunction with a static const bool member 'value' that is true for GfQuat types and false for al...
GfQuath GetNormalized(GfHalf eps=GF_MIN_VECTOR_LENGTH) const
length of this quaternion is smaller than eps, return the identity quaternion.
GF_API GfQuath & operator *=(const GfQuath &q)
Post-multiply quaternion q into this quaternion.
GfHalf GfDot(const GfQuath &q1, const GfQuath &q2)
Return the dot (inner) product of two quaternions.
GF_API GfQuath GfSlerp(double alpha, const GfQuath &q0, const GfQuath &q1)
Spherically linearly interpolate between q0 and q1.
friend GfQuath operator -(const GfQuath &q1, const GfQuath &q2)
Component-wise binary difference operator.
void SetImaginary(const GfVec3h &imaginary)
Set the imaginary coefficients.
Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients,...
Basic type for a vector of 3 GfHalf components.
#define GF_MIN_VECTOR_LENGTH
This constant is used to determine whether the length of a vector is too small to handle accurately.