37 #ifndef INCLUDED_IMATHQUAT_H
38 #define INCLUDED_IMATHQUAT_H
66 #if (defined _WIN32 || defined _WIN64) && defined _MSC_VER
68 #pragma warning(disable:4244)
154 void setRotationInternal (
const Vec3<T> &f0,
184 std::ostream & operator << (std::ostream &o, const Quat<T> &
q);
283 T rtmp =
r * q.
r - (
v ^ q.
v);
284 v =
r * q.
v +
v * q.
r +
v % q.
v;
343 return index ?
v[index - 1] :
r;
351 return index ?
v[index - 1] :
r;
360 return r == q.
r &&
v == q.
v;
369 return r != q.
r ||
v != q.
v;
377 return q1.
r * q2.
r + (q1.
v ^ q2.
v);
429 T qdot = *
this ^ *
this;
430 return Quat (
r / qdot, -
v / qdot);
438 T qdot = (*this) ^ (*this);
470 return r * q.
r +
v.x * q.
v.x +
v.y * q.
v.y +
v.z * q.
v.z;
537 return slerp (q1, q2, t);
539 return slerp (q1, -q2, t);
644 k = theta / sintheta;
660 T theta =
v.length();
667 k = sintheta / theta;
671 return Quat<T> (costheta,
v.x * k,
v.y * k,
v.z * k);
687 return v.normalized();
730 setRotationInternal (f0, t0, *
this);
744 setRotationInternal (f0, h0, *
this);
747 setRotationInternal (h0, t0, q);
763 if (f02.
x <= f02.
y && f02.
x <= f02.
z)
765 else if (f02.
y <= f02.
z)
766 v = (f0 %
Vec3<T> (0, 1, 0)).normalized();
768 v = (f0 %
Vec3<T> (0, 0, 1)).normalized();
813 2 * (
v.x *
v.y +
v.z *
r),
814 2 * (
v.z *
v.x -
v.y *
r),
816 2 * (
v.x *
v.y -
v.z *
r),
817 1 - 2 * (
v.z *
v.z +
v.x *
v.x),
818 2 * (
v.y *
v.z +
v.x *
r),
820 2 * (
v.z *
v.x +
v.y *
r),
821 2 * (
v.y *
v.z -
v.x *
r),
822 1 - 2 * (
v.y *
v.y +
v.x *
v.x));
830 2 * (
v.x *
v.y +
v.z *
r),
831 2 * (
v.z *
v.x -
v.y *
r),
833 2 * (
v.x *
v.y -
v.z *
r),
834 1 - 2 * (
v.z *
v.z +
v.x *
v.x),
835 2 * (
v.y *
v.z +
v.x *
r),
837 2 * (
v.z *
v.x +
v.y *
r),
838 2 * (
v.y *
v.z -
v.x *
r),
839 1 - 2 * (
v.y *
v.y +
v.x *
v.x),
866 operator << (std::ostream &o, const Quat<T> &
q)
868 return o <<
"(" << q.
r
881 q1.
r * q2.
v + q1.
v * q2.
r + q1.
v % q2.
v);
955 return v +
T (2) * (q.
r * a +
b);
958 #if (defined _WIN32 || defined _WIN64) && defined _MSC_VER
959 #pragma warning(default:4244)
964 #endif // INCLUDED_IMATHQUAT_H
#define IMATH_INTERNAL_NAMESPACE_HEADER_EXIT
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.
GLboolean GLboolean GLboolean b
Vec3< T > rotateVector(const Vec3< T > &original) const
void intermediate(const Quat< T > &q0, const Quat< T > &q1, const Quat< T > &q2, const Quat< T > &q3, Quat< T > &qa, Quat< T > &qb)
#define IMATH_INTERNAL_NAMESPACE_HEADER_ENTER
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.
T operator^(const Quat< T > &q1, const Quat< T > &q2)
Quat< T > squad(const Quat< T > &q1, const Quat< T > &q2, const Quat< T > &qa, const Quat< T > &qb, T t)
Quat< T > & setAxisAngle(const Vec3< T > &axis, T radians)
const Quat< T > & operator/=(const Quat< T > &q)
GLdouble GLdouble GLdouble GLdouble q
T euclideanInnerProduct(const Quat< T > &q) const
static Quat< T > identity()
Matrix44< T > toMatrix44() const
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
IMATH_INTERNAL_NAMESPACE_HEADER_ENTER T abs(T a)
Quat< T > slerp(const Quat< T > &q1, const Quat< T > &q2, T t)
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.
GLint GLenum GLboolean normalized
Quat< T > operator~(const Quat< T > &q)
Quat< T > inverse() const
GLboolean GLboolean GLboolean GLboolean a
T angle4D(const Quat< T > &q1, const Quat< T > &q2)
Vec3< T > normalized() const
bool operator==(const Quat< S > &q) const
Quat< T > operator/(const Quat< T > &q1, const Quat< T > &q2)
GLuint GLsizei GLsizei * length
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t0
const Quat< T > & operator=(const Quat< T > &q)
T & operator[](int index)
Quat< T > & setRotation(const Vec3< T > &fromDirection, const Vec3< T > &toDirection)
Quat< T > slerpShortestArc(const Quat< T > &q1, const Quat< T > &q2, T t)
const Quat< T > & operator*=(const Quat< T > &q)
Quat< T > spline(const Quat< T > &q0, const Quat< T > &q1, const Quat< T > &q2, const Quat< T > &q3, T t)
const Quat< T > & operator+=(const Quat< T > &q)
OIIO_FORCEINLINE OIIO_HOSTDEVICE T radians(T deg)
Convert degrees to radians.
Matrix33< T > toMatrix33() const
const Quat< T > & operator-=(const Quat< T > &q)
bool operator!=(const Quat< S > &q) const
Quat< T > normalized() const