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"
41 #include <boost/functional/hash.hpp>
45 PXR_NAMESPACE_OPEN_SCOPE
81 : _imaginary(i, j, k), _real(real)
87 : _imaginary(imaginary), _real(real)
113 _imaginary = imaginary;
118 _imaginary.
Set(i, j, k);
163 size_t h = boost::hash<ScalarType>()(q.
GetReal());
183 return !(*
this == q);
207 _imaginary += q._imaginary;
214 _imaginary -= q._imaginary;
263 _GetLengthSquared()
const {
264 return GfDot(*
this, *
this);
288 PXR_NAMESPACE_CLOSE_SCOPE
290 #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.
GfQuath operator-() const
Component-wise negation.
GfQuath & operator/=(GfHalf s)
Divide this quaternion's coefficients by s.
GfQuath GetInverse() const
Return this quaternion's inverse, or reciprocal.
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...
GfHalf GetReal() const
Return the real coefficient.
void SetImaginary(GfHalf i, GfHalf j, GfHalf k)
Set the imaginary coefficients.
bool operator==(const GfQuath &q) const
Component-wise quaternion equality test.
friend GfQuath operator*(const GfQuath &q1, const GfQuath &q2)
Returns the product of quaternions q1 and q2.
Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients...
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 GfQuatd GfSlerp(double alpha, const GfQuatd &q0, const GfQuatd &q1)
Spherically linearly interpolate between q0 and q1.
static GfQuath GetIdentity()
Return the identity quaternion, with real coefficient 1 and an imaginary coefficients all zero...
GfHalf GetLength() const
Return geometric length of this quaternion.
GF_API GfVec3h Transform(const GfVec3h &point) const
Transform the GfVec3h point.
GfQuath GetNormalized(GfHalf eps=GF_MIN_VECTOR_LENGTH) const
length of this quaternion is smaller than eps, return the identity quaternion.
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.
decltype(std::declval< Left >()*std::declval< Right >()) GfDot(Left left, Right right)
Returns the dot (inner) product of two vectors.
friend GfQuath operator/(const GfQuath &q, GfHalf s)
Returns the product of quaternion q and scalar 1 / s.
bool operator!=(const GfQuath &q) const
Component-wise quaternion inequality test.
const GfVec3h & GetImaginary() const
Return the imaginary coefficient.
double GfSqrt(double f)
Return sqrt(f).
GfVec3h & Set(GfHalf s0, GfHalf s1, GfHalf s2)
Set all elements with passed arguments.
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
GfQuath & operator-=(const GfQuath &q)
Component-wise unary difference operator.
A metafunction with a static const bool member 'value' that is true for GfQuat types and false for al...
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.
GF_API GfQuath & operator*=(const GfQuath &q)
Post-multiply quaternion q into this quaternion.
GfQuath GetConjugate() const
Return this quaternion's conjugate, which is the quaternion with the same real coefficient and negate...
#define GF_MIN_VECTOR_LENGTH
This constant is used to determine whether the length of a vector is too small to handle accurately...