A Quaternion is a mutable object that represents a Quaternion.
More...
#include <attitude-utils.hpp>
|
| Quaternion (const Vec3 &, decimal) |
| Create a quaternion which represents a rotation of theta around the axis input.
|
|
| Quaternion (const Vec3 &) |
| Creates a "pure quaternion" with the given vector for imaginary parts and zero for real part.
|
|
| Quaternion (decimal real, decimal i, decimal j, decimal k) |
| Creates a Quaternion with components.
|
|
Quaternion | operator* (const Quaternion &other) const |
| Multiply two quaternions using the usual definition of quaternion multiplication (effectively composes rotations)
|
|
Quaternion | operator- () const |
| Negate the quaternion, which is the same rotation.
|
|
Quaternion | Conjugate () const |
| Effectively computes a quaternion representing the inverse rotation of the original.
|
|
Vec3 | Vector () const |
| The axis of the represented rotation.
|
|
void | SetVector (const Vec3 &) |
| Set imaginary components of Quarterion.
|
|
Vec3 | Rotate (const Vec3 &) const |
| Rotates a vector about this Quaternion.
|
|
decimal | Angle () const |
| Provides the amount of rotations represented by this Quaterion.
|
|
void | SetAngle (decimal) |
| Changes the rotation represented in this quarterion.
|
|
bool | IsUnit (decimal tolerance) const |
| Tells client if this Quarternion is a unit quaternion.
|
|
Quaternion | Canonicalize () const |
| Provides the canonicalized Quaternion of this, if it is not already canonicalized.
|
|
EulerAngles | ToSpherical () const |
| Converts this Quarterion to a new system of Euler Angles by extracting the rotations described by this quarterion.
|
|
|
decimal | real |
| The real component.
|
|
decimal | i |
| The i component.
|
|
decimal | j |
| The j component.
|
|
decimal | k |
| The k component.
|
|
A Quaternion is a mutable object that represents a Quaternion.
A Quaternion is a common way to represent rotations in 3D.
◆ Quaternion() [1/3]
found::Quaternion::Quaternion |
( |
const Vec3 & |
input, |
|
|
decimal |
theta |
|
) |
| |
Create a quaternion which represents a rotation of theta around the axis input.
- Parameters
-
input | the axis about which theta is defined |
theta | the rotation about the input |
◆ Quaternion() [2/3]
found::Quaternion::Quaternion |
( |
const Vec3 & |
input | ) |
|
|
explicit |
Creates a "pure quaternion" with the given vector for imaginary parts and zero for real part.
- Parameters
-
input | The vector representing the imaginary part of the Quaternion to create |
◆ Quaternion() [3/3]
found::Quaternion::Quaternion |
( |
decimal |
real, |
|
|
decimal |
i, |
|
|
decimal |
j, |
|
|
decimal |
k |
|
) |
| |
|
inline |
Creates a Quaternion with components.
- Parameters
-
real | The real component |
i | The i component |
j | The j component |
k | The k component |
Initializes this to be {real + iI + jJ + kK}
◆ Angle()
decimal found::Quaternion::Angle |
( |
| ) |
const |
Provides the amount of rotations represented by this Quaterion.
- Returns
- The amount of rotations represented by this, in radians
◆ Canonicalize()
Quaternion found::Quaternion::Canonicalize |
( |
| ) |
const |
Provides the canonicalized Quaternion of this, if it is not already canonicalized.
- Returns
- The canonicalized Quaternion of this, which is this iff this is a canonicalized Quaternion already, and a new Quaternion if it is not
◆ Conjugate()
Effectively computes a quaternion representing the inverse rotation of the original.
- Returns
- The resulting quaternion
◆ IsUnit()
bool found::Quaternion::IsUnit |
( |
decimal |
tolerance | ) |
const |
Tells client if this Quarternion is a unit quaternion.
- Parameters
-
tolerance | The tolerance for the magnitude of this |
- Returns
- true iff this is a unit Quaternion
◆ operator*()
Multiply two quaternions using the usual definition of quaternion multiplication (effectively composes rotations)
- Parameters
-
other | The other quaternion |
- Returns
- The resulting quaternion
◆ operator-()
Negate the quaternion, which is the same rotation.
- Returns
- The resulting quaternion
◆ Rotate()
Vec3 found::Quaternion::Rotate |
( |
const Vec3 & |
input | ) |
const |
Rotates a vector about this Quaternion.
- Parameters
-
input | The vector to rotate about this |
- Returns
- The input vector that has been rotated about this
◆ SetAngle()
void found::Quaternion::SetAngle |
( |
decimal |
newAngle | ) |
|
Changes the rotation represented in this quarterion.
- Parameters
-
newAngle | The rotation angle this new quarternion should represent |
- Postcondition
- Changes this by altering the rotation angle of this by newAngle
◆ SetVector()
void found::Quaternion::SetVector |
( |
const Vec3 & |
vec | ) |
|
Set imaginary components of Quarterion.
- Parameters
-
vec | The vector holding the imaginary quantities |
◆ ToSpherical()
Converts this Quarterion to a new system of Euler Angles by extracting the rotations described by this quarterion.
- Returns
- An EulerAngles object representing this in with Euler Angles
◆ Vector()
Vec3 found::Quaternion::Vector |
( |
| ) |
const |
The axis of the represented rotation.
The vector formed by imaginary components of the quaternion.
- Returns
- The vector part of this quaternion
The documentation for this class was generated from the following files: