A Quaternion is a mutable object that represents a Quaternion.
More...
#include <attitude-utils.hpp>
A Quaternion is a mutable object that represents a Quaternion.
A Quaternion is a common way to represent rotations in 3D.
◆ Quaternion() [1/4]
found::Quaternion::Quaternion |
( |
| ) |
|
|
default |
◆ Quaternion() [2/4]
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/4]
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() [4/4]
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.
◆ IsUnit()
bool found::Quaternion::IsUnit |
( |
decimal |
tolerance | ) |
const |
Tells client if this Quarternion is a unit quaternion.
- Returns
- true iff this is a unit Quaternion
◆ operator*()
Multiply two quaternions using the usual definition of quaternion multiplication (effectively composes rotations)
◆ operator-()
Negate the quaternion, which is the same rotation.
◆ 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 vector formed by imaginary components of the quaternion. The axis of the represented rotation.
◆ real
The documentation for this class was generated from the following files: