SO3Engine
|
Class for Euler rotations. More...
#include <SO3Euler.h>
Public Member Functions | |
Euler () | |
Default constructor. | |
Euler (const Ogre::Radian &y, const Ogre::Radian &p=Ogre::Radian(0.0f), const Ogre::Radian &r=Ogre::Radian(0.0f)) | |
Constructor which takes yaw, pitch and roll values. | |
Euler (Ogre::Real y, Ogre::Real p=0.0f, Ogre::Real r=0.0f) | |
Constructor which takes yaw, pitch and roll values as reals (radians). | |
Euler (const Ogre::Quaternion &quaternion) | |
Default constructor with presets. | |
Euler (const Ogre::Matrix3 &matrix) | |
Ogre::Radian | getYaw () const |
Get the Yaw angle. | |
Ogre::Radian | getPitch () const |
Get the Pitch angle. | |
Ogre::Radian | getRoll () const |
Get the Roll angle. | |
Euler & | setYaw (Ogre::Radian y) |
Set the yaw. | |
Euler & | setPitch (Ogre::Radian p) |
Set the pitch. | |
Euler & | setRoll (Ogre::Radian r) |
Set the roll. | |
Euler & | setRotation (const Ogre::Radian &y, const Ogre::Radian &p, const Ogre::Radian &r) |
Set all rotations at once. | |
Euler & | yaw (const Ogre::Radian &y) |
Apply a relative yaw. | |
Euler & | pitch (const Ogre::Radian &p) |
Apply a relative pitch. | |
Euler & | roll (const Ogre::Radian &r) |
Apply a relative roll. | |
Euler & | rotate (const Ogre::Radian &y, const Ogre::Radian &p, const Ogre::Radian &r) |
Apply all relative rotations at once. | |
Ogre::Vector3 | getForward () |
Get a vector pointing forwards. | |
Ogre::Vector3 | getRight () |
Get a vector pointing to the right. | |
Ogre::Vector3 | getUp () |
Get a vector pointing up. | |
Ogre::Quaternion | toQuaternion () |
Calculate the quaternion of the euler object. | |
operator Ogre::Quaternion () | |
Casting operator. This allows any ogre function that wants a Quaternion to accept a Euler instead. | |
Euler & | fromQuaternion (const Ogre::Quaternion &quaternion) |
Calculate the current euler angles of a given quaternion object. | |
Euler & | fromMatrix3 (const Ogre::Matrix3 &matrix) |
Calculate the current euler angles of a given matrix object. | |
Euler & | setDirection (const Ogre::Vector3 &v, bool setYaw=true, bool setPitch=true) |
Set the yaw and pitch to face in the given direction. | |
Euler & | normalise (bool normYaw=true, bool normPitch=true, bool normRoll=true) |
Normalise the selected rotations to be within the +/-180 degree range. | |
Euler | getRotationTo (const Ogre::Vector3 &dir, bool setYaw=true, bool setPitch=true, bool shortest=true) |
Return the relative euler angles required to rotate from the current forward direction to the specified dir vector. | |
Euler & | limitYaw (const Ogre::Radian &limit) |
Clamp the yaw angle to a range of +/-limit. | |
Euler & | limitPitch (const Ogre::Radian &limit) |
Clamp the pitch angle to a range of +/-limit. | |
Euler & | limitRoll (const Ogre::Radian &limit) |
Clamp the roll angle to a range of +/-limit. | |
Euler | operator+ (const Euler &rhs) const |
Add two euler objects. | |
Euler | operator- (const Euler &rhs) const |
Subtract two euler objects. | |
Euler | operator* (Ogre::Real rhs) const |
Interpolate the euler angles by rhs. | |
Ogre::Quaternion | operator* (const Euler &rhs) const |
Multiply two eulers. | |
Ogre::Vector3 | operator* (const Ogre::Vector3 &rhs) |
Apply the euler rotation to the vector rhs. | |
Euler & | operator= (const Euler &src) |
Copy assignment operator (Euler) | |
Euler & | operator= (const Ogre::Quaternion &quaternion) |
Copy assignment operator (Quaternion) | |
Euler & | operator= (const Ogre::Matrix3 &matrix) |
Copy assignment operator (Matrix3) | |
Protected Attributes | |
Ogre::Radian | mYaw |
Rotation around the Y axis. | |
Ogre::Radian | mPitch |
Rotation around the X axis. | |
Ogre::Radian | mRoll |
Rotation around the Z axis. | |
Ogre::Quaternion | mCachedQuaternion |
Cached quaternion equivalent of this euler object. | |
bool | mChanged |
Is the cached quaternion out of date? | |
Friends | |
std::ostream & | operator<< (std::ostream &o, const Euler &e) |
Stream operator, for printing the euler component angles to a stream. | |
Euler | operator* (Ogre::Real lhs, const Euler &rhs) |
Interpolate the euler angle by lhs. | |
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. |
Definition at line 24 of file SO3Euler.h.
Constructor & Destructor Documentation
◆ Euler() [1/5]
|
inline |
Default constructor.
Definition at line 28 of file SO3Euler.h.
◆ Euler() [2/5]
|
inline |
Constructor which takes yaw, pitch and roll values.
- Parameters
-
y Starting value for yaw p Starting value for pitch r Starting value for roll
Definition at line 39 of file SO3Euler.h.
◆ Euler() [3/5]
|
inline |
Constructor which takes yaw, pitch and roll values as reals (radians).
- Parameters
-
y Starting value for yaw [radian] p Starting value for pitch [radian] r Starting value for roll [radian]
Definition at line 50 of file SO3Euler.h.
◆ Euler() [4/5]
|
inlineexplicit |
Default constructor with presets.
- Parameters
-
quaternion Calculate starting values from this quaternion
Definition at line 59 of file SO3Euler.h.
◆ Euler() [5/5]
|
inlineexplicit |
Definition at line 64 of file SO3Euler.h.
Member Function Documentation
◆ fromMatrix3()
|
inline |
Calculate the current euler angles of a given matrix object.
- Parameters
-
matrix Matrix3 which is used to calculate current euler angles.
Definition at line 219 of file SO3Euler.h.
◆ fromQuaternion()
|
inline |
Calculate the current euler angles of a given quaternion object.
- Parameters
-
quaternion Quaternion which is used to calculate current euler angles.
Definition at line 207 of file SO3Euler.h.
◆ getForward()
|
inline |
Get a vector pointing forwards.
Definition at line 175 of file SO3Euler.h.
◆ getPitch()
|
inline |
Get the Pitch angle.
Definition at line 73 of file SO3Euler.h.
◆ getRight()
|
inline |
Get a vector pointing to the right.
Definition at line 178 of file SO3Euler.h.
◆ getRoll()
|
inline |
Get the Roll angle.
Definition at line 76 of file SO3Euler.h.
◆ getRotationTo()
|
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
-
setYaw If false, the angle is set to 0. If true, the angle is calculated. setPitch If false, the angle is set to 0. If true, the angle is calculated. shortest If 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).
Definition at line 338 of file SO3Euler.h.
◆ getUp()
|
inline |
Get a vector pointing up.
Definition at line 181 of file SO3Euler.h.
◆ getYaw()
|
inline |
Get the Yaw angle.
Definition at line 70 of file SO3Euler.h.
◆ limitPitch()
|
inline |
Clamp the pitch angle to a range of +/-limit.
Definition at line 368 of file SO3Euler.h.
◆ limitRoll()
|
inline |
Clamp the roll angle to a range of +/-limit.
Definition at line 384 of file SO3Euler.h.
◆ limitYaw()
|
inline |
Clamp the yaw angle to a range of +/-limit.
Definition at line 352 of file SO3Euler.h.
◆ normalise()
|
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
-
normYaw If false, the yaw isn't normalized. normPitch If false, the pitch isn't normalized. normRoll If false, the roll isn't normalized.
Definition at line 250 of file SO3Euler.h.
◆ operator Ogre::Quaternion()
|
inline |
Casting operator. This allows any ogre function that wants a Quaternion to accept a Euler instead.
Definition at line 198 of file SO3Euler.h.
◆ operator*() [1/3]
|
inline |
Multiply two eulers.
This has the same effect as multiplying quaternions.
- Returns
- The result is a quaternion.
Definition at line 438 of file SO3Euler.h.
◆ operator*() [2/3]
|
inline |
Apply the euler rotation to the vector rhs.
Definition at line 445 of file SO3Euler.h.
◆ operator*() [3/3]
|
inline |
Interpolate the euler angles by rhs.
Definition at line 422 of file SO3Euler.h.
◆ operator+()
Add two euler objects.
Definition at line 407 of file SO3Euler.h.
◆ operator-()
Subtract two euler objects.
This finds the difference as relative angles.
Definition at line 416 of file SO3Euler.h.
◆ operator=() [1/3]
Copy assignment operator (Euler)
Definition at line 451 of file SO3Euler.h.
◆ operator=() [2/3]
|
inline |
Copy assignment operator (Matrix3)
Definition at line 465 of file SO3Euler.h.
◆ operator=() [3/3]
|
inline |
Copy assignment operator (Quaternion)
Definition at line 458 of file SO3Euler.h.
◆ pitch()
|
inline |
Apply a relative pitch.
- Parameters
-
p Angle to add on current pitch
Definition at line 141 of file SO3Euler.h.
◆ roll()
|
inline |
Apply a relative roll.
- Parameters
-
r Angle to add on current roll
Definition at line 152 of file SO3Euler.h.
◆ rotate()
|
inline |
Apply all relative rotations at once.
- Parameters
-
y Angle to add on current yaw p Angle to add on current pitch r Angle to add on current roll
Definition at line 165 of file SO3Euler.h.
◆ setDirection()
|
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
-
setYaw If false, the yaw isn't changed. setPitch If false, the pitch isn't changed.
Definition at line 232 of file SO3Euler.h.
◆ setPitch()
|
inline |
◆ setRoll()
|
inline |
◆ setRotation()
|
inline |
Set all rotations at once.
- Parameters
-
y New value for yaw p New value for pitch r New value for roll
Definition at line 117 of file SO3Euler.h.
◆ setYaw()
|
inline |
◆ toQuaternion()
|
inline |
Calculate the quaternion of the euler object.
The result is cached, it is only recalculated when the component euler angles are changed.
Definition at line 187 of file SO3Euler.h.
◆ yaw()
|
inline |
Apply a relative yaw.
- Parameters
-
y Angle to add on current yaw
Definition at line 130 of file SO3Euler.h.
Friends And Related Symbol Documentation
◆ operator*
Interpolate the euler angle by lhs.
Definition at line 428 of file SO3Euler.h.
◆ operator<<
|
friend |
Stream operator, for printing the euler component angles to a stream.
Definition at line 400 of file SO3Euler.h.
Member Data Documentation
◆ mCachedQuaternion
|
protected |
Cached quaternion equivalent of this euler object.
Definition at line 475 of file SO3Euler.h.
◆ mChanged
|
protected |
Is the cached quaternion out of date?
Definition at line 476 of file SO3Euler.h.
◆ mPitch
|
protected |
Rotation around the X axis.
Definition at line 473 of file SO3Euler.h.
◆ mRoll
|
protected |
Rotation around the Z axis.
Definition at line 474 of file SO3Euler.h.
◆ mYaw
|
protected |
Rotation around the Y axis.
Definition at line 472 of file SO3Euler.h.
The documentation for this class was generated from the following file:
- include/SO3Utils/SO3Euler.h
Generated by 1.9.8