36 #ifndef __Quaternion_H__
37 #define __Quaternion_H__
67 this->FromRotationMatrix(rot);
72 this->FromAngleAxis(rfAngle, rkAxis);
77 this->FromAxes(xaxis, yaxis, zaxis);
82 this->FromAxes(akAxis);
87 memcpy(&w, valptr,
sizeof(
Real)*4);
94 std::swap(w, other.
w);
95 std::swap(x, other.
x);
96 std::swap(y, other.
y);
97 std::swap(z, other.
z);
101 inline Real operator [] (
const size_t i )
const
109 inline Real& operator [] (
const size_t i )
128 void FromRotationMatrix (
const Matrix3& kRot);
129 void ToRotationMatrix (
Matrix3& kRot)
const;
130 void FromAngleAxis (
const Radian& rfAngle,
const Vector3& rkAxis);
134 ToAngleAxis ( rAngle, rkAxis );
137 void FromAxes (
const Vector3* akAxis);
139 void ToAxes (
Vector3* akAxis)
const;
165 return (rhs.
x == x) && (rhs.
y == y) &&
166 (rhs.
z == z) && (rhs.
w == w);
176 Real normalise(
void);
193 Radian getRoll(
bool reprojectAxis =
true)
const;
202 Radian getPitch(
bool reprojectAxis =
true)
const;
211 Radian getYaw(
bool reprojectAxis =
true)
const;
217 const Quaternion& rkQ,
bool shortestPath =
false);
224 static void Intermediate (
const Quaternion& rkQ0,
231 const Quaternion& rkQ,
bool shortestPath =
false);
235 const Quaternion& rkQ,
bool shortestPath =
false);
255 inline _OgreExport friend std::ostream&
operator <<
258 o <<
"Quaternion(" << q.w <<
", " << q.x <<
", " << q.y <<
", " << q.z <<
")";
Quaternion(const Radian &rfAngle, const Vector3 &rkAxis)
Construct a quaternion from an angle/axis.
Real * ptr()
Pointer accessor for direct copying.
void swap(Quaternion &other)
Exchange the contents of this quaternion with another.
float Real
Software floating point type.
static const Real ms_fEpsilon
void ToAngleAxis(Degree &dAngle, Vector3 &rkAxis) const
A 3x3 matrix which can represent rotations around axes.
Quaternion(const Matrix3 &rot)
Construct a quaternion from a rotation matrix.
Quaternion(Real fW=1.0, Real fX=0.0, Real fY=0.0, Real fZ=0.0)
bool isNaN() const
Check whether this quaternion contains valid values.
Quaternion(const Vector3 &xaxis, const Vector3 &yaxis, const Vector3 &zaxis)
Construct a quaternion from 3 orthonormal local axes.
Radian operator*(Real a, const Radian &b)
const Real * ptr() const
Pointer accessor for direct copying.
Implementation of a Quaternion, i.e.
Quaternion(Real *valptr)
Construct a quaternion from 4 manual w/x/y/z values.
Quaternion(const Vector3 *akAxis)
Construct a quaternion from 3 orthonormal local axes.
static const Quaternion IDENTITY
static const Quaternion ZERO
Wrapper class which indicates a given angle value is in Degrees.
Standard 3-dimensional vector.
Wrapper class which indicates a given angle value is in Radians.
static bool isNaN(Real f)
bool operator==(STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
determine equality, can memory from another allocator be released by this allocator, (ISO C++)
bool operator!=(STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
determine equality, can memory from another allocator be released by this allocator, (ISO C++)