#include <quaternion.h>
Public Member Functions | |
| Quaternion () | |
| The default constructor initializes a quaternion with values [1.0, 0.0, 0.0, 0.0]. | |
| Quaternion (double s, double i, double j, double k, bool isNormalized=false) | |
| This constructor explicitly sets the values of the quaternion. | |
| Quaternion (const Quaternion &source) | |
| The copy constructor deep copies its argument. | |
| virtual | ~Quaternion () |
| The destructor destroys the Quaternion instance. | |
| double | s () const |
| This member function returns the real component of the Quaternion. | |
| double | i () const |
| This member function returns the first imaginary component of the Quaternion. | |
| double | j () const |
| This member function returns the second imaginary component of the Quaternion. | |
| double | k () const |
| This member function returns the third imaginary component of the Quaternion. | |
| void | setValue (double s, double i, double j, double k) |
| This member function sets the values of the Quaternion components explicitly. | |
| void | normalize () |
| This member function normalizes the Quaternion, first computing the magnitude of the Quaternion, and then dividing each element by that value. | |
| Quaternion & | operator= (const Quaternion &source) |
| The assignment operator simply deep copies its argument. | |
Among other things, quaternions are useful for expressing rigid rotations in 3D space. To do this, people generally Set the elements of the quaternion equal to [c, s*x, s*y, s*z], where c = cos(theta/2), s = sin(theta/2), theta is the angle of rotation, and [x, y, z] is a unit vector along the axis of rotation. Note that in this representation of rotation, the quaternion must have unit magnitude. This class does not enforce unit magnitude. If you want the quaternion to have unit magnitude, you must either set the values appropriately, or call the normalize() method.
Definition at line 33 of file quaternion.h.
| dlr::numeric::Quaternion::Quaternion | ( | ) | [inline] |
The default constructor initializes a quaternion with values [1.0, 0.0, 0.0, 0.0].
Definition at line 40 of file quaternion.h.
| dlr::numeric::Quaternion::Quaternion | ( | double | s, | |
| double | i, | |||
| double | j, | |||
| double | k, | |||
| bool | isNormalized = false | |||
| ) | [inline] |
This constructor explicitly sets the values of the quaternion.
| s | This parameter specifies the value of s, the real component of the quaternion. | |
| i | This parameter specifies the value of i, the first imaginary component of the quaternion. | |
| j | This parameter specifies the value of j, the second imaginary component of the quaternion. | |
| k | This parameter specifies the value of k, the third imaginary component of the quaternion. | |
| isNormalized | This parameter is used to indicate whether the provided values are normalized. If you know that the resulting quaternion will have magnitude equal to one, you can set this argument to true. |
Definition at line 63 of file quaternion.h.
| dlr::numeric::Quaternion::Quaternion | ( | const Quaternion & | source | ) | [inline] |
The copy constructor deep copies its argument.
| source | This parameter specifies the Quaternion instance to be copied. |
Definition at line 73 of file quaternion.h.
| virtual dlr::numeric::Quaternion::~Quaternion | ( | ) | [inline, virtual] |
| double dlr::numeric::Quaternion::s | ( | ) | const [inline] |
This member function returns the real component of the Quaternion.
Definition at line 93 of file quaternion.h.
Referenced by dlr::numeric::conjugate(), dlr::numeric::quaternionToAngleAxis(), and dlr::numeric::quaternionToTransform3D().
| double dlr::numeric::Quaternion::i | ( | ) | const [inline] |
This member function returns the first imaginary component of the Quaternion.
Definition at line 104 of file quaternion.h.
Referenced by dlr::numeric::conjugate(), dlr::numeric::quaternionToAngleAxis(), and dlr::numeric::quaternionToTransform3D().
| double dlr::numeric::Quaternion::j | ( | ) | const [inline] |
This member function returns the second imaginary component of the Quaternion.
Definition at line 115 of file quaternion.h.
Referenced by dlr::numeric::conjugate(), dlr::numeric::quaternionToAngleAxis(), and dlr::numeric::quaternionToTransform3D().
| double dlr::numeric::Quaternion::k | ( | ) | const [inline] |
This member function returns the third imaginary component of the Quaternion.
Definition at line 126 of file quaternion.h.
Referenced by dlr::numeric::conjugate(), dlr::numeric::quaternionToAngleAxis(), and dlr::numeric::quaternionToTransform3D().
| void dlr::numeric::Quaternion::setValue | ( | double | s, | |
| double | i, | |||
| double | j, | |||
| double | k | |||
| ) | [inline] |
This member function sets the values of the Quaternion components explicitly.
| s | This parameter specifies the real component of the Quaternion. | |
| i | This parameter specifies the first imaginary component of the Quaternion. | |
| j | This parameter specifies the second imaginary component of the Quaternion. | |
| k | This parameter specifies the third imaginary component of the Quaternion. |
Definition at line 146 of file quaternion.h.
Referenced by operator=().
| void dlr::numeric::Quaternion::normalize | ( | ) |
This member function normalizes the Quaternion, first computing the magnitude of the Quaternion, and then dividing each element by that value.
Strictly speaking, the magnitude of a Quaternion q is equal to dot(q, conjugate(q)). This is the same as the magnitude of a 4 element vector [s, i, j, k].
Definition at line 27 of file quaternion.cpp.
References dlr::numeric::sqrt().
Referenced by dlr::numeric::quaternionToAngleAxis(), and dlr::numeric::quaternionToTransform3D().
| Quaternion& dlr::numeric::Quaternion::operator= | ( | const Quaternion & | source | ) | [inline] |
The assignment operator simply deep copies its argument.
| source | This argument is the Quaternion instance to be copied. |
Definition at line 169 of file quaternion.h.
References m_i, m_isNormalized, m_j, m_k, m_s, and setValue().
1.5.2