#include <Geometry.h>
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.)
Definition at line 1307 of file Geometry.h.
karto::Quaternion::Quaternion | ( | ) | [inline] |
Quaternion with default (x=0, y=0, z=0, w=1) values
Definition at line 1313 of file Geometry.h.
karto::Quaternion::Quaternion | ( | kt_double | x, |
kt_double | y, | ||
kt_double | z, | ||
kt_double | w | ||
) | [inline] |
Quaternion using given x, y, z, w values.
x | x |
y | y |
z | z |
w | w |
Definition at line 1328 of file Geometry.h.
karto::Quaternion::Quaternion | ( | const Vector4d & | rVector | ) | [inline] |
Quaternion from given Vector4d
Definition at line 1339 of file Geometry.h.
karto::Quaternion::Quaternion | ( | const Quaternion & | rOther | ) | [inline] |
Copy constructor
Definition at line 1350 of file Geometry.h.
void karto::Quaternion::FromAngleAxis | ( | kt_double | angleInRadians, |
const karto::Vector3d & | rAxis | ||
) |
Computes the equivalent quaternion from the given angle-axis form
Definition at line 118 of file Geometry.cpp.
void karto::Quaternion::FromEulerAngles | ( | kt_double | yaw, |
kt_double | pitch, | ||
kt_double | roll | ||
) |
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 | yaw |
pitch | pitch |
roll | roll |
Definition at line 170 of file Geometry.cpp.
const Vector4d karto::Quaternion::GetAsVector4 | ( | ) | const [inline] |
This quaternion as a 4D vector
Definition at line 1435 of file Geometry.h.
kt_double karto::Quaternion::GetW | ( | ) | const [inline] |
Returns the w-value
Definition at line 1417 of file Geometry.h.
kt_double karto::Quaternion::GetX | ( | ) | const [inline] |
Returns the x-value
Definition at line 1363 of file Geometry.h.
kt_double karto::Quaternion::GetY | ( | ) | const [inline] |
Returns the y-value
Definition at line 1381 of file Geometry.h.
kt_double karto::Quaternion::GetZ | ( | ) | const [inline] |
Returns the z-value
Definition at line 1399 of file Geometry.h.
kt_double karto::Quaternion::Length | ( | ) | const [inline] |
Length of this quaternion
Definition at line 1474 of file Geometry.h.
kt_double karto::Quaternion::Norm | ( | ) | const [inline] |
Returns the norm of this quaternion
Definition at line 1483 of file Geometry.h.
void karto::Quaternion::Normalize | ( | ) | [inline] |
Normalize the quaternion
Definition at line 1491 of file Geometry.h.
kt_bool karto::Quaternion::operator!= | ( | const Quaternion & | rOther | ) | const [inline] |
Inequality operator
Definition at line 1548 of file Geometry.h.
const Quaternion karto::Quaternion::operator* | ( | const Quaternion & | rOther | ) | const [inline] |
Quaternion multiplication; note that quaternion multiplication is not commutative (a * b != b * a)
Definition at line 1528 of file Geometry.h.
karto::Vector3d karto::Quaternion::operator* | ( | const karto::Vector3d & | rVector | ) | const [inline] |
Rotate a vector by this quaternion
rVector | vector |
Definition at line 1558 of file Geometry.h.
Quaternion& karto::Quaternion::operator= | ( | const Quaternion & | rOther | ) | [inline] |
Assignment operator
Definition at line 1515 of file Geometry.h.
kt_bool karto::Quaternion::operator== | ( | const Quaternion & | rOther | ) | const [inline] |
Equality operator
Definition at line 1540 of file Geometry.h.
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::ToAngleAxis | ( | kt_double & | rAngle, |
karto::Vector3d & | rAxis | ||
) | const |
This quaternion in angle-axis form
rAngle | output parameter angle |
rAxis | output parameter axis |
Definition at line 94 of file Geometry.cpp.
void karto::Quaternion::ToEulerAngles | ( | kt_double & | rYaw, |
kt_double & | rPitch, | ||
kt_double & | rRoll | ||
) | const |
Converts this quaternion into Euler angles Source: http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm
rYaw | yaw |
rPitch | pitch |
rRoll | roll |
Definition at line 140 of file Geometry.cpp.
const String karto::Quaternion::ToString | ( | ) | const |
String representation of this quaternion
Definition at line 192 of file Geometry.cpp.
KARTO_FORCEINLINE std::ostream& operator<< | ( | std::ostream & | rStream, |
const Quaternion & | rQuaternion | ||
) | [friend] |
Write this quaternion onto output stream
Definition at line 1576 of file Geometry.h.
kt_double karto::Quaternion::m_Values[4] [private] |
Definition at line 1583 of file Geometry.h.