19 #ifndef __UT_Quaternion_h__ 
   20 #define __UT_Quaternion_h__ 
   56     static constexpr 
int         tuple_size = 4;
 
   61                                      vec[0] = qx;  vec[1] = qy;
 
   62                                      vec[2] = qz;  vec[3] = qw;
 
   66                                     vec[0] = 
v[0]; vec[1] = 
v[1];
 
   67                                     vec[2] = 
v[2]; vec[3] = 
v[3];
 
   71                                     vec[0] = 
v[0]; vec[1] = 
v[1];
 
   72                                     vec[2] = 
v[2]; vec[3] = 
v[3];
 
   76                                     vec[0] = v[0]; vec[1] = v[1];
 
   77                                     vec[2] = v[2]; vec[3] = v[3];
 
   85                                      updateFromEuler(rot, order);
 
   97     { vec[0] = 
v.
x(); vec[1] = 
v.y(); vec[2] = 
v.z(); vec[3] = 
v.w(); }
 
  100     { vec[0] = v.
x(); vec[1] = v.
y(); vec[2] = v.
z(); vec[3] = v.
w(); 
return *
this; }
 
  124     void                         getRotationMatrix(
UT_Matrix3 &mat) 
const;
 
  126     void                         getInverseRotationMatrix(
UT_Matrix3 &mat) 
const;
 
  127     void                         getInverseRotationMatrix(
UT_DMatrix3 &mat) 
const;
 
  129     void                         getTransformMatrix(
UT_Matrix4 &mat) 
const;
 
  135                                              T t, 
T b = 0.0
f) 
const;
 
  144         vec[0] = 
SYSlerp(vec[0], target.vec[0], t);
 
  145         vec[1] = 
SYSlerp(vec[1], target.vec[1], t);
 
  146         vec[2] = 
SYSlerp(vec[2], target.vec[2], t);
 
  147         vec[3] = 
SYSlerp(vec[3], target.vec[3], t);
 
  154         vec[0] = 
SYSlerp(src.vec[0], dst.vec[0], t);
 
  155         vec[1] = 
SYSlerp(src.vec[1], dst.vec[1], t);
 
  156         vec[2] = 
SYSlerp(src.vec[2], dst.vec[2], t);
 
  157         vec[3] = 
SYSlerp(src.vec[3], dst.vec[3], t);
 
  163                                         vec[0] = qx;  vec[1] = qy;
 
  164                                         vec[2] = qz;  vec[3] = qw;
 
  168                                         vec[0] = vec[1] = vec[2] = 0.0f;
 
  186                                         return  vec[0] * vec[0] +
 
  203                                         return SYSsqrt(normal());
 
  233     void                         updateFromArbitraryMatrix(
const UT_Matrix3 &);
 
  234     void                         updateFromArbitraryMatrix(
const UT_Matrix3D &);
 
  240     void                         updateFromRotationMatrix(
const UT_Matrix3 &);
 
  241     void                         updateFromRotationMatrix(
const UT_Matrix3D &);
 
  244     void                         updateFromAngleAxis(
T angle, 
 
  248     void                         getAngleAxis(
T &
angle,
 
  276                                            bool accurate = 
true);
 
  296     void                        multAngle( 
T s );
 
  300     void                        swingTwistDecompose(
 
  304                                     const bool reverse = 
false) 
const;
 
  306     T                           &
x() { 
return vec[0]; }
 
  307     T                           &
y() { 
return vec[1]; }
 
  308     T                           &
z() { 
return vec[2]; }
 
  309     T                           &
w() { 
return vec[3]; }
 
  311     T                           x()
 const { 
return vec[0]; }
 
  312     T                           y()
 const { 
return vec[1]; }
 
  313     T                           z()
 const { 
return vec[2]; }
 
  314     T                           w()
 const { 
return vec[3]; }
 
  316     void                        save(std::ostream &os, 
int binary=0) 
const;
 
  327     const T     *
data()
 const   { 
return &vec[0]; }
 
  342     unsigned    hash()
 const    { 
return SYSvector_hash(
data(), tuple_size); }
 
  348                                          vec[0] = qx; vec[1] = qy; 
 
  349                                          vec[2] = qz; vec[3] = qw;
 
  353     friend std::ostream &operator<<(std::ostream &os, const UT_QuaternionT<T> &
v)
 
  361 template <
typename T>
 
  364 template <
typename T>
 
  369     updateFromAngleAxis(angle, axis, donormalize);
 
  372 template <
typename T>
 
  376     return (vec[0] == quat.vec[0] &&
 
  377             vec[1] == quat.vec[1] &&
 
  378             vec[2] == quat.vec[2] &&
 
  379             vec[3] == quat.vec[3]);
 
  382 template <
typename T>
 
  386     return !(*
this == quat);
 
  389 template <
typename T>
 
  396     return ((
SYSisEqual(vec[0], quat.vec[0], tol) &&
 
  406 template <
typename T>
 
  417 template <
typename T>
 
  427 template <
typename T>
 
  431     vec[0] += quat.vec[0];
 
  432     vec[1] += quat.vec[1];
 
  433     vec[2] += quat.vec[2];
 
  434     vec[3] += quat.vec[3];
 
  439 template <
typename T>
 
  449 template <
typename T>
 
  459 template <
typename T>
 
  469 template <
typename T>
 
  479 template <
typename T>
 
  486     T                    s1 = vec[3], s2 = q.vec[3];
 
  488     vec[3] = s1*s2 - v1.
dot(v2);
 
  489     v3 = s1*v2 + s2*v1 + 
cross(v1, v2);
 
  497 template <
typename T>
 
  509 template <
typename T>
 
  522 template <
typename T>
 
  530 template <
typename T>
 
  542 template <
typename T>
 
  556 template <
typename T>
 
  566 template <
typename T>
 
  576 template <
typename T>
 
  580     return q1.
x()*q2.
x() + q1.
y()*q2.
y() + q1.
z()*q2.
z() + q1.
w()*q2.
w();
 
  583 template <
typename T>
 
  596 template< 
typename T, ex
int D >
 
  611 template <
typename T>
 
  614     template< 
typename TS >
 
  626 template< 
typename TS >
 
  638 template <
typename V >
 
  642 template <
typename T>
 
  650 template <
typename T>
 
Mat3< typename promote< S, T >::type > operator*(S scalar, const Mat3< T > &m)
Multiply each element of the given matrix by scalar and return the result. 
 
GLenum GLuint GLenum GLsizei const GLchar * buf
 
constexpr SYS_FORCE_INLINE T dot(const UT_Vector3T &b) const noexcept
 
UT_QuaternionT< T > & operator/=(const UT_QuaternionT< T > &quat)
 
UT_QuaternionT(const UT_Vector3T< T > &rot, const UT_XformOrder &order)
 
#define SYS_STATIC_ASSERT(expr)
 
OIIO_FORCEINLINE const vint4 & operator/=(vint4 &a, const vint4 &b)
 
UT_QuaternionT< fpreal16 > UT_QuaternionH
 
UT_FixedVector< T, 4 > FixedVectorType
 
UT_QuaternionT< T > & operator=(const UT_QuaternionT< S > &v)
 
constexpr SYS_FORCE_INLINE UT_QuaternionT< T > operator()(const TS &as) const noexcept
 
SIM_API const UT_StringHolder angle
 
UT_QuaternionT< fpreal > UT_QuaternionR
 
GT_API const UT_StringHolder time
 
Mat3< typename promote< T0, T1 >::type > operator+(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Add corresponding elements of m0 and m1 and return the result. 
 
const GLuint GLenum const void * binary
 
GA_API const UT_StringHolder rot
 
typename SYS_FixedArrayElement< T >::type SYS_FixedArrayElement_t
 
GA_API const UT_StringHolder twist
 
fpreal64 distance2(const UT_VectorD &v1, const UT_VectorD &v2)
Distance squared (L2) aka quadrance. 
 
void assign(T qx, T qy, T qz, T qw)
 
constexpr SYS_FORCE_INLINE T & z() noexcept
 
GLboolean GLboolean GLboolean GLboolean a
 
PUGI__FN void reverse(I begin, I end)
 
JSON reader class which handles parsing of JSON or bJSON files. 
 
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
 
Class which writes ASCII or binary JSON streams. 
 
static const exint TupleSize
 
GLfloat GLfloat GLfloat v2
 
GLdouble GLdouble GLdouble q
 
GLfloat GLfloat GLfloat GLfloat v3
 
size_t hash_value(const UT_QuaternionT< T > &val)
 
UT_QuaternionT< T > operator/(const UT_QuaternionT< T > &a, const UT_QuaternionT< T > &b)
 
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
 
UT_API size_t format(char *buf, size_t buf_size, const UT_QuaternionT< T > &q)
 
UT_QuaternionT< fpreal32 > UT_QuaternionF
 
Vec3< T > & operator*=(Vec3< T > &_v, const Mat3< MT > &_m)
Multiply _v by _m and replace _v with the resulting vector. 
 
UT_QuaternionT< T > ThisType
 
SYS_NO_DISCARD_RESULT UT_Vector3T< T > rotateInverse(const UT_Vector3T< T > &) const 
 
Mat3< typename promote< T0, T1 >::type > operator-(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Subtract corresponding elements of m0 and m1 and return the result. 
 
OIIO_FORCEINLINE const vint4 & operator+=(vint4 &a, const vint4 &b)
 
UT_QuaternionT< fpreal64 > UT_QuaternionD
 
UT_QuaternionT(T qx=0, T qy=0, T qz=0, T qw=0)
 
static const bool isVectorType
 
GLdouble GLdouble GLint GLint order
 
UT_QuaternionT< T > & operator+=(const UT_QuaternionT< T > &quat)
 
#define SYS_NO_DISCARD_RESULT
 
T operator()(int idx) const 
 
GLboolean GLboolean GLboolean b
 
UT_QuaternionT(const UT_Vector4T< T > &v)
 
void lerp(const UT_QuaternionT< T > &src, const UT_QuaternionT< T > &dst, T t)
Do component-wise lerp between this src (t=0) and dst (t=1). 
 
T dot(const UT_QuaternionT< T > &q1, const UT_QuaternionT< T > &q2)
 
ImageBuf OIIO_API rotate(const ImageBuf &src, float angle, string_view filtername=string_view(), float filterwidth=0.0f, bool recompute_roi=false, ROI roi={}, int nthreads=0)
 
IMATH_HOSTDEVICE const Vec2< S > & operator*=(Vec2< S > &v, const Matrix22< T > &m) IMATH_NOEXCEPT
Vector-matrix multiplication: v *= m. 
 
UT_QuaternionT< T > SYSlerp(const UT_QuaternionT< T > &q1, const UT_QuaternionT< T > &q2, T t)
Perform component-wise SYSlerp of two quaternions. 
 
UT_QuaternionT< T > & operator*=(const UT_QuaternionT< T > &q)
 
bool isEqual(const UT_QuaternionT< T > &quat, T tol=T(SYS_FTOLERANCE)) const 
 
class UT_API UT_QuaternionT
 
UT_QuaternionT< T > log() const 
 
UT_QuaternionT(const fpreal64 v[tuple_size])
 
UT_QuaternionT< fpreal32 > UT_Quaternion
 
bool operator!=(const UT_QuaternionT< T > &quat) const 
 
T distance2(const UT_QuaternionT< T > &b) const noexcept
 
LeafData & operator=(const LeafData &)=delete
 
T distance(const UT_QuaternionT< T > &b) const noexcept
 
constexpr UT_QuaternionT< SYS_FixedArrayElement_t< TS > > UTmakeQuaternionT(const TS &as) noexcept
 
T operator[](int idx) const 
 
Class to store JSON objects as C++ objects. 
 
UT_QuaternionT(const fpreal32 v[tuple_size])
 
void lerp(const UT_QuaternionT< T > &target, T t)
Do component-wise lerp between this quat (t=0) and the target (t=1). 
 
GLubyte GLubyte GLubyte GLubyte w
 
bool operator!=(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
 
bool operator==(const UT_QuaternionT< T > &quat) const 
 
SYS_NO_DISCARD_RESULT UT_Vector3T< T > rotate(const UT_Vector3T< T > &) const 
 
void initialize(T qx=0, T qy=0, T qz=0, T qw=0)
 
constexpr SYS_FORCE_INLINE T & y() noexcept
 
bool SYSisEqual(const UT_Vector2T< T > &a, const UT_Vector2T< T > &b, S tol=SYS_FTOLERANCE)
Componentwise equality. 
 
unsigned hash() const 
Compute a hash. 
 
SIM_DerVector3 cross(const SIM_DerVector3 &lhs, const SIM_DerVector3 &rhs)
 
constexpr SYS_FORCE_INLINE T & x() noexcept