37 #ifndef INCLUDED_IMATHQUAT_H 38 #define INCLUDED_IMATHQUAT_H 65 #if (defined _WIN32 || defined _WIN64) && defined _MSC_VER 67 #pragma warning(disable:4244) 88 Quat (T s, T i, T j, T k);
153 void setRotationInternal (
const Vec3<T> &f0,
183 std::ostream & operator << (std::ostream &o, const Quat<T> &q);
282 T rtmp = r * q.
r - (v ^ q.
v);
283 v = r * q.
v + v * q.
r + v % q.
v;
342 return index ? v[index - 1] : r;
350 return index ? v[index - 1] : r;
359 return r == q.
r && v == q.
v;
368 return r != q.
r || v != q.
v;
376 return q1.
r * q2.
r + (q1.
v ^ q2.
v);
412 return Quat (r / l, v / l);
428 T qdot = *
this ^ *
this;
429 return Quat (r / qdot, -v / qdot);
437 T qdot = (*this) ^ (*this);
460 Quat<T> result = *
this * vec * inv;
469 return r * q.
r + v.x * q.
v.x + v.y * q.
v.y + v.z * q.
v.z;
536 return slerp (q1, q2, t);
538 return slerp (q1, -q2, t);
643 k = theta / sintheta;
645 return Quat<T> ((T) 0, v.x * k, v.y * k, v.z * k);
659 T theta = v.length();
666 k = sintheta / theta;
670 return Quat<T> (costheta, v.x * k, v.y * k, v.z * k);
686 return v.normalized();
729 setRotationInternal (f0, t0, *
this);
739 Vec3<T> h0 = (f0 + t0).normalized();
743 setRotationInternal (f0, h0, *
this);
746 setRotationInternal (h0, t0, q);
762 if (f02.
x <= f02.
y && f02.
x <= f02.
z)
764 else if (f02.
y <= f02.
z)
765 v = (f0 %
Vec3<T> (0, 1, 0)).normalized();
767 v = (f0 %
Vec3<T> (0, 0, 1)).normalized();
796 Vec3<T> h0 = (f0 + t0).normalized();
811 return Matrix33<T> (1 - 2 * (v.y * v.y + v.z * v.z),
812 2 * (v.x * v.y + v.z * r),
813 2 * (v.z * v.x - v.y * r),
815 2 * (v.x * v.y - v.z * r),
816 1 - 2 * (v.z * v.z + v.x * v.x),
817 2 * (v.y * v.z + v.x * r),
819 2 * (v.z * v.x + v.y * r),
820 2 * (v.y * v.z - v.x * r),
821 1 - 2 * (v.y * v.y + v.x * v.x));
828 return Matrix44<T> (1 - 2 * (v.y * v.y + v.z * v.z),
829 2 * (v.x * v.y + v.z * r),
830 2 * (v.z * v.x - v.y * r),
832 2 * (v.x * v.y - v.z * r),
833 1 - 2 * (v.z * v.z + v.x * v.x),
834 2 * (v.y * v.z + v.x * r),
836 2 * (v.z * v.x + v.y * r),
837 2 * (v.y * v.z - v.x * r),
838 1 - 2 * (v.y * v.y + v.x * v.x),
865 operator << (std::ostream &o, const Quat<T> &q)
867 return o <<
"(" << q.
r 880 q1.
r * q2.
v + q1.
v * q2.
r + q1.
v % q2.
v);
954 return v + T (2) * (q.
r * a + b);
957 #if (defined _WIN32 || defined _WIN64) && defined _MSC_VER 958 #pragma warning(default:4244) Quat< float > Quatf
Definition: ImathQuat.h:220
Vec3< T > v
Definition: ImathQuat.h:76
Quat< T > & setAxisAngle(const Vec3< T > &axis, T radians)
Definition: ImathQuat.h:692
Quat()
Definition: ImathQuat.h:230
Quat< T > log() const
Definition: ImathQuat.h:625
T length() const
Definition: ImathQuat.h:382
Quat< T > squad(const Quat< T > &q1, const Quat< T > &q2, const Quat< T > &qa, const Quat< T > &qb, T t)
Definition: ImathQuat.h:580
Definition: ImathFrame.h:42
static Quat< T > identity()
Definition: ImathQuat.h:263
Definition: ImathFrame.h:43
Quat< T > operator/(const Quat< T > &q1, const Quat< T > &q2)
Definition: ImathQuat.h:886
T sinx_over_x(T x)
Definition: ImathMath.h:161
Plane3< T > operator-(const Plane3< T > &plane)
Definition: ImathPlane.h:248
static T atan2(T x, T y)
Definition: ImathMath.h:96
Quat< T > normalized() const
Definition: ImathQuat.h:409
Quat< T > operator+(const Quat< T > &q1, const Quat< T > &q2)
Definition: ImathQuat.h:918
Quat< T > spline(const Quat< T > &q0, const Quat< T > &q1, const Quat< T > &q2, const Quat< T > &q3, T t)
Definition: ImathQuat.h:544
bool operator==(const Quat< S > &q) const
Definition: ImathQuat.h:357
Quat< T > & setRotation(const Vec3< T > &fromDirection, const Vec3< T > &toDirection)
Definition: ImathQuat.h:702
const Quat< T > & operator+=(const Quat< T > &q)
Definition: ImathQuat.h:320
Quat< T > operator~(const Quat< T > &q)
Definition: ImathQuat.h:934
T abs(T a)
Definition: ImathFun.h:53
T operator^(const Quat< T > &q1, const Quat< T > &q2)
Definition: ImathQuat.h:374
Definition: ImathMatrix.h:66
Quat< T > slerp(const Quat< T > &q1, const Quat< T > &q2, T t)
Definition: ImathQuat.h:494
const Quat< T > & operator/=(const Quat< T > &q)
Definition: ImathQuat.h:301
Definition: ImathLimits.h:117
static T acos(T x)
Definition: ImathMath.h:93
Vec3< T > rotateVector(const Vec3< T > &original) const
Definition: ImathQuat.h:446
T x
Definition: ImathVec.h:274
T y
Definition: ImathVec.h:274
void intermediate(const Quat< T > &q0, const Quat< T > &q1, const Quat< T > &q2, const Quat< T > &q3, Quat< T > &qa, Quat< T > &qb)
const Quat< T > & operator-=(const Quat< T > &q)
Definition: ImathQuat.h:330
Quat< T > exp() const
Definition: ImathQuat.h:651
static T cos(T x)
Definition: ImathMath.h:97
Matrix44< T > toMatrix44() const
Definition: ImathQuat.h:826
T & operator[](int index)
Definition: ImathQuat.h:340
Quat< T > & normalize()
Definition: ImathQuat.h:390
Definition: ImathQuat.h:71
Vec3< T > axis() const
Definition: ImathQuat.h:684
T z
Definition: ImathVec.h:274
const Quat< T > & operator*=(const Quat< T > &q)
Definition: ImathQuat.h:280
T r
Definition: ImathQuat.h:75
Quat< T > slerpShortestArc(const Quat< T > &q1, const Quat< T > &q2, T t)
Definition: ImathQuat.h:527
Vec3< T > normalized() const
Definition: ImathVec.h:1730
Quat< T > inverse() const
Definition: ImathQuat.h:420
Quat< double > Quatd
Definition: ImathQuat.h:221
const Quat< T > & operator=(const Quat< T > &q)
Definition: ImathQuat.h:270
T angle4D(const Quat< T > &q1, const Quat< T > &q2)
Definition: ImathQuat.h:475
T euclideanInnerProduct(const Quat< T > &q) const
Definition: ImathQuat.h:467
Definition: ImathBox.h:67
T angle() const
Definition: ImathQuat.h:676
Color4< T > operator*(S a, const Color4< T > &v)
Definition: ImathColor.h:727
static T sin(T x)
Definition: ImathMath.h:98
static T sqrt(T x)
Definition: ImathMath.h:114
Matrix33< T > toMatrix33() const
Definition: ImathQuat.h:809
Quat< T > & invert()
Definition: ImathQuat.h:435
bool operator!=(const Quat< S > &q) const
Definition: ImathQuat.h:366