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. | |
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.
|
inline |
Default constructor.
Definition at line 28 of file SO3Euler.h.
|
inline |
Constructor which takes yaw, pitch and roll values.
y | Starting value for yaw |
p | Starting value for pitch |
r | Starting value for roll |
Definition at line 39 of file SO3Euler.h.
|
inline |
Constructor which takes yaw, pitch and roll values as reals (radians).
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.
|
inlineexplicit |
Default constructor with presets.
quaternion | Calculate starting values from this quaternion |
Definition at line 59 of file SO3Euler.h.
|
inlineexplicit |
Definition at line 64 of file SO3Euler.h.
|
inline |
Calculate the current euler angles of a given matrix object.
matrix | Matrix3 which is used to calculate current euler angles. |
Definition at line 219 of file SO3Euler.h.
|
inline |
Calculate the current euler angles of a given quaternion object.
quaternion | Quaternion which is used to calculate current euler angles. |
Definition at line 207 of file SO3Euler.h.
|
inline |
Get a vector pointing forwards.
Definition at line 175 of file SO3Euler.h.
|
inline |
Get the Pitch angle.
Definition at line 73 of file SO3Euler.h.
|
inline |
Get a vector pointing to the right.
Definition at line 178 of file SO3Euler.h.
|
inline |
Get the Roll angle.
Definition at line 76 of file SO3Euler.h.
|
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.
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.
|
inline |
Get a vector pointing up.
Definition at line 181 of file SO3Euler.h.
|
inline |
Get the Yaw angle.
Definition at line 70 of file SO3Euler.h.
|
inline |
Clamp the pitch angle to a range of +/-limit.
Definition at line 368 of file SO3Euler.h.
|
inline |
Clamp the roll angle to a range of +/-limit.
Definition at line 384 of file SO3Euler.h.
|
inline |
Clamp the yaw angle to a range of +/-limit.
Definition at line 352 of file SO3Euler.h.
|
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.
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.
|
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.
|
inline |
Multiply two eulers.
This has the same effect as multiplying quaternions.
Definition at line 438 of file SO3Euler.h.
|
inline |
Apply the euler rotation to the vector rhs.
Definition at line 445 of file SO3Euler.h.
|
inline |
Interpolate the euler angles by rhs.
Definition at line 422 of file SO3Euler.h.
Add two euler objects.
Definition at line 407 of file SO3Euler.h.
Subtract two euler objects.
This finds the difference as relative angles.
Definition at line 416 of file SO3Euler.h.
Copy assignment operator (Euler)
Definition at line 451 of file SO3Euler.h.
|
inline |
Copy assignment operator (Matrix3)
Definition at line 465 of file SO3Euler.h.
|
inline |
Copy assignment operator (Quaternion)
Definition at line 458 of file SO3Euler.h.
|
inline |
Apply a relative pitch.
p | Angle to add on current pitch |
Definition at line 141 of file SO3Euler.h.
|
inline |
Apply a relative roll.
r | Angle to add on current roll |
Definition at line 152 of file SO3Euler.h.
|
inline |
Apply all relative rotations at once.
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.
|
inline |
Set the yaw and pitch to face in the given direction.
The direction doesn't need to be normalised. Roll is always unaffected.
setYaw | If false, the yaw isn't changed. |
setPitch | If false, the pitch isn't changed. |
Definition at line 232 of file SO3Euler.h.
|
inline |
|
inline |
|
inline |
Set all rotations at once.
y | New value for yaw |
p | New value for pitch |
r | New value for roll |
Definition at line 117 of file SO3Euler.h.
|
inline |
|
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.
|
inline |
Apply a relative yaw.
y | Angle to add on current yaw |
Definition at line 130 of file SO3Euler.h.
Interpolate the euler angle by lhs.
Definition at line 428 of file SO3Euler.h.
|
friend |
Stream operator, for printing the euler component angles to a stream.
Definition at line 400 of file SO3Euler.h.
|
protected |
Cached quaternion equivalent of this euler object.
Definition at line 475 of file SO3Euler.h.
|
protected |
Is the cached quaternion out of date?
Definition at line 476 of file SO3Euler.h.
|
protected |
Rotation around the X axis.
Definition at line 473 of file SO3Euler.h.
|
protected |
Rotation around the Z axis.
Definition at line 474 of file SO3Euler.h.
|
protected |
Rotation around the Y axis.
Definition at line 472 of file SO3Euler.h.