28#ifndef PXR_BASE_GF_QUATF_H
29#define PXR_BASE_GF_QUATF_H
35#include "pxr/base/gf/api.h"
38#include "pxr/base/gf/traits.h"
43PXR_NAMESPACE_OPEN_SCOPE
62 typedef float ScalarType;
75 explicit GfQuatf (
float realVal) : _imaginary(0), _real(realVal) {}
78 GfQuatf(
float real,
float i,
float j,
float k)
79 : _imaginary(i, j, k), _real(real)
85 : _imaginary(imaginary), _real(real)
115 _imaginary = imaginary;
120 _imaginary.
Set(i, j, k);
183 return !(*
this == q);
207 _imaginary += q._imaginary;
214 _imaginary -= q._imaginary;
263 _GetLengthSquared()
const {
264 return GfDot(*
this, *
this);
288PXR_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,...
GF_API GfQuatf(class GfQuatd const &other)
Construct from GfQuatd.
friend size_t hash_value(const GfQuatf &q)
Hash.
bool operator==(const GfQuatf &q) const
Component-wise quaternion equality test.
GF_API float Normalize(float eps=GF_MIN_VECTOR_LENGTH)
Normalizes this quaternion in place to unit length, returning the length before normalization.
GF_API GfQuatf & operator*=(const GfQuatf &q)
Post-multiply quaternion q into this quaternion.
GfQuatf(float realVal)
Initialize the real coefficient to realVal and the imaginary coefficients to zero.
GfQuatf & operator/=(float s)
Divide this quaternion's coefficients by s.
void SetReal(float real)
Set the real coefficient.
void SetImaginary(float i, float j, float k)
Set the imaginary coefficients.
float GetLength() const
Return geometric length of this quaternion.
float GetReal() const
Return the real coefficient.
GfQuatf(float real, float i, float j, float k)
Initialize the real and imaginary coefficients.
GfQuatf & operator-=(const GfQuatf &q)
Component-wise unary difference operator.
GF_API GfVec3f Transform(const GfVec3f &point) const
Transform the GfVec3f point.
static GfQuatf GetZero()
Return the zero quaternion, with real coefficient 0 and an imaginary coefficients all zero.
GfQuatf()
Default constructor leaves the quaternion undefined.
GfQuatf GetInverse() const
Return this quaternion's inverse, or reciprocal.
GF_API GfQuatf(class GfQuath const &other)
Implicitly convert from GfQuath.
GfQuatf GetConjugate() const
Return this quaternion's conjugate, which is the quaternion with the same real coefficient and negate...
GfQuatf GetNormalized(float eps=GF_MIN_VECTOR_LENGTH) const
length of this quaternion is smaller than eps, return the identity quaternion.
void SetImaginary(const GfVec3f &imaginary)
Set the imaginary coefficients.
friend GfQuatf operator/(const GfQuatf &q, float s)
Returns the product of quaternion q and scalar 1 / s.
friend GfQuatf operator+(const GfQuatf &q1, const GfQuatf &q2)
Component-wise binary sum operator.
friend GfQuatf operator*(const GfQuatf &q1, const GfQuatf &q2)
Returns the product of quaternions q1 and q2.
GfQuatf operator-() const
Component-wise negation.
GfQuatf & operator+=(const GfQuatf &q)
Add quaternion q to this quaternion.
bool operator!=(const GfQuatf &q) const
Component-wise quaternion inequality test.
static GfQuatf GetIdentity()
Return the identity quaternion, with real coefficient 1 and an imaginary coefficients all zero.
GfQuatf(float real, const GfVec3f &imaginary)
Initialize the real and imaginary coefficients.
const GfVec3f & GetImaginary() const
Return the imaginary coefficient.
Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients,...
Basic type for a vector of 3 float components.
GfVec3f & Set(float s0, float s1, float 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].
float GfDot(const GfQuatf &q1, const GfQuatf &q2)
Return the dot (inner) product of two quaternions.
GF_API GfQuatf GfSlerp(double alpha, const GfQuatf &q0, const GfQuatf &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...