OGRE-Next
4.0.0unstable
Object-Oriented Graphics Rendering Engine
|
Implementation of a Quaternion, i.e. More...
#include <OgreQuaternion.h>
Public Member Functions | |
Quaternion () | |
Default constructor, initializes to identity rotation (aka 0°) More... | |
Quaternion (const Matrix3 &rot) | |
Construct a quaternion from a rotation matrix. More... | |
Quaternion (const Radian &rfAngle, const Vector3 &rkAxis) | |
Construct a quaternion from an angle/axis. More... | |
Quaternion (const Vector3 &xaxis, const Vector3 &yaxis, const Vector3 &zaxis) | |
Construct a quaternion from 3 orthonormal local axes. More... | |
Quaternion (const Vector3 *akAxis) | |
Construct a quaternion from 3 orthonormal local axes. More... | |
Quaternion (Real *valptr) | |
Construct a quaternion from 4 manual w/x/y/z values. More... | |
Quaternion (Real fW, Real fX, Real fY, Real fZ) | |
Construct from an explicit list of values. More... | |
Real | Dot (const Quaternion &rkQ) const |
Returns the dot product of the quaternion. More... | |
bool | equals (const Quaternion &rhs, const Radian &tolerance) const |
Equality with tolerance (tolerance is max angle difference) More... | |
Quaternion | Exp () const |
void | FromAngleAxis (const Radian &rfAngle, const Vector3 &rkAxis) |
Setups the quaternion using the supplied vector, and "roll" around that vector by the specified radians. More... | |
void | FromAxes (const Vector3 &xAxis, const Vector3 &yAxis, const Vector3 &zAxis) |
void | FromAxes (const Vector3 *akAxis) |
Constructs the quaternion using 3 axes, the axes are assumed to be orthonormal. More... | |
void | FromRotationMatrix (const Matrix3 &kRot) |
Radian | getPitch (bool reprojectAxis=true) const |
Calculate the local pitch element of this quaternion. More... | |
Radian | getRoll (bool reprojectAxis=true) const |
Calculate the local roll element of this quaternion. More... | |
Radian | getYaw (bool reprojectAxis=true) const |
Calculate the local yaw element of this quaternion. More... | |
Quaternion | Inverse () const |
Apply to non-zero quaternion. More... | |
bool | isNaN () const |
Check whether this quaternion contains valid values. More... | |
Quaternion | Log () const |
Real | Norm () const |
Real | normalise () |
Normalises this quaternion, and returns the previous length. More... | |
bool | operator!= (const Quaternion &rhs) const |
Quaternion | operator* (const Quaternion &rkQ) const |
Vector3 | operator* (const Vector3 &rkVector) const |
Rotation of a vector by a quaternion. More... | |
Quaternion | operator* (Real fScalar) const |
Quaternion | operator+ (const Quaternion &rkQ) const |
Quaternion | operator- () const |
Quaternion | operator- (const Quaternion &rkQ) const |
bool | operator== (const Quaternion &rhs) const |
Real & | operator[] (const size_t i) |
Array accessor operator. More... | |
Real | operator[] (const size_t i) const |
Array accessor operator. More... | |
bool | orientationEquals (const Quaternion &other, Real tolerance=Real(1e-3)) const |
Compare two quaternions which are assumed to be used as orientations. More... | |
Real * | ptr () |
Pointer accessor for direct copying. More... | |
const Real * | ptr () const |
Pointer accessor for direct copying. More... | |
void | swap (Quaternion &other) |
Exchange the contents of this quaternion with another. More... | |
void | ToAngleAxis (Degree &dAngle, Vector3 &rkAxis) const |
void | ToAngleAxis (Radian &rfAngle, Vector3 &rkAxis) const |
void | ToAxes (Vector3 &xAxis, Vector3 &yAxis, Vector3 &zAxis) const |
void | ToAxes (Vector3 *akAxis) const |
Gets the 3 orthonormal axes defining the quaternion. More... | |
void | ToRotationMatrix (Matrix3 &kRot) const |
Quaternion | UnitInverse () const |
Apply to unit-length quaternion. More... | |
Vector3 | xAxis () const |
Returns the X orthonormal axis defining the quaternion. More... | |
Vector3 | yAxis () const |
Returns the Y orthonormal axis defining the quaternion. More... | |
Vector3 | zAxis () const |
Returns the Z orthonormal axis defining the quaternion. More... | |
Static Public Member Functions | |
static void | Intermediate (const Quaternion &rkQ0, const Quaternion &rkQ1, const Quaternion &rkQ2, Quaternion &rka, Quaternion &rkB) |
Setup for spherical quadratic interpolation. More... | |
static Quaternion | nlerp (Real fT, const Quaternion &rkP, const Quaternion &rkQ, bool shortestPath=false) |
Performs Normalised linear interpolation between two quaternions, and returns the result. More... | |
static Quaternion | Slerp (Real fT, const Quaternion &rkP, const Quaternion &rkQ, bool shortestPath=false) |
Performs Spherical linear interpolation between two quaternions, and returns the result. More... | |
static Quaternion | SlerpExtraSpins (Real fT, const Quaternion &rkP, const Quaternion &rkQ, int iExtraSpins) |
static Quaternion | Squad (Real fT, const Quaternion &rkP, const Quaternion &rkA, const Quaternion &rkB, const Quaternion &rkQ, bool shortestPath=false) |
Spherical quadratic interpolation. More... | |
Public Attributes | |
Real | w |
Real | x |
Real | y |
Real | z |
Static Public Attributes | |
static const Quaternion | IDENTITY |
static const Real | msEpsilon |
Cutoff for sine near zero. More... | |
static const Quaternion | ZERO |
Implementation of a Quaternion, i.e.
a rotation around an axis. For more information about Quaternions and the theory behind it, we recommend reading: http://www.ogre3d.org/tikiwiki/Quaternion+and+Rotation+Primer and http://www.cprogramming.com/tutorial/3d/quaternions.html and http://www.gamedev.net/page/resources/_/reference/programming/math-and-physics/quaternions/quaternion-powers-r1095
|
inline |
Default constructor, initializes to identity rotation (aka 0°)
Construct from an explicit list of values.
|
inline |
Construct a quaternion from a rotation matrix.
Construct a quaternion from an angle/axis.
|
inline |
Construct a quaternion from 3 orthonormal local axes.
|
inline |
Construct a quaternion from 3 orthonormal local axes.
|
inline |
Construct a quaternion from 4 manual w/x/y/z values.
Real Ogre::Quaternion::Dot | ( | const Quaternion & | rkQ | ) | const |
Returns the dot product of the quaternion.
bool Ogre::Quaternion::equals | ( | const Quaternion & | rhs, |
const Radian & | tolerance | ||
) | const |
Equality with tolerance (tolerance is max angle difference)
Quaternion Ogre::Quaternion::Exp | ( | ) | const |
Setups the quaternion using the supplied vector, and "roll" around that vector by the specified radians.
Referenced by Ogre::Vector3::getRotationTo(), and Ogre::Vector3::randomDeviant().
void Ogre::Quaternion::FromAxes | ( | const Vector3 & | xAxis, |
const Vector3 & | yAxis, | ||
const Vector3 & | zAxis | ||
) |
void Ogre::Quaternion::FromAxes | ( | const Vector3 * | akAxis | ) |
Constructs the quaternion using 3 axes, the axes are assumed to be orthonormal.
void Ogre::Quaternion::FromRotationMatrix | ( | const Matrix3 & | kRot | ) |
Radian Ogre::Quaternion::getPitch | ( | bool | reprojectAxis = true | ) | const |
Calculate the local pitch element of this quaternion.
reprojectAxis | By default the method returns the 'intuitive' result that is, if you projected the local Z of the quaternion onto the X and Y axes, the angle between them is returned. If set to true though, the result is the actual yaw that will be used to implement the quaternion, which is the shortest possible path to get to the same orientation and may involve less axial rotation. The co-domain of the returned value is from -180 to 180 degrees. |
Radian Ogre::Quaternion::getRoll | ( | bool | reprojectAxis = true | ) | const |
Calculate the local roll element of this quaternion.
reprojectAxis | By default the method returns the 'intuitive' result that is, if you projected the local Y of the quaternion onto the X and Y axes, the angle between them is returned. If set to false though, the result is the actual yaw that will be used to implement the quaternion, which is the shortest possible path to get to the same orientation and may involve less axial rotation. The co-domain of the returned value is from -180 to 180 degrees. |
Radian Ogre::Quaternion::getYaw | ( | bool | reprojectAxis = true | ) | const |
Calculate the local yaw element of this quaternion.
reprojectAxis | By default the method returns the 'intuitive' result that is, if you projected the local Y of the quaternion onto the X and Z axes, the angle between them is returned. If set to true though, the result is the actual yaw that will be used to implement the quaternion, which is the shortest possible path to get to the same orientation and may involve less axial rotation. The co-domain of the returned value is from -180 to 180 degrees. |
|
static |
Setup for spherical quadratic interpolation.
Quaternion Ogre::Quaternion::Inverse | ( | ) | const |
Apply to non-zero quaternion.
|
inline |
Check whether this quaternion contains valid values.
References Ogre::Math::isNaN().
Quaternion Ogre::Quaternion::Log | ( | ) | const |
|
static |
Performs Normalised linear interpolation between two quaternions, and returns the result.
nlerp ( 0.0f, A, B ) = A nlerp ( 1.0f, A, B ) = B
Real Ogre::Quaternion::Norm | ( | ) | const |
Real Ogre::Quaternion::normalise | ( | ) |
Normalises this quaternion, and returns the previous length.
Referenced by Ogre::Vector3::getRotationTo().
|
inline |
References Ogre::operator==().
Quaternion Ogre::Quaternion::operator* | ( | const Quaternion & | rkQ | ) | const |
Rotation of a vector by a quaternion.
Quaternion Ogre::Quaternion::operator* | ( | Real | fScalar | ) | const |
Quaternion Ogre::Quaternion::operator+ | ( | const Quaternion & | rkQ | ) | const |
Quaternion Ogre::Quaternion::operator- | ( | ) | const |
Quaternion Ogre::Quaternion::operator- | ( | const Quaternion & | rkQ | ) | const |
|
inline |
|
inline |
Array accessor operator.
|
inline |
Array accessor operator.
|
inline |
Compare two quaternions which are assumed to be used as orientations.
|
inline |
Pointer accessor for direct copying.
|
inline |
Pointer accessor for direct copying.
|
static |
Performs Spherical linear interpolation between two quaternions, and returns the result.
Slerp ( 0.0f, A, B ) = A Slerp ( 1.0f, A, B ) = B
|
static |
|
static |
Spherical quadratic interpolation.
|
inline |
Exchange the contents of this quaternion with another.
References std::swap(), w, x, y, and z.
void Ogre::Quaternion::ToAxes | ( | Vector3 * | akAxis | ) | const |
Gets the 3 orthonormal axes defining the quaternion.
void Ogre::Quaternion::ToRotationMatrix | ( | Matrix3 & | kRot | ) | const |
Referenced by Ogre::Matrix4::Matrix4().
Quaternion Ogre::Quaternion::UnitInverse | ( | ) | const |
Apply to unit-length quaternion.
Vector3 Ogre::Quaternion::xAxis | ( | ) | const |
Returns the X orthonormal axis defining the quaternion.
Same as doing xAxis = Vector3::UNIT_X * this. Also called the local X-axis
Referenced by Ogre::VertexBufferDownloadHelper::getNormal().
Vector3 Ogre::Quaternion::yAxis | ( | ) | const |
Returns the Y orthonormal axis defining the quaternion.
Same as doing yAxis = Vector3::UNIT_Y * this. Also called the local Y-axis
Vector3 Ogre::Quaternion::zAxis | ( | ) | const |
Returns the Z orthonormal axis defining the quaternion.
Same as doing zAxis = Vector3::UNIT_Z * this. Also called the local Z-axis
Referenced by Ogre::Billboard::getDirection().
|
static |
Referenced by Ogre::Vector3::getRotationTo().
|
static |
Cutoff for sine near zero.
Real Ogre::Quaternion::w |
Real Ogre::Quaternion::x |
Real Ogre::Quaternion::y |
Real Ogre::Quaternion::z |
|
static |