FOUND
Loading...
Searching...
No Matches
found::Quaternion Class Reference

A Quaternion is a mutable object that represents a Quaternion. 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.
 
 Quaternion (const Vec3 &, decimal)
 Create a quaternion which represents a rotation of theta around the axis input.
 
 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 vector formed by imaginary components of the quaternion. 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.
 
EulerAngles ToSpherical () const
 Converts this Quarterion to a new system of Euler Angles by extracting the rotations described by 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.
 

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/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
inputThe 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
inputthe axis about which theta is defined
thetathe rotation about the input

◆ Quaternion() [4/4]

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

◆ Conjugate()

Quaternion found::Quaternion::Conjugate ( ) const

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*()

Quaternion found::Quaternion::operator* ( const Quaternion other) const

Multiply two quaternions using the usual definition of quaternion multiplication (effectively composes rotations)

◆ operator-()

Quaternion found::Quaternion::operator- ( ) const

Negate the quaternion, which is the same rotation.

◆ 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

◆ Vector()

Vec3 found::Quaternion::Vector ( ) const

The vector formed by imaginary components of the quaternion. The axis of the represented rotation.

Member Data Documentation

◆ i

decimal found::Quaternion::i

The i component.

◆ j

decimal found::Quaternion::j

The j component.

◆ k

decimal found::Quaternion::k

The k component.

◆ real

decimal found::Quaternion::real

The real component.


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