#include <Karto.h>
Public Member Functions | |
void | FromEulerAngles (kt_double yaw, kt_double pitch, kt_double roll) |
kt_double | GetW () const |
kt_double | GetX () const |
kt_double | GetY () const |
kt_double | GetZ () const |
kt_bool | operator!= (const Quaternion &rOther) const |
Quaternion & | operator= (const Quaternion &rQuaternion) |
kt_bool | operator== (const Quaternion &rOther) const |
Quaternion () | |
Quaternion (kt_double x, kt_double y, kt_double z, kt_double w) | |
Quaternion (const Quaternion &rQuaternion) | |
void | SetW (kt_double w) |
void | SetX (kt_double x) |
void | SetY (kt_double y) |
void | SetZ (kt_double z) |
void | ToEulerAngles (kt_double &rYaw, kt_double &rPitch, kt_double &rRoll) const |
Private Attributes | |
kt_double | m_Values [4] |
Friends | |
std::ostream & | operator<< (std::ostream &rStream, const Quaternion &rQuaternion) |
Defines an orientation as a quaternion rotation using the positive Z axis as the zero reference.
Q = w + ix + jy + kz
w = c_1 * c_2 * c_3 - s_1 * s_2 * s_3
x = s_1 * s_2 * c_3 + c_1 * c_2 * s_3
y = s_1 * c_2 * c_3 + c_1 * s_2 * s_3
z = c_1 * s_2 * c_3 - s_1 * c_2 * s_3
where
c_1 = cos(theta/2)
c_2 = cos(phi/2)
c_3 = cos(psi/2)
s_1 = sin(theta/2)
s_2 = sin(phi/2)
s_3 = sin(psi/2)
and
theta is the angle of rotation about the Y axis measured from the Z axis.
phi is the angle of rotation about the Z axis measured from the X axis.
psi is the angle of rotation about the X axis measured from the Y axis.
(All angles are right-handed.)
karto::Quaternion::Quaternion | ( | ) | [inline] |
karto::Quaternion::Quaternion | ( | kt_double | x, |
kt_double | y, | ||
kt_double | z, | ||
kt_double | w | ||
) | [inline] |
karto::Quaternion::Quaternion | ( | const Quaternion & | rQuaternion | ) | [inline] |
void karto::Quaternion::FromEulerAngles | ( | kt_double | yaw, |
kt_double | pitch, | ||
kt_double | roll | ||
) | [inline] |
Set x,y,z,w values of the quaternion based on Euler angles. Source: http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htm
yaw | |
pitch | |
roll |
kt_double karto::Quaternion::GetW | ( | ) | const [inline] |
kt_double karto::Quaternion::GetX | ( | ) | const [inline] |
kt_double karto::Quaternion::GetY | ( | ) | const [inline] |
kt_double karto::Quaternion::GetZ | ( | ) | const [inline] |
kt_bool karto::Quaternion::operator!= | ( | const Quaternion & | rOther | ) | const [inline] |
Quaternion& karto::Quaternion::operator= | ( | const Quaternion & | rQuaternion | ) | [inline] |
kt_bool karto::Quaternion::operator== | ( | const Quaternion & | rOther | ) | const [inline] |
void karto::Quaternion::SetW | ( | kt_double | w | ) | [inline] |
void karto::Quaternion::SetX | ( | kt_double | x | ) | [inline] |
void karto::Quaternion::SetY | ( | kt_double | y | ) | [inline] |
void karto::Quaternion::SetZ | ( | kt_double | z | ) | [inline] |
void karto::Quaternion::ToEulerAngles | ( | kt_double & | rYaw, |
kt_double & | rPitch, | ||
kt_double & | rRoll | ||
) | const [inline] |
Converts this quaternion into Euler angles Source: http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm
rYaw | |
rPitch | |
rRoll |
std::ostream& operator<< | ( | std::ostream & | rStream, |
const Quaternion & | rQuaternion | ||
) | [friend] |
kt_double karto::Quaternion::m_Values[4] [private] |