41 :
mQuat(q.x(), q.y(), q.z(), q.w())
77 :
mQuat(angle1, axis1, angle2, axis2, angle3, axis3)
83 :
mQuat(angle1, axis1, angle2, axis2, angle3, axis3)
237 mQuat.makeRotate(angle, x, y, z);
243 mQuat.makeRotate(angle, vec);
249 mQuat.makeRotate(angle, vec);
255 mQuat.makeRotate(angle1, axis1, angle2, axis2, angle3, axis3);
261 mQuat.makeRotate(angle1, axis1, angle2, axis2, angle3, axis3);
267 mQuat.makeRotate(vec1, vec2);
273 mQuat.makeRotate(vec1, vec2);
279 mQuat.getRotate(angle, x, y, z);
285 mQuat.getRotate(angle, vec);
291 mQuat.getRotate(angle, vec);
297 mQuat.set(0.0, 0.0, 0.0, 1.0);
303 mQuat.slerp(t, from, to);
376 return mQuat._v[0] == v[0] &&
mQuat._v[1] == v[1] &&
mQuat._v[2] == v[2] &&
mQuat._v[3] == v[3];
382 return mQuat._v[0] != v[0] ||
mQuat._v[1] != v[1] ||
mQuat._v[2] != v[2] ||
mQuat._v[3] != v[3];
388 if (
mQuat._v[0]<v[0])
return true;
389 else if (
mQuat._v[0]>v[0])
return false;
390 else if (
mQuat._v[1]<v[1])
return true;
391 else if (
mQuat._v[1]>v[1])
return false;
392 else if (
mQuat._v[2]<v[2])
return true;
393 else if (
mQuat._v[2]>v[2])
return false;
394 else return (
mQuat._v[3]<v[3]);
400 if (
mQuat._v[0]>v[0])
return true;
401 else if (
mQuat._v[0]<v[0])
return false;
402 else if (
mQuat._v[1]>v[1])
return true;
403 else if (
mQuat._v[1]<v[1])
return false;
404 else if (
mQuat._v[2]>v[2])
return true;
405 else if (
mQuat._v[2]<v[2])
return false;
406 else return (
mQuat._v[3]>v[3]);
423 uv *= (2.0f *
mQuat._v[3]);
436 uv *= (2.0f *
mQuat._v[3]);
496 return ((*
this) * denom.
Inverse());
502 (*this) = (*this) * denom.
Inverse();
516 mQuat._v[0] += rhs[0];
517 mQuat._v[1] += rhs[1];
518 mQuat._v[2] += rhs[2];
519 mQuat._v[3] += rhs[3];
533 mQuat._v[0] -= rhs[0];
534 mQuat._v[1] -= rhs[1];
535 mQuat._v[2] -= rhs[2];
536 mQuat._v[3] -= rhs[3];
547 Quat::operator osg::Quat()
const 553 Quat::operator osg::Quat&()
559 Quat::operator
const osg::Quat&()
const 565 Quat::operator osg::Quat*()
573 return std::string(
"[" + trUtil::StringUtils::ToString<value_type>(
mQuat._v[0], precision) +
"][" + trUtil::StringUtils::ToString<value_type>(
mQuat._v[1], precision) +
574 "][" + trUtil::StringUtils::ToString<value_type>(
mQuat._v[2], precision) +
"][" + trUtil::StringUtils::ToString<value_type>(
mQuat._v[3], precision) +
"]");
580 ios <<
"[" << q.
X() <<
"][" << q.
Y() <<
"][" << q.
Z() <<
"][" << q.
W() <<
"]";
value_type Length2() const
(Length*Length) of the quaternion = vec .
Quat operator/(value_type rhs) const
Divide by scalar.
Quat()
Default constructor.
Vec4d AsVec4() const
Converts this object to a vector 4.
Quat & operator/=(value_type rhs)
Unary divide by scalar.
value_type & W()
Returns the W component of the vector.
value_type & Z()
Returns the Z component of the vector.
General purpose 3D float Vector.
const Quat operator-() const
Negation operator - returns the negative of the quaternion.
bool operator!=(const Quat &v) const
Not equals operator.
TR_BASE_EXPORT std::ostream & operator<<(std::ostream &ios, const Matrixd &q)
Stream insertion operator.
trBase::Quat Conj() const
Conjugate.
value_type & Z()
Returns the Z component of the vector.
bool operator<(const Quat &v) const
Less than operator.
void Set(const Quat &q)
Sets the given q.
A float Matrix class to be used for generic matrix operations.
General purpose 3D double Vector.
Vec3d AsVec3() const
Converts this object to a vector 3.
Quat & operator*=(value_type rhs)
Unary multiply by scalar.
General purpose 3D double Vector.
value_type & Z()
Returns the Z component of the quaternion/.
value_type & W()
Returns the W component of the quaternion/.
Quat & operator=(const Quat &v)
Set operator.
Represents a quaternion, that is used for angular calculations and transformations.
value_type & operator[](int i)
Index operator.
A float Matrix class to be used for generic matrix operations.
void GetRotate(value_type &angle, value_type &x, value_type &y, value_type &z) const
Return the angle and vector components represented by the quaternion.
void Slerp(value_type t, const Quat &from, const Quat &to)
Spherical Linear Interpolation.
value_type & Y()
Returns the Y component of the vector.
bool operator==(const Quat &v) const
Equals operator.
value_type & X()
Returns the X component of the quaternion/.
Quat & operator+=(const Quat &rhs)
Unary addition.
value_type & W()
Returns the W component of the vector.
value_type Length() const
Length of the quaternion = sqrt( vec .
const Quat operator+(const Quat &rhs) const
Binary addition.
value_type & Y()
Returns the Y component of the quaternion/.
osg::Quat & GetOSGQuat()
Returns a reference to the internal OSG Quat.
const Quat operator*(value_type rhs) const
Multiply by scalar.
void MakeRotate(value_type angle, value_type x, value_type y, value_type z)
Set a quaternion which will perform a rotation of an angle around the axis given by the vector(x...
void Clear()
Clears this object to its blank/initial state.
const trBase::Quat Inverse() const
Multiplicative inverse method: q^(-1) = q^* /(q.q^*)
value_type & X()
Returns the X component of the vector.
bool operator>(const Quat &v) const
Greater than operator.
Quat & operator-=(const Quat &rhs)
Unary subtraction.
value_type & X()
Returns the X component of the vector.
std::string ToString(int precision=-1)
Convert this object into a string representation.
value_type & Y()
Returns the Y component of the vector.
void Get(Matrixf &matrix) const
Sets the quaternion from the given matrix.
bool IsZeroRotation() const
return true if the Quat represents a zero rotation, and therefore can be ignored in computations...
General purpose 3D float Vector.