 |
Blamite Game Engine - blam!
00453.06.08.26.0624.blamite
The core library for the Blamite Game Engine.
|
Go to the documentation of this file.
12 #ifndef HGUARD_OGRE_MATHS_EULER_H
13 #define HGUARD_OGRE_MATHS_EULER_H
15 #include <OGRE/OgreMath.h>
16 #include <OGRE/OgreVector3.h>
17 #include <OGRE/OgreQuaternion.h>
18 #include <OGRE/OgreMatrix3.h>
44 Euler(
const Radian&
y,
const Radian& p = Radian(0.0f),
const Radian& r = Radian(0.0f))
55 Euler(Real
y, Real p = 0.0f, Real r = 0.0f)
64 explicit Euler(
const Quaternion& quaternion)
69 explicit Euler(
const Matrix3& matrix)
75 inline Radian
yaw()
const {
return mYaw; }
170 inline Euler&
rotate(
const Radian&
y,
const Radian& p,
const Radian& r)
203 inline operator Quaternion()
const
215 quaternion.ToRotationMatrix(rotmat);
243 mYaw = Math::ATan2(-d.x, -d.z);
255 inline Euler&
normalise(
bool normYaw =
true,
bool normPitch =
true,
bool normRoll =
true)
317 o <<
"<Y:" << e.
mYaw <<
", P:" << e.
mPitch <<
", R:" << e.
mRoll <<
">";
355 Euler e1(*
this), e2(rhs);
398 return !(left ==
right);
406 && left.
up().positionEquals(
right.up())
419 Real rangle = angle.valueRadians();
420 if (rangle < -Math::PI)
422 rangle = fmod(rangle, -Math::TWO_PI);
423 if (rangle < -Math::PI)
425 rangle += Math::TWO_PI;
430 else if (rangle > Math::PI)
432 rangle = fmod(rangle, Math::TWO_PI);
433 if (rangle > Math::PI)
435 rangle -= Math::TWO_PI;
450 else if (angle < -limit)
void wrapAngle(Radian &angle)
Definition: OgreEuler.h:417
Euler & setRoll(Radian r)
Set the roll.
Definition: OgreEuler.h:109
Vector3 up() const
Get a vector pointing up.
Definition: OgreEuler.h:186
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 specifi...
Definition: OgreEuler.h:280
@ Real
Definition: globals.h:25
Euler operator*(Real rhs) const
Interpolate the euler angles by rhs.
Definition: OgreEuler.h:337
Euler(const Radian &y, const Radian &p=Radian(0.0f), const Radian &r=Radian(0.0f))
Constructor which takes yaw, pitch and roll values.
Definition: OgreEuler.h:44
Vector3 right() const
Get a vector pointing to the right.
Definition: OgreEuler.h:183
Radian yaw() const
Get the Yaw angle.
Definition: OgreEuler.h:75
Euler(const Quaternion &quaternion)
Default constructor with presets.
Definition: OgreEuler.h:64
Euler & limitRoll(const Radian &limit)
Clamp the roll angle to a range of +/-limit.
Definition: OgreEuler.h:308
friend std::ostream & operator<<(std::ostream &o, const Euler &e)
Stream operator, for printing the euler component angles to a stream.
Definition: OgreEuler.h:315
Euler & fromQuaternion(const Quaternion &quaternion)
Calculate the current euler angles of a given quaternion object.
Definition: OgreEuler.h:212
Quaternion toQuaternion() const
Calculate the quaternion of the euler object.
Definition: OgreEuler.h:192
Radian pitch() const
Get the Pitch angle.
Definition: OgreEuler.h:78
Radian mPitch
Rotation around the X axis.
Definition: OgreEuler.h:412
Euler & limitPitch(const Radian &limit)
Clamp the pitch angle to a range of +/-limit.
Definition: OgreEuler.h:301
Euler operator-(const Euler &rhs) const
Subtract two euler objects.
Definition: OgreEuler.h:331
font DisplayOffset y
Definition: README.txt:68
Euler & operator=(const Matrix3 &matrix)
Copy assignment operator (Matrix3)
Definition: OgreEuler.h:382
Euler & direction(const Vector3 &v, bool setYaw=true, bool setPitch=true)
Set the yaw and pitch to face in the given direction.
Definition: OgreEuler.h:237
Quaternion mCachedQuaternion
Cached quaternion equivalent of this euler object.
Definition: OgreEuler.h:414
Euler & roll(const Radian &r)
Apply a relative roll.
Definition: OgreEuler.h:157
Euler & pitch(const Radian &p)
Apply a relative pitch.
Definition: OgreEuler.h:146
Euler & setYaw(Radian y)
Set the yaw.
Definition: OgreEuler.h:87
Vector3 forward() const
Get a vector pointing forwards.
Definition: OgreEuler.h:180
friend Euler operator*(Real lhs, const Euler &rhs)
Interpolate the euler angle by lhs.
Definition: OgreEuler.h:343
friend bool sameOrientation(const Euler &left, const Euler &right)
Definition: OgreEuler.h:401
Radian mRoll
Rotation around the Z axis.
Definition: OgreEuler.h:413
Euler & setPitch(Radian p)
Set the pitch.
Definition: OgreEuler.h:98
Radian mYaw
Rotation around the Y axis.
Definition: OgreEuler.h:411
void limitAngle(Radian &angle, const Radian &limit)
Definition: OgreEuler.h:443
Euler operator+(const Euler &rhs) const
Add two euler objects.
Definition: OgreEuler.h:322
Euler & orientation(const Radian &y, const Radian &p, const Radian &r)
Set all rotations at once.
Definition: OgreEuler.h:122
Radian roll() const
Get the Roll angle.
Definition: OgreEuler.h:81
Vector3 operator*(const Vector3 &rhs) const
Apply the euler rotation to the vector rhs.
Definition: OgreEuler.h:361
Euler & fromMatrix3(const Matrix3 &matrix)
Calculate the current euler angles of a given matrix object.
Definition: OgreEuler.h:224
Euler & operator=(const Quaternion &quaternion)
Copy assignment operator (Quaternion)
Definition: OgreEuler.h:375
Euler & normalise(bool normYaw=true, bool normPitch=true, bool normRoll=true)
Normalise the selected rotations to be within the +/-180 degree range.
Definition: OgreEuler.h:255
Euler & yaw(const Radian &y)
Apply a relative yaw.
Definition: OgreEuler.h:135
bool mChanged
Is the cached quaternion out of date?
Definition: OgreEuler.h:415
Definition: world_objects.h:23
friend bool operator==(const Euler &left, const Euler &right)
Definition: OgreEuler.h:388
Euler & operator=(const Euler &src)
Copy assignment operator (Euler)
Definition: OgreEuler.h:368
Euler & rotate(const Radian &y, const Radian &p, const Radian &r)
Apply all relative rotations at once.
Definition: OgreEuler.h:170
Quaternion operator*(Euler rhs) const
Multiply two eulers.
Definition: OgreEuler.h:353
Euler & limitYaw(const Radian &limit)
Clamp the yaw angle to a range of +/-limit.
Definition: OgreEuler.h:294
friend bool operator!=(const Euler &left, const Euler &right)
Definition: OgreEuler.h:396
Class for Euler rotations.
Definition: OgreEuler.h:29
Euler(Real y, Real p=0.0f, Real r=0.0f)
Constructor which takes yaw, pitch and roll values as reals (radians).
Definition: OgreEuler.h:55
Euler()
Default constructor.
Definition: OgreEuler.h:33
Euler(const Matrix3 &matrix)
Definition: OgreEuler.h:69