KudanAR - iOS  1.6.0
OgreMathLib::Quaternion Class Reference

#include <OgreMathLib.h>

Public Member Functions

 Quaternion ()
 Default constructor, initializes to identity rotation (aka 0�)
 
 Quaternion (Real fW, Real fX, Real fY, Real fZ)
 Construct from an explicit list of values.
 
 Quaternion (const Matrix3 &rot)
 Construct a quaternion from a rotation matrix.
 
 Quaternion (const Radian &rfAngle, const Vector3 &rkAxis)
 Construct a quaternion from an angle/axis.
 
 Quaternion (const Vector3 &xaxis, const Vector3 &yaxis, const Vector3 &zaxis)
 Construct a quaternion from 3 orthonormal local axes.
 
 Quaternion (const Vector3 *akAxis)
 Construct a quaternion from 3 orthonormal local axes.
 
 Quaternion (Real *valptr)
 Construct a quaternion from 4 manual w/x/y/z values.
 
void swap (Quaternion &other)
 
Real operator[] (const size_t i) const
 Array accessor operator.
 
Real & operator[] (const size_t i)
 Array accessor operator.
 
Real * ptr ()
 Pointer accessor for direct copying.
 
const Real * ptr () const
 Pointer accessor for direct copying.
 
void FromRotationMatrix (const Matrix3 &kRot)
 
void ToRotationMatrix (Matrix3 &kRot) const
 
void FromAngleAxis (const Radian &rfAngle, const Vector3 &rkAxis)
 
void ToAngleAxis (Radian &rfAngle, Vector3 &rkAxis) const
 
void ToAngleAxis (Degree &dAngle, Vector3 &rkAxis) const
 
void FromAxes (const Vector3 *akAxis)
 
void FromAxes (const Vector3 &xAxis, const Vector3 &yAxis, const Vector3 &zAxis)
 
void ToAxes (Vector3 *akAxis) const
 
void ToAxes (Vector3 &xAxis, Vector3 &yAxis, Vector3 &zAxis) const
 
Vector3 xAxis (void) const
 Get the local x-axis.
 
Vector3 yAxis (void) const
 Get the local y-axis.
 
Vector3 zAxis (void) const
 Get the local z-axis.
 
Quaternionoperator= (const Quaternion &rkQ)
 
Quaternion operator+ (const Quaternion &rkQ) const
 
Quaternion operator- (const Quaternion &rkQ) const
 
Quaternion operator* (const Quaternion &rkQ) const
 
Quaternion operator* (Real fScalar) const
 
Quaternion operator- () const
 
bool operator== (const Quaternion &rhs) const
 
bool operator!= (const Quaternion &rhs) const
 
Real Dot (const Quaternion &rkQ) const
 
Real Norm () const
 
Real normalise (void)
 Normalises this quaternion, and returns the previous length.
 
Quaternion Inverse () const
 
Quaternion UnitInverse () const
 
Quaternion Exp () const
 
Quaternion Log () const
 
Vector3 operator* (const Vector3 &rkVector) const
 
Radian getRoll (bool reprojectAxis=true) const
 
Radian getPitch (bool reprojectAxis=true) const
 
Radian getYaw (bool reprojectAxis=true) const
 
bool equals (const Quaternion &rhs, const Radian &tolerance) const
 Equality with tolerance (tolerance is max angle difference)
 
bool isNaN () const
 Check whether this quaternion contains valid values.
 
std::string to_s () const
 

Static Public Member Functions

static Quaternion Slerp (Real fT, const Quaternion &rkP, const Quaternion &rkQ, bool shortestPath=false)
 
static Quaternion SlerpExtraSpins (Real fT, const Quaternion &rkP, const Quaternion &rkQ, int iExtraSpins)
 
static void Intermediate (const Quaternion &rkQ0, const Quaternion &rkQ1, const Quaternion &rkQ2, Quaternion &rka, Quaternion &rkB)
 
static Quaternion Squad (Real fT, const Quaternion &rkP, const Quaternion &rkA, const Quaternion &rkB, const Quaternion &rkQ, bool shortestPath=false)
 
static Quaternion nlerp (Real fT, const Quaternion &rkP, const Quaternion &rkQ, bool shortestPath=false)
 

Public Attributes

Real w
 
Real x
 
Real y
 
Real z
 

Static Public Attributes

static const Real ms_fEpsilon = 1e-03f
 
static const Quaternion ZERO
 
static const Quaternion IDENTITY
 

Friends

OGREMATHLIB_EXPORT friend Quaternion operator* (Real fScalar, const Quaternion &rkQ)
 
OGREMATHLIB_EXPORT friend std::ostream & operator<< (std::ostream &o, const Quaternion &q)
 

Detailed Description

Implementation of a Quaternion, i.e. a rotation around an axis.

Member Function Documentation

◆ getPitch()

Radian OgreMathLib::Quaternion::getPitch ( bool  reprojectAxis = true) const

Calculate the local pitch element of this quaternion

Parameters
reprojectAxisBy 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.

◆ getRoll()

Radian OgreMathLib::Quaternion::getRoll ( bool  reprojectAxis = true) const

Calculate the local roll element of this quaternion.

Parameters
reprojectAxisBy 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.

◆ getYaw()

Radian OgreMathLib::Quaternion::getYaw ( bool  reprojectAxis = true) const

Calculate the local yaw element of this quaternion

Parameters
reprojectAxisBy default the method returns the 'intuitive' result that is, if you projected the local Z 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.

◆ swap()

void OgreMathLib::Quaternion::swap ( Quaternion other)
inline

Exchange the contents of this quaternion with another.

Friends And Related Function Documentation

◆ operator<<

OGREMATHLIB_EXPORT friend std::ostream& operator<< ( std::ostream &  o,
const Quaternion q 
)
friend

Function for writing to a stream. Outputs "Quaternion(w, x, y, z)" with w,x,y,z being the member values of the quaternion.


The documentation for this class was generated from the following files: