36 #ifndef __Quaternion_H__ 37 #define __Quaternion_H__ 61 : w(1), x(0), y(0), z(0)
68 : w(fW), x(fX), y(fY), z(fZ)
74 this->FromRotationMatrix(rot);
79 this->FromAngleAxis(rfAngle, rkAxis);
84 this->FromAxes(xaxis, yaxis, zaxis);
89 this->FromAxes(akAxis);
94 memcpy(&w, valptr,
sizeof(
Real)*4);
108 inline Real operator [] (
const size_t i )
const 116 inline Real& operator [] (
const size_t i )
135 void FromRotationMatrix (
const Matrix3& kRot);
136 void ToRotationMatrix (
Matrix3& kRot)
const;
140 void FromAngleAxis (
const Radian& rfAngle,
const Vector3& rkAxis);
144 ToAngleAxis ( rAngle, rkAxis );
150 void FromAxes (
const Vector3* akAxis);
153 void ToAxes (
Vector3* akAxis)
const;
188 return (rhs.
x == x) && (rhs.
y == y) &&
189 (rhs.
z == z) && (rhs.
w == w);
203 Real normalise(
void);
221 Radian getRoll(
bool reprojectAxis =
true)
const;
231 Radian getPitch(
bool reprojectAxis =
true)
const;
241 Radian getYaw(
bool reprojectAxis =
true)
const;
256 Real d = this->Dot(other);
257 return 1 - d*d < tolerance;
273 const Quaternion& rkQ,
bool shortestPath =
false);
284 static void Intermediate (
const Quaternion& rkQ0,
291 const Quaternion& rkQ,
bool shortestPath =
false);
308 const Quaternion& rkQ,
bool shortestPath =
false);
328 inline _OgreExport friend std::ostream&
operator <<
331 o <<
"Quaternion(" << q.w <<
", " << q.x <<
", " << q.y <<
", " << q.z <<
")";
Real * ptr()
Pointer accessor for direct copying.
Implementation of a Quaternion, i.e.
A 3x3 matrix which can represent rotations around axes.
Quaternion(const Radian &rfAngle, const Vector3 &rkAxis)
Construct a quaternion from an angle/axis.
static bool isNaN(Real f)
float Real
Software floating point type.
static const Real msEpsilon
Cutoff for sine near zero.
Quaternion(const Vector3 &xaxis, const Vector3 &yaxis, const Vector3 &zaxis)
Construct a quaternion from 3 orthonormal local axes.
Standard 3-dimensional vector.
void ToAngleAxis(Degree &dAngle, Vector3 &rkAxis) const
static const Quaternion ZERO
const Real * ptr() const
Pointer accessor for direct copying.
bool operator!=(STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
determine equality, can memory from another allocator be released by this allocator,...
Quaternion(const Matrix3 &rot)
Construct a quaternion from a rotation matrix.
Quaternion(Real fW, Real fX, Real fY, Real fZ)
Construct from an explicit list of values.
Radian operator *(Real a, const Radian &b)
bool orientationEquals(const Quaternion &other, Real tolerance=1e-3) const
Compare two quaternions which are assumed to be used as orientations.
void swap(Ogre::SmallVectorImpl< T > &LHS, Ogre::SmallVectorImpl< T > &RHS)
Implement std::swap in terms of SmallVector swap.
bool isNaN() const
Check whether this quaternion contains valid values.
Quaternion()
Default constructor, initializes to identity rotation (aka 0°)
Quaternion(Real *valptr)
Construct a quaternion from 4 manual w/x/y/z values.
bool operator==(STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
determine equality, can memory from another allocator be released by this allocator,...
void swap(Quaternion &other)
Exchange the contents of this quaternion with another.
Wrapper class which indicates a given angle value is in Degrees.
static const Quaternion IDENTITY
Quaternion(const Vector3 *akAxis)
Construct a quaternion from 3 orthonormal local axes.
Wrapper class which indicates a given angle value is in Radians.