11#ifndef PXR_BASE_GF_QUATH_H
12#define PXR_BASE_GF_QUATH_H
18#include "pxr/base/gf/api.h"
21#include "pxr/base/gf/traits.h"
27PXR_NAMESPACE_OPEN_SCOPE
63 : _imaginary(i, j, k), _real(real)
69 : _imaginary(imaginary), _real(real)
99 _imaginary = imaginary;
104 _imaginary.
Set(i, j, k);
167 return !(*
this == q);
191 _imaginary += q._imaginary;
198 _imaginary -= q._imaginary;
247 _GetLengthSquared()
const {
248 return GfDot(*
this, *
this);
272PXR_NAMESPACE_CLOSE_SCOPE
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: a quaternion, a complex number with a real coefficient and three imaginary coefficients,...
GfQuath(GfHalf real, GfHalf i, GfHalf j, GfHalf k)
Initialize the real and imaginary coefficients.
void SetImaginary(const GfVec3h &imaginary)
Set the imaginary coefficients.
GfQuath operator-() const
Component-wise negation.
friend size_t hash_value(const GfQuath &q)
Hash.
GfHalf GetReal() const
Return the real coefficient.
friend GfQuath operator/(const GfQuath &q, GfHalf s)
Returns the product of quaternion q and scalar 1 / s.
GF_API GfHalf Normalize(GfHalf eps=GF_MIN_VECTOR_LENGTH)
Normalizes this quaternion in place to unit length, returning the length before normalization.
GfHalf GetLength() const
Return geometric length of this quaternion.
GfQuath GetInverse() const
Return this quaternion's inverse, or reciprocal.
friend GfQuath operator+(const GfQuath &q1, const GfQuath &q2)
Component-wise binary sum operator.
GfQuath()
Default constructor leaves the quaternion undefined.
GfQuath & operator+=(const GfQuath &q)
Add quaternion q to this quaternion.
GfQuath GetConjugate() const
Return this quaternion's conjugate, which is the quaternion with the same real coefficient and negate...
void SetReal(GfHalf real)
Set the real coefficient.
friend GfQuath operator*(const GfQuath &q1, const GfQuath &q2)
Returns the product of quaternions q1 and q2.
GF_API GfQuath & operator*=(const GfQuath &q)
Post-multiply quaternion q into this quaternion.
bool operator==(const GfQuath &q) const
Component-wise quaternion equality test.
GfQuath & operator/=(GfHalf s)
Divide this quaternion's coefficients by s.
GF_API GfQuath(class GfQuatd const &other)
Construct from GfQuatd.
const GfVec3h & GetImaginary() const
Return the imaginary coefficient.
GfQuath GetNormalized(GfHalf eps=GF_MIN_VECTOR_LENGTH) const
length of this quaternion is smaller than eps, return the identity quaternion.
bool operator!=(const GfQuath &q) const
Component-wise quaternion inequality test.
GF_API GfVec3h Transform(const GfVec3h &point) const
Transform the GfVec3h point.
GF_API GfQuath(class GfQuatf const &other)
Construct from GfQuatf.
GfQuath(GfHalf real, const GfVec3h &imaginary)
Initialize the real and imaginary coefficients.
void SetImaginary(GfHalf i, GfHalf j, GfHalf k)
Set the imaginary coefficients.
static GfQuath GetZero()
Return the zero quaternion, with real coefficient 0 and an imaginary coefficients all zero.
GfQuath(GfHalf realVal)
Initialize the real coefficient to realVal and the imaginary coefficients to zero.
GfQuath & operator-=(const GfQuath &q)
Component-wise unary difference operator.
static GfQuath GetIdentity()
Return the identity quaternion, with real coefficient 1 and an imaginary coefficients all zero.
Basic type for a vector of 3 GfHalf components.
GfVec3h & Set(GfHalf s0, GfHalf s1, GfHalf 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].
This header serves to simply bring in the half float datatype and provide a hash_value function.
pxr_half::half GfHalf
A 16-bit floating point data type.
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.
A metafunction with a static const bool member 'value' that is true for GfQuat types and false for al...