24 #ifndef PXR_BASE_GF_QUATERNION_H
25 #define PXR_BASE_GF_QUATERNION_H
34 #include <hboost/functional/hash.hpp>
65 : _real(realVal), _imaginary(0)
71 : _real(real), _imaginary(imaginary) {
81 _imaginary = imaginary;
123 hboost::hash_combine(h, q.
GetReal());
138 return ! (*
this ==
q);
151 return (*
this) *= 1.0 /
s;
157 _imaginary += q._imaginary;
164 _imaginary -= q._imaginary;
229 double _GetLengthSquared()
const {
230 return (_real * _real +
GfDot(_imaginary, _imaginary));
244 #endif // PXR_BASE_GF_QUATERNION_H
GfQuaternion & operator/=(double s)
Scales this quaternion by 1 / s.
GF_API GfQuaternion & operator*=(const GfQuaternion &q)
Post-multiplies quaternion q into this quaternion.
void SetReal(double real)
Sets the real part of the quaternion.
friend size_t hash_value(const GfQuaternion &q)
Hash.
GF_API GfQuaternion GfSlerp(double alpha, const GfQuaternion &q0, const GfQuaternion &q1)
GF_API GfQuaternion GetNormalized(double eps=GF_MIN_VECTOR_LENGTH) const
GfQuaternion()
The default constructor leaves the quaternion undefined.
friend GfQuaternion operator+(const GfQuaternion &q1, const GfQuaternion &q2)
Component-wise binary sum operator.
GF_API friend GfQuaternion GfSlerp(double alpha, const GfQuaternion &q0, const GfQuaternion &q1)
double GetReal() const
Returns the real part of the quaternion.
bool operator==(const GfQuaternion &q) const
GF_API GfQuaternion GetInverse() const
Returns the inverse of this quaternion.
GfQuaternion & operator+=(const GfQuaternion &q)
Component-wise unary sum operator.
GF_API std::ostream & operator<<(std::ostream &out, const GfQuaternion &q)
GLdouble GLdouble GLdouble GLdouble q
friend GfQuaternion operator*(const GfQuaternion &q1, const GfQuaternion &q2)
Returns the product of quaternions q1 and q2.
GfQuaternion(int realVal)
void SetImaginary(const GfVec3d &imaginary)
Sets the imaginary part of the quaternion.
friend GfQuaternion operator/(const GfQuaternion &q, double s)
Returns the product of quaternion q and scalar 1 / s.
GfQuaternion(double real, const GfVec3d &imaginary)
This constructor initializes the real and imaginary parts.
friend GfQuaternion operator-(const GfQuaternion &q1, const GfQuaternion &q2)
Component-wise binary difference operator.
GLfloat GLfloat GLfloat GLfloat h
GF_API double Normalize(double eps=GF_MIN_VECTOR_LENGTH)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
decltype(std::declval< Left >()*std::declval< Right >()) GfDot(Left left, Right right)
static GfQuaternion GetIdentity()
#define PXR_NAMESPACE_CLOSE_SCOPE
bool operator!=(const GfQuaternion &q) const
GfQuaternion & operator-=(const GfQuaternion &q)
Component-wise unary difference operator.
GLfloat GLfloat GLfloat alpha
const GfVec3d & GetImaginary() const
Returns the imaginary part of the quaternion.
#define GF_MIN_VECTOR_LENGTH
GF_API double GetLength() const
Returns geometric length of this quaternion.