LOST
0.0.1
LOST: Open-source Star Tracker
|
A quaternion is a common way to represent a 3d rotation. More...
#include <attitude-utils.hpp>
Public Member Functions | |
Quaternion ()=default | |
Quaternion (const Vec3 &) | |
Creates a "pure quaternion" with the given vector for imaginary parts and zero for real part. More... | |
Quaternion (const Vec3 &, decimal) | |
Create a quaternion which represents a rotation of theta around the axis input. More... | |
Quaternion (decimal real, decimal i, decimal j, decimal k) | |
Quaternion | operator* (const Quaternion &other) const |
Multiply two quaternions using the usual definition of quaternion multiplication (effectively composes rotations) More... | |
Quaternion | Conjugate () const |
Effectively computes a quaternion representing the inverse rotation of the original. More... | |
Vec3 | Vector () const |
The vector formed by imaginary components of the quaternion. The axis of the represented rotation. More... | |
void | SetVector (const Vec3 &) |
Set imaginary components. More... | |
Vec3 | Rotate (const Vec3 &) const |
Rotate a 3d vector according to the rotation represented by the quaternion. More... | |
decimal | Angle () const |
How many radians the rotation represented by this quaternion has. More... | |
decimal | SmallestAngle () const |
Returns the smallest angle that can be used to represent the rotation represented by the quaternion. More... | |
void | SetAngle (decimal) |
EulerAngles | ToSpherical () const |
bool | IsUnit (decimal tolerance) const |
Whether the quaternion is a unit quaternion. All quaternions representing rotations should be units. More... | |
Quaternion | Canonicalize () const |
Ensure that the quaternion's real part is nonnegative. More... | |
Public Attributes | |
decimal | real |
decimal | i |
decimal | j |
decimal | k |
A quaternion is a common way to represent a 3d rotation.
Definition at line 98 of file attitude-utils.hpp.
|
default |
|
explicit |
Creates a "pure quaternion" with the given vector for imaginary parts and zero for real part.
Definition at line 40 of file attitude-utils.cpp.
Create a quaternion which represents a rotation of theta around the axis input.
Definition at line 46 of file attitude-utils.cpp.
Definition at line 104 of file attitude-utils.hpp.
decimal lost::Quaternion::Angle | ( | ) | const |
How many radians the rotation represented by this quaternion has.
Definition at line 61 of file attitude-utils.cpp.
Quaternion lost::Quaternion::Canonicalize | ( | ) | const |
Ensure that the quaternion's real part is nonnegative.
Does not change the rotation represented by the quaternion.
Definition at line 127 of file attitude-utils.cpp.
Quaternion lost::Quaternion::Conjugate | ( | ) | const |
Effectively computes a quaternion representing the inverse rotation of the original.
Definition at line 23 of file attitude-utils.cpp.
bool lost::Quaternion::IsUnit | ( | decimal | tolerance | ) | const |
Whether the quaternion is a unit quaternion. All quaternions representing rotations should be units.
Definition at line 120 of file attitude-utils.cpp.
Quaternion lost::Quaternion::operator* | ( | const Quaternion & | other | ) | const |
Multiply two quaternions using the usual definition of quaternion multiplication (effectively composes rotations)
Definition at line 14 of file attitude-utils.cpp.
Rotate a 3d vector according to the rotation represented by the quaternion.
Definition at line 55 of file attitude-utils.cpp.
void lost::Quaternion::SetAngle | ( | decimal | newAngle | ) |
void lost::Quaternion::SetVector | ( | const Vec3 & | vec | ) |
Set imaginary components.
Definition at line 33 of file attitude-utils.cpp.
decimal lost::Quaternion::SmallestAngle | ( | ) | const |
Returns the smallest angle that can be used to represent the rotation represented by the quaternion.
I.e, min(Angle, 2pi-Angle).
Definition at line 69 of file attitude-utils.cpp.
EulerAngles lost::Quaternion::ToSpherical | ( | ) | const |
Vec3 lost::Quaternion::Vector | ( | ) | const |
The vector formed by imaginary components of the quaternion. The axis of the represented rotation.
Definition at line 28 of file attitude-utils.cpp.
decimal lost::Quaternion::i |
Definition at line 122 of file attitude-utils.hpp.
decimal lost::Quaternion::j |
Definition at line 123 of file attitude-utils.hpp.
decimal lost::Quaternion::k |
Definition at line 124 of file attitude-utils.hpp.
decimal lost::Quaternion::real |
Definition at line 121 of file attitude-utils.hpp.