Elaztek Developer Hub
Blamite Game Engine - blam!  00453.06.08.26.0624.blamite
The core library for the Blamite Game Engine.
Ogre::Euler Class Reference

Class for Euler rotations. More...

#include <OgreEuler.h>

Public Member Functions

 Euler ()
 Default constructor. More...
 
 Euler (const Radian &y, const Radian &p=Radian(0.0f), const Radian &r=Radian(0.0f))
 Constructor which takes yaw, pitch and roll values. More...
 
 Euler (Real y, Real p=0.0f, Real r=0.0f)
 Constructor which takes yaw, pitch and roll values as reals (radians). More...
 
 Euler (const Quaternion &quaternion)
 Default constructor with presets. More...
 
 Euler (const Matrix3 &matrix)
 
Radian yaw () const
 Get the Yaw angle. More...
 
Radian pitch () const
 Get the Pitch angle. More...
 
Radian roll () const
 Get the Roll angle. More...
 
EulersetYaw (Radian y)
 Set the yaw. More...
 
EulersetPitch (Radian p)
 Set the pitch. More...
 
EulersetRoll (Radian r)
 Set the roll. More...
 
Eulerorientation (const Radian &y, const Radian &p, const Radian &r)
 Set all rotations at once. More...
 
Euleryaw (const Radian &y)
 Apply a relative yaw. More...
 
Eulerpitch (const Radian &p)
 Apply a relative pitch. More...
 
Eulerroll (const Radian &r)
 Apply a relative roll. More...
 
Eulerrotate (const Radian &y, const Radian &p, const Radian &r)
 Apply all relative rotations at once. More...
 
Vector3 forward () const
 Get a vector pointing forwards. More...
 
Vector3 right () const
 Get a vector pointing to the right. More...
 
Vector3 up () const
 Get a vector pointing up. More...
 
Quaternion toQuaternion () const
 Calculate the quaternion of the euler object. More...
 
 operator Quaternion () const
 Casting operator. This allows any ogre function that wants a Quaternion to accept a Euler instead. More...
 
EulerfromQuaternion (const Quaternion &quaternion)
 Calculate the current euler angles of a given quaternion object. More...
 
EulerfromMatrix3 (const Matrix3 &matrix)
 Calculate the current euler angles of a given matrix object. More...
 
Eulerdirection (const Vector3 &v, bool setYaw=true, bool setPitch=true)
 Set the yaw and pitch to face in the given direction. More...
 
Eulernormalise (bool normYaw=true, bool normPitch=true, bool normRoll=true)
 Normalise the selected rotations to be within the +/-180 degree range. More...
 
Euler rotationTo (const Vector3 &dir, bool setYaw=true, bool setPitch=true, bool shortest=true) const
 Return the relative euler angles required to rotate from the current forward direction to the specified dir vector. More...
 
EulerlimitYaw (const Radian &limit)
 Clamp the yaw angle to a range of +/-limit. More...
 
EulerlimitPitch (const Radian &limit)
 Clamp the pitch angle to a range of +/-limit. More...
 
EulerlimitRoll (const Radian &limit)
 Clamp the roll angle to a range of +/-limit. More...
 
Euler operator+ (const Euler &rhs) const
 Add two euler objects. More...
 
Euler operator- (const Euler &rhs) const
 Subtract two euler objects. More...
 
Euler operator* (Real rhs) const
 Interpolate the euler angles by rhs. More...
 
Quaternion operator* (Euler rhs) const
 Multiply two eulers. More...
 
Vector3 operator* (const Vector3 &rhs) const
 Apply the euler rotation to the vector rhs. More...
 
Euleroperator= (const Euler &src)
 Copy assignment operator (Euler) More...
 
Euleroperator= (const Quaternion &quaternion)
 Copy assignment operator (Quaternion) More...
 
Euleroperator= (const Matrix3 &matrix)
 Copy assignment operator (Matrix3) More...
 

Protected Member Functions

void wrapAngle (Radian &angle)
 
void limitAngle (Radian &angle, const Radian &limit)
 

Protected Attributes

Radian mYaw
 Rotation around the Y axis. More...
 
Radian mPitch
 Rotation around the X axis. More...
 
Radian mRoll
 Rotation around the Z axis. More...
 
Quaternion mCachedQuaternion
 Cached quaternion equivalent of this euler object. More...
 
bool mChanged
 Is the cached quaternion out of date? More...
 

Friends

std::ostream & operator<< (std::ostream &o, const Euler &e)
 Stream operator, for printing the euler component angles to a stream. More...
 
Euler operator* (Real lhs, const Euler &rhs)
 Interpolate the euler angle by lhs. More...
 
bool operator== (const Euler &left, const Euler &right)
 
bool operator!= (const Euler &left, const Euler &right)
 
bool sameOrientation (const Euler &left, const Euler &right)
 

Detailed Description

Class for Euler rotations.

Yaw is a rotation around the Y axis.Pitch is a rotation around the X axis.Roll is a rotation around the Z axis.

Constructor & Destructor Documentation

◆ Euler() [1/5]

Ogre::Euler::Euler ( )
inline

Default constructor.

+ Here is the caller graph for this function:

◆ Euler() [2/5]

Ogre::Euler::Euler ( const Radian &  y,
const Radian &  p = Radian(0.0f),
const Radian &  r = Radian(0.0f) 
)
inline

Constructor which takes yaw, pitch and roll values.

Parameters
yStarting value for yaw
pStarting value for pitch
rStarting value for roll

◆ Euler() [3/5]

Ogre::Euler::Euler ( Real  y,
Real  p = 0.0f,
Real  r = 0.0f 
)
inline

Constructor which takes yaw, pitch and roll values as reals (radians).

Parameters
yStarting value for yaw [radian]
pStarting value for pitch [radian]
rStarting value for roll [radian]

◆ Euler() [4/5]

Ogre::Euler::Euler ( const Quaternion &  quaternion)
inlineexplicit

Default constructor with presets.

Parameters
quaternionCalculate starting values from this quaternion
+ Here is the call graph for this function:

◆ Euler() [5/5]

Ogre::Euler::Euler ( const Matrix3 &  matrix)
inlineexplicit
+ Here is the call graph for this function:

Member Function Documentation

◆ direction()

Euler& Ogre::Euler::direction ( const Vector3 &  v,
bool  setYaw = true,
bool  setPitch = true 
)
inline

Set the yaw and pitch to face in the given direction.

The direction doesn't need to be normalised. Roll is always unaffected.

Parameters
setYawIf false, the yaw isn't changed.
setPitchIf false, the pitch isn't changed.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ forward()

Vector3 Ogre::Euler::forward ( ) const
inline

Get a vector pointing forwards.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromMatrix3()

Euler& Ogre::Euler::fromMatrix3 ( const Matrix3 &  matrix)
inline

Calculate the current euler angles of a given matrix object.

Parameters
matrixMatrix3 which is used to calculate current euler angles.
+ Here is the caller graph for this function:

◆ fromQuaternion()

Euler& Ogre::Euler::fromQuaternion ( const Quaternion &  quaternion)
inline

Calculate the current euler angles of a given quaternion object.

Parameters
quaternionQuaternion which is used to calculate current euler angles.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ limitAngle()

void Ogre::Euler::limitAngle ( Radian &  angle,
const Radian &  limit 
)
inlineprotected
+ Here is the caller graph for this function:

◆ limitPitch()

Euler& Ogre::Euler::limitPitch ( const Radian &  limit)
inline

Clamp the pitch angle to a range of +/-limit.

+ Here is the call graph for this function:

◆ limitRoll()

Euler& Ogre::Euler::limitRoll ( const Radian &  limit)
inline

Clamp the roll angle to a range of +/-limit.

+ Here is the call graph for this function:

◆ limitYaw()

Euler& Ogre::Euler::limitYaw ( const Radian &  limit)
inline

Clamp the yaw angle to a range of +/-limit.

+ Here is the call graph for this function:

◆ normalise()

Euler& Ogre::Euler::normalise ( bool  normYaw = true,
bool  normPitch = true,
bool  normRoll = true 
)
inline

Normalise the selected rotations to be within the +/-180 degree range.

The normalise uses a wrap around, so for example a yaw of 360 degrees becomes 0 degrees, and -190 degrees becomes 170.

Parameters
normYawIf false, the yaw isn't normalized.
normPitchIf false, the pitch isn't normalized.
normRollIf false, the roll isn't normalized.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator Quaternion()

Ogre::Euler::operator Quaternion ( ) const
inline

Casting operator. This allows any ogre function that wants a Quaternion to accept a Euler instead.

+ Here is the call graph for this function:

◆ operator*() [1/3]

Vector3 Ogre::Euler::operator* ( const Vector3 &  rhs) const
inline

Apply the euler rotation to the vector rhs.

+ Here is the call graph for this function:

◆ operator*() [2/3]

Quaternion Ogre::Euler::operator* ( Euler  rhs) const
inline

Multiply two eulers.

This has the same effect as multiplying quaternions.

Returns
The result is a quaternion.
+ Here is the call graph for this function:

◆ operator*() [3/3]

Euler Ogre::Euler::operator* ( Real  rhs) const
inline

Interpolate the euler angles by rhs.

+ Here is the call graph for this function:

◆ operator+()

Euler Ogre::Euler::operator+ ( const Euler rhs) const
inline

Add two euler objects.

+ Here is the call graph for this function:

◆ operator-()

Euler Ogre::Euler::operator- ( const Euler rhs) const
inline

Subtract two euler objects.

This finds the difference as relative angles.

+ Here is the call graph for this function:

◆ operator=() [1/3]

Euler& Ogre::Euler::operator= ( const Euler src)
inline

Copy assignment operator (Euler)

+ Here is the call graph for this function:

◆ operator=() [2/3]

Euler& Ogre::Euler::operator= ( const Matrix3 &  matrix)
inline

Copy assignment operator (Matrix3)

+ Here is the call graph for this function:

◆ operator=() [3/3]

Euler& Ogre::Euler::operator= ( const Quaternion &  quaternion)
inline

Copy assignment operator (Quaternion)

+ Here is the call graph for this function:

◆ orientation()

Euler& Ogre::Euler::orientation ( const Radian &  y,
const Radian &  p,
const Radian &  r 
)
inline

Set all rotations at once.

Parameters
yNew value for yaw
pNew value for pitch
rNew value for roll
+ Here is the caller graph for this function:

◆ pitch() [1/2]

Radian Ogre::Euler::pitch ( ) const
inline

Get the Pitch angle.

+ Here is the caller graph for this function:

◆ pitch() [2/2]

Euler& Ogre::Euler::pitch ( const Radian &  p)
inline

Apply a relative pitch.

Parameters
pAngle to add on current pitch

◆ right()

Vector3 Ogre::Euler::right ( ) const
inline

Get a vector pointing to the right.

+ Here is the call graph for this function:

◆ roll() [1/2]

Radian Ogre::Euler::roll ( ) const
inline

Get the Roll angle.

+ Here is the caller graph for this function:

◆ roll() [2/2]

Euler& Ogre::Euler::roll ( const Radian &  r)
inline

Apply a relative roll.

Parameters
rAngle to add on current roll

◆ rotate()

Euler& Ogre::Euler::rotate ( const Radian &  y,
const Radian &  p,
const Radian &  r 
)
inline

Apply all relative rotations at once.

Parameters
yAngle to add on current yaw
pAngle to add on current pitch
rAngle to add on current roll

◆ rotationTo()

Euler Ogre::Euler::rotationTo ( const Vector3 &  dir,
bool  setYaw = true,
bool  setPitch = true,
bool  shortest = true 
) const
inline

Return the relative euler angles required to rotate from the current forward direction to the specified dir vector.

The result euler can then be added to the current euler to immediately face dir. The rotation won't flip upside down then roll instead of a 180 degree yaw.

Parameters
setYawIf false, the angle is set to 0. If true, the angle is calculated.
setPitchIf false, the angle is set to 0. If true, the angle is calculated.
shortestIf false, the full value of each angle is used. If true, the angles are normalised and the shortest rotation is found to face the correct direction. For example, when false a yaw of 1000 degrees and a dir of (0,0,-1) will return a -1000 degree yaw. When true, the same yaw and dir would give 80 degrees (1080 degrees faces the same way as (0,0,-1).
+ Here is the call graph for this function:

◆ setPitch()

Euler& Ogre::Euler::setPitch ( Radian  p)
inline

Set the pitch.

Parameters
pNew value for pitch
+ Here is the caller graph for this function:

◆ setRoll()

Euler& Ogre::Euler::setRoll ( Radian  r)
inline

Set the roll.

Parameters
rNew value for roll
+ Here is the caller graph for this function:

◆ setYaw()

Euler& Ogre::Euler::setYaw ( Radian  y)
inline

Set the yaw.

Parameters
yNew value for yaw
+ Here is the caller graph for this function:

◆ toQuaternion()

Quaternion Ogre::Euler::toQuaternion ( ) const
inline

Calculate the quaternion of the euler object.

The result is cached, it is only recalculated when the component euler angles are changed.

+ Here is the caller graph for this function:

◆ up()

Vector3 Ogre::Euler::up ( ) const
inline

Get a vector pointing up.

+ Here is the call graph for this function:

◆ wrapAngle()

void Ogre::Euler::wrapAngle ( Radian &  angle)
inlineprotected
+ Here is the caller graph for this function:

◆ yaw() [1/2]

Radian Ogre::Euler::yaw ( ) const
inline

Get the Yaw angle.

+ Here is the caller graph for this function:

◆ yaw() [2/2]

Euler& Ogre::Euler::yaw ( const Radian &  y)
inline

Apply a relative yaw.

Parameters
yAngle to add on current yaw

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const Euler left,
const Euler right 
)
friend

◆ operator*

Euler operator* ( Real  lhs,
const Euler rhs 
)
friend

Interpolate the euler angle by lhs.

◆ operator<<

std::ostream& operator<< ( std::ostream &  o,
const Euler e 
)
friend

Stream operator, for printing the euler component angles to a stream.

◆ operator==

bool operator== ( const Euler left,
const Euler right 
)
friend

◆ sameOrientation

bool sameOrientation ( const Euler left,
const Euler right 
)
friend

Member Data Documentation

◆ mCachedQuaternion

Quaternion Ogre::Euler::mCachedQuaternion
mutableprotected

Cached quaternion equivalent of this euler object.

◆ mChanged

bool Ogre::Euler::mChanged
mutableprotected

Is the cached quaternion out of date?

◆ mPitch

Radian Ogre::Euler::mPitch
protected

Rotation around the X axis.

◆ mRoll

Radian Ogre::Euler::mRoll
protected

Rotation around the Z axis.

◆ mYaw

Radian Ogre::Euler::mYaw
protected

Rotation around the Y axis.


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