Quaternion class defined as q = w + xi + yj + zk. More...
#include <Core/Math/Quaternion.hpp>
Public Member Functions | |
Quaternion () | |
Make an identity quaternion. More... | |
Quaternion (T newW, T newX, T newY, T newZ) | |
Constructs a quaternion with given elements. More... | |
Quaternion (const std::initializer_list< T > &list) | |
Constructs a quaternion with given elements. More... | |
Quaternion (const Vector3< T > &axis, T angle) | |
Constructs a quaternion with given rotation axis and angle. More... | |
Quaternion (const Vector3< T > &from, const Vector3< T > &to) | |
Constructs a quaternion with from and to vectors. More... | |
Quaternion (const Vector3< T > &axis0, const Vector3< T > &axis1, const Vector3< T > &axis2) | |
Constructs a quaternion with three basis vectors. More... | |
Quaternion (const Matrix3x3< T > &m33) | |
Constructs a quaternion with 3x3 rotational matrix. More... | |
Quaternion (const Quaternion &other) | |
Copy constructor. More... | |
Quaternion (Quaternion &&other) noexcept | |
Default move constructor. More... | |
~Quaternion ()=default | |
Default destructor. More... | |
Quaternion & | operator= (const Quaternion &other) |
Copy assignment operator. More... | |
Quaternion & | operator= (Quaternion &&other) noexcept |
Default move assignment operator. More... | |
void | Set (const Quaternion &other) |
Sets the quaternion with other quaternion. More... | |
void | Set (T newW, T newX, T newY, T newZ) |
Sets the quaternion with given elements. More... | |
void | Set (const std::initializer_list< T > &list) |
Sets the quaternion with given elements. More... | |
void | Set (const Vector3< T > &axis, T angle) |
Sets the quaternion with given rotation axis and angle. More... | |
void | Set (const Vector3< T > &from, const Vector3< T > &to) |
Sets the quaternion with from and to vectors. More... | |
void | Set (const Vector3< T > &rotationBasis0, const Vector3< T > &rotationBasis1, const Vector3< T > &rotationBasis2) |
Sets quaternion with three basis vectors. More... | |
void | Set (const Matrix3x3< T > &m) |
Sets the quaternion with 3x3 rotational matrix. More... | |
template<typename U > | |
Quaternion< U > | CastTo () const |
Returns quaternion with other base type. More... | |
Quaternion | Normalized () const |
Returns normalized quaternion. More... | |
Vector3< T > | Mul (const Vector3< T > &v) const |
Returns this quaternion * vector. More... | |
Quaternion | Mul (const Quaternion &other) const |
Returns this quaternion * other quaternion. More... | |
T | Dot (const Quaternion< T > &other) const |
Computes the dot product with other quaternion. More... | |
Quaternion | RMul (const Quaternion &other) const |
Returns other quaternion * this quaternion. More... | |
void | IMul (const Quaternion &other) |
Returns this quaternion *= other quaternion. More... | |
void | SetIdentity () |
Makes this quaternion identity. More... | |
void | Rotate (T angleInRadians) |
Rotate this quaternion with given angle in radians. More... | |
void | Normalize () |
Normalizes the quaternion. More... | |
Vector3< T > | Axis () const |
Returns the rotational axis. More... | |
T | Angle () const |
Returns the rotational angle. More... | |
void | GetAxisAngle (Vector3< T > *axis, T *angle) const |
Returns the axis and angle. More... | |
Quaternion | Inverse () const |
Returns the inverse quaternion. More... | |
Matrix3x3< T > | Matrix3 () const |
Converts to the 3x3 rotation matrix. More... | |
Matrix4x4< T > | Matrix4 () const |
Converts to the 4x4 rotation matrix. More... | |
T | L2Norm () const |
Returns L2 norm of this quaternion. More... | |
Quaternion & | operator*= (const Quaternion &other) |
Returns this quaternion *= other quaternion. More... | |
T & | operator[] (size_t i) |
Returns the reference to the i-th element. More... | |
const T & | operator[] (size_t i) const |
Returns the const reference to the i-th element. More... | |
bool | operator== (const Quaternion &other) const |
Returns true if equal. More... | |
bool | operator!= (const Quaternion &other) const |
Returns true if not equal. More... | |
Static Public Member Functions | |
static Quaternion | MakeIdentity () |
Returns identity matrix. More... | |
Public Attributes | |
T | w |
Real part. More... | |
T | x |
Imaginary part (j). More... | |
T | y |
Imaginary part (k). More... | |
T | z |
Detailed Description
template<typename T>
class CubbyFlow::Quaternion< T >
Quaternion class defined as q = w + xi + yj + zk.
Constructor & Destructor Documentation
◆ Quaternion() [1/9]
CubbyFlow::Quaternion< T >::Quaternion | ( | ) |
Make an identity quaternion.
◆ Quaternion() [2/9]
CubbyFlow::Quaternion< T >::Quaternion | ( | T | newW, |
T | newX, | ||
T | newY, | ||
T | newZ | ||
) |
Constructs a quaternion with given elements.
◆ Quaternion() [3/9]
CubbyFlow::Quaternion< T >::Quaternion | ( | const std::initializer_list< T > & | list | ) |
Constructs a quaternion with given elements.
◆ Quaternion() [4/9]
CubbyFlow::Quaternion< T >::Quaternion | ( | const Vector3< T > & | axis, |
T | angle | ||
) |
Constructs a quaternion with given rotation axis and angle.
◆ Quaternion() [5/9]
CubbyFlow::Quaternion< T >::Quaternion | ( | const Vector3< T > & | from, |
const Vector3< T > & | to | ||
) |
Constructs a quaternion with from and to vectors.
◆ Quaternion() [6/9]
CubbyFlow::Quaternion< T >::Quaternion | ( | const Vector3< T > & | axis0, |
const Vector3< T > & | axis1, | ||
const Vector3< T > & | axis2 | ||
) |
Constructs a quaternion with three basis vectors.
◆ Quaternion() [7/9]
|
explicit |
Constructs a quaternion with 3x3 rotational matrix.
◆ Quaternion() [8/9]
CubbyFlow::Quaternion< T >::Quaternion | ( | const Quaternion< T > & | other | ) |
Copy constructor.
◆ Quaternion() [9/9]
|
noexcept |
Default move constructor.
◆ ~Quaternion()
|
default |
Default destructor.
Member Function Documentation
◆ Angle()
T CubbyFlow::Quaternion< T >::Angle | ( | ) | const |
Returns the rotational angle.
◆ Axis()
Vector3< T > CubbyFlow::Quaternion< T >::Axis | ( | ) | const |
Returns the rotational axis.
◆ CastTo()
Quaternion< U > CubbyFlow::Quaternion< T >::CastTo | ( | ) | const |
Returns quaternion with other base type.
◆ Dot()
T CubbyFlow::Quaternion< T >::Dot | ( | const Quaternion< T > & | other | ) | const |
Computes the dot product with other quaternion.
◆ GetAxisAngle()
void CubbyFlow::Quaternion< T >::GetAxisAngle | ( | Vector3< T > * | axis, |
T * | angle | ||
) | const |
Returns the axis and angle.
◆ IMul()
void CubbyFlow::Quaternion< T >::IMul | ( | const Quaternion< T > & | other | ) |
Returns this quaternion *= other quaternion.
◆ Inverse()
Quaternion< T > CubbyFlow::Quaternion< T >::Inverse | ( | ) | const |
Returns the inverse quaternion.
◆ L2Norm()
T CubbyFlow::Quaternion< T >::L2Norm | ( | ) | const |
Returns L2 norm of this quaternion.
◆ MakeIdentity()
|
static |
Returns identity matrix.
◆ Matrix3()
Matrix3x3< T > CubbyFlow::Quaternion< T >::Matrix3 | ( | ) | const |
Converts to the 3x3 rotation matrix.
◆ Matrix4()
Matrix4x4< T > CubbyFlow::Quaternion< T >::Matrix4 | ( | ) | const |
Converts to the 4x4 rotation matrix.
◆ Mul() [1/2]
Vector3< T > CubbyFlow::Quaternion< T >::Mul | ( | const Vector3< T > & | v | ) | const |
Returns this quaternion * vector.
◆ Mul() [2/2]
Quaternion< T > CubbyFlow::Quaternion< T >::Mul | ( | const Quaternion< T > & | other | ) | const |
Returns this quaternion * other quaternion.
◆ Normalize()
void CubbyFlow::Quaternion< T >::Normalize | ( | ) |
Normalizes the quaternion.
◆ Normalized()
Quaternion< T > CubbyFlow::Quaternion< T >::Normalized | ( | ) | const |
Returns normalized quaternion.
◆ operator!=()
bool CubbyFlow::Quaternion< T >::operator!= | ( | const Quaternion< T > & | other | ) | const |
Returns true if not equal.
◆ operator*=()
Quaternion< T > & CubbyFlow::Quaternion< T >::operator*= | ( | const Quaternion< T > & | other | ) |
Returns this quaternion *= other quaternion.
◆ operator=() [1/2]
Quaternion< T > & CubbyFlow::Quaternion< T >::operator= | ( | const Quaternion< T > & | other | ) |
Copy assignment operator.
◆ operator=() [2/2]
|
noexcept |
Default move assignment operator.
◆ operator==()
bool CubbyFlow::Quaternion< T >::operator== | ( | const Quaternion< T > & | other | ) | const |
Returns true if equal.
◆ operator[]() [1/2]
T & CubbyFlow::Quaternion< T >::operator[] | ( | size_t | i | ) |
Returns the reference to the i-th element.
◆ operator[]() [2/2]
const T & CubbyFlow::Quaternion< T >::operator[] | ( | size_t | i | ) | const |
Returns the const reference to the i-th element.
◆ RMul()
Quaternion< T > CubbyFlow::Quaternion< T >::RMul | ( | const Quaternion< T > & | other | ) | const |
Returns other quaternion * this quaternion.
◆ Rotate()
void CubbyFlow::Quaternion< T >::Rotate | ( | T | angleInRadians | ) |
Rotate this quaternion with given angle in radians.
◆ Set() [1/7]
void CubbyFlow::Quaternion< T >::Set | ( | const Quaternion< T > & | other | ) |
Sets the quaternion with other quaternion.
◆ Set() [2/7]
void CubbyFlow::Quaternion< T >::Set | ( | T | newW, |
T | newX, | ||
T | newY, | ||
T | newZ | ||
) |
Sets the quaternion with given elements.
◆ Set() [3/7]
void CubbyFlow::Quaternion< T >::Set | ( | const std::initializer_list< T > & | list | ) |
Sets the quaternion with given elements.
◆ Set() [4/7]
void CubbyFlow::Quaternion< T >::Set | ( | const Vector3< T > & | axis, |
T | angle | ||
) |
Sets the quaternion with given rotation axis and angle.
◆ Set() [5/7]
void CubbyFlow::Quaternion< T >::Set | ( | const Vector3< T > & | from, |
const Vector3< T > & | to | ||
) |
Sets the quaternion with from and to vectors.
◆ Set() [6/7]
void CubbyFlow::Quaternion< T >::Set | ( | const Vector3< T > & | rotationBasis0, |
const Vector3< T > & | rotationBasis1, | ||
const Vector3< T > & | rotationBasis2 | ||
) |
Sets quaternion with three basis vectors.
◆ Set() [7/7]
void CubbyFlow::Quaternion< T >::Set | ( | const Matrix3x3< T > & | m | ) |
Sets the quaternion with 3x3 rotational matrix.
◆ SetIdentity()
void CubbyFlow::Quaternion< T >::SetIdentity | ( | ) |
Makes this quaternion identity.
Member Data Documentation
◆ w
T CubbyFlow::Quaternion< T >::w |
Real part.
Imaginary part (i).
◆ x
T CubbyFlow::Quaternion< T >::x |
Imaginary part (j).
◆ y
T CubbyFlow::Quaternion< T >::y |
Imaginary part (k).
◆ z
T CubbyFlow::Quaternion< T >::z |
The documentation for this class was generated from the following files:
- Core/Math/Quaternion.hpp
- Core/Math/Quaternion-Impl.hpp