My Project
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
found::Quaternion Class Reference

#include <attitude-utils.hpp>

Public Member Functions

 Quaternion (const Vec3 &)
 
 Quaternion (const Vec3 &, decimal)
 
 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)
 
Quaternion Conjugate () const
 Effectively computes a quaternion representing the inverse rotation of the original.
 
Vec3 Vector () const
 The vector formed by imaginary components of the quaternion. The axis of the represented rotation.
 
void SetVector (const Vec3 &)
 
Vec3 Rotate (const Vec3 &) const
 
decimal Angle () const
 
void SetAngle (decimal)
 
EulerAngles ToSpherical () const
 
bool IsUnit (decimal tolerance) const
 
Quaternion Canonicalize () const
 

Public Attributes

decimal real
 The real component.
 
decimal i
 The i component.
 
decimal j
 The j component.
 
decimal k
 The k component.
 

Detailed Description

A Quaternion is a mutable object that represents a Quaternion. A Quaternion is a common way to represent rotations in 3D.

Constructor & Destructor Documentation

◆ Quaternion() [1/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
inputThe vector representing the imaginary part of the Quaternion to create

◆ Quaternion() [2/3]

found::Quaternion::Quaternion ( const Vec3 input,
decimal  theta 
)

Create a quaternion which represents a rotation of theta around the axis input

Parameters
inputthe axis about which theta is defined
thetathe rotation about the input

◆ Quaternion() [3/3]

found::Quaternion::Quaternion ( decimal  real,
decimal  i,
decimal  j,
decimal  k 
)
inline

Creates a Quaternion with components

Parameters
realThe real component
iThe i component
jThe j component
kThe k component

Initializes this to be {real + iI + jJ + kK}

Member Function Documentation

◆ 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

◆ 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

◆ Rotate()

Vec3 found::Quaternion::Rotate ( const Vec3 input) const

Rotates a vector about this Quaternion

Parameters
inputThe 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
newAngleThe 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
vecThe vector holding the imaginary quantities

◆ ToSpherical()

EulerAngles found::Quaternion::ToSpherical ( ) const

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

The documentation for this class was generated from the following files: