Class translotator::Quaternion¶
template <typename Type>
ClassList > translotator > Quaternion
Representing a quaternion. More...
#include <Quaternion.hpp>
Inherits the following classes: translotator::MatrixBase
Public Types inherited from translotator::MatrixBase¶
| Type | Name |
|---|---|
| typedef Type | DATATYPE |
Public Static Attributes¶
| Type | Name |
|---|---|
| constexpr static ObjectType | OBJECT_TYPE = = ObjectType::QUATERNION |
Public Static Attributes inherited from translotator::MatrixBase¶
| Type | Name |
|---|---|
| constexpr static size_t | COLS = = M |
| constexpr static bool | MATRIX_BASE = = true |
| constexpr static size_t | ROWS = = N |
Public Functions¶
| Type | Name |
|---|---|
| const Vector< 3, Type > | Im () const |
| Vector< 3, Type > & | Im () |
| Quaternion () |
|
| Quaternion (Type w, Type x, Type y, Type z) |
|
| Quaternion (Type w, const Vector< 3, Type > & v) |
|
| Quaternion (const ComplexNum< Type > & cplx) |
|
| const Type | Re () const |
| Type & | Re () |
| void | canonicalize () |
| Quaternion< Type > | canonicalized () const normalize the quaternion |
| void | conjugate () get the conjugated quaternion |
| Quaternion< Type > | conjugated () const canonicalize the quaternion |
| void | inverse () get the inversed quaternion |
| Quaternion< Type > | inversed () const conjugate the quaternion |
| Type | norm () const get the squared norm of the quaternion |
| Type | normSquared () const |
| void | normalize () get the normalized quaternion |
| Quaternion< Type > | normalized () const get the norm of the quaternion |
| Quaternion< Type > | operator* (const Quaternion< Type > & q) const quaternion multiplication |
| void | operator*= (const Quaternion< Type > & q) quaternion division |
| Quaternion< Type > | operator/ (const Quaternion< Type > & q) const |
| void | operator/= (const Quaternion< Type > & q) quaternion multiplication |
| Type | operator[] (size_t i) const |
| Type & | operator[] (size_t i) |
| Quaternion< Type > | quatNumDiv (const Quaternion< Type > & q) const |
| void | quatNumDivEq (const Quaternion< Type > & q) |
| Quaternion< Type > | quatNumMul (const Quaternion< Type > & q) const quaternion division |
| void | quatNumMulEq (const Quaternion< Type > & q) |
| SquareMatrix< 4, Type > | toMulMatrix () const get the matrix that represents the quaternion multiplication |
| SquareMatrix< 4, Type > | toRightMulMatrix () const get the matrix that represents the quaternion multiplication from the right |
| Type | w () const |
| Type & | w () |
| Type | x () const |
| Type & | x () |
| Type | y () const |
| Type & | y () |
| Type | z () const |
| Type & | z () |
Public Functions inherited from translotator::MatrixBase¶
| Type | Name |
|---|---|
| MatrixBase () = default Returns the number of columns. |
|
| MatrixBase (const MatrixBase & other) = default |
|
| MatrixBase (const Type data) |
|
| MatrixBase (const Type data) |
|
| MatrixBase (const initializer_list< N *M, Type > & list) Initializer list constructor. |
|
| auto | T () const Transpose. |
| Matrix< P, Q, Type > | block (size_t i, size_t j) const Returns a block of the matrix. |
| Matrix< P, Q, Type > | block () const Returns a block of the matrix. |
| ComplexNum< Type > | cast2ComplexNum () const Casts the object to a complex number by copying. |
| ComplexNum< Type > & | cast2ComplexNumRef () Casts the object to a complex number reference without copying. |
| DualNumber< Type > | cast2DualNumber () const Casts the object to a dual number by copying. |
| DualNumber< Type > & | cast2DualNumberRef () Casts the object to a dual number reference without copying. |
| DualQuaternion< Type > | cast2DualQuaternion () const Casts the object to a dual quaternion by copying. |
| DualQuaternion< Type > & | cast2DualQuaternionRef () Casts the object to a dual quaternion reference without copying. |
| Matrix< N, M, Type > | cast2Matrix () const Casts the object to a different matrix type by copying. |
| Matrix< N, M, Type > & | cast2MatrixRef () Casts the object to a matrix reference without copying. |
| Quaternion< Type > | cast2Quaternion () const Casts the object to a quaternion by copying. |
| Quaternion< Type > & | cast2QuaternionRef () Casts the object to a quaternion reference without copying. |
| SOGroup< N, Type > | cast2SOGroup () const Casts the object to a special orthogonal group by copying. |
| SOGroup< N, Type > & | cast2SOGroupRef () Casts the object to a special orthogonal group reference without copying. |
| SquareMatrix< N, Type > | cast2SquareMatrix () const Casts the object to a square matrix by copying. |
| SquareMatrix< N, Type > & | cast2SquareMatrixRef () Casts the object to a square matrix reference without copying. |
| UnitComplexNum< Type > | cast2UnitComplexNum () const Casts the object to a unit complex number by copying. |
| UnitComplexNum< Type > & | cast2UnitComplexNumRef () Casts the object to a unit complex number reference without copying. |
| UnitDualQuaternion< Type > | cast2UnitDualQuaternion () const Casts the object to a unit dual quaternion by copying. |
| UnitDualQuaternion< Type > & | cast2UnitDualQuaternionRef () Casts the object to a unit dual quaternion reference without copying. |
| UnitQuaternion< Type > | cast2UnitQuaternion () const Casts the object to a unit quaternion by copying. |
| UnitQuaternion< Type > & | cast2UnitQuaternionRef () Casts the object to a unit quaternion reference without copying. |
| Vector< N, Type > | cast2Vector () const Casts the object to a vector by copying. |
| Vector< N, Type > & | cast2VectorRef () Casts the object to a vector reference without copying. |
| NewContainer | castContainer () const Casts the matrix to a different container type by copying. |
| NewContainer & | castContainerRef () Casts the object to a different container reference without copying. |
| NewDerived & | castContainerRef () |
| auto | castDataType () const Returns the Frobenius norm. |
| Matrix< N, 1, Type > | col (size_t j) const Returns the j-th column. |
| void | copyTo (Type * data) const Returns the raw data pointer. |
| void | fill (const Type & v) Fills the matrix with a value. |
| Type | frobeniusNorm () const |
| Type | frobeniusNormSquared () const Returns the squared Frobenius norm. |
| Type * | getData () const |
| const Type & | operator() (size_t i, size_t j) const Accesses the element at (i, j) |
| Type & | operator() (size_t i, size_t j) Accesses the element at (i, j) |
| auto | operator* (const OtherDerived & other) const Matrix multiplication. |
| Derived | operator* (const Type & v) const Matrix multiplication by scalar. |
| void | operator*= (const OtherDerived & other) Matrix multiplication by scalar. |
| Derived | operator+ (const OtherDerived & other) const Multiplication by scalar. |
| void | operator+= (const OtherDerived & other) Matrix division by scalar. |
| Derived | operator- (const OtherDerived & other) const Matrix subtraction. |
| Derived | operator- () const Matrix multiplication by scalar. |
| void | operator-= (const OtherDerived & other) Matrix subtraction by scalar. |
| Derived | operator/ (Type v) const Division by scalar. |
| void | operator/= (Type v) Division by scalar. |
| Derived & | operator= (const Derived & other) Copies the data to the given pointer. |
| void | print () const Prints the matrix. |
| Matrix< 1, M, Type > | row (size_t i) const Returns the i-th row. |
| Derived & | setBlock (size_t i, size_t j, const OtherDerived & block) Sets the element at (i, j) |
| Derived & | setBlock (const OtherDerived & block) Sets the i-th row. |
| Derived & | setCol (size_t j, const OtherDerived & col) Sets the j-th column. |
| Derived & | setCol (const OtherDerived & col) Sets the j-th column. |
| Derived & | setRow (size_t i, const OtherDerived & row) Sets the i-th row. |
| Derived & | setRow (const OtherDerived & row) Sets the i-th row. |
| void | swapCols (size_t j1, size_t j2) Swaps two columns. |
| void | swapRows (size_t i1, size_t i2) Swaps two rows. |
| Type | toScalar () const Casts the matrix to a scalar if it is a 1x1 matrix. |
Public Static Functions inherited from translotator::MatrixBase¶
| Type | Name |
|---|---|
| Derived | NaN () Returns a matrix filled with NaN. |
| constexpr static size_t | colSize () Returns the number of rows. |
| Derived | eye () Returns an identity matrix. |
| Derived | ones () Returns a matrix filled with ones. |
| constexpr static size_t | rowSize () |
| Derived | zeros () Returns a matrix filled with zeros. |
Protected Attributes inherited from translotator::MatrixBase¶
| Type | Name |
|---|---|
| Type | data_ |
Detailed Description¶
Template parameters:
Typefloating point type
A quaternion is a hypercomplex number that extends the complex numbers. It can be represented as a 4-dimensional vector. The quaternion is defined as q = w + xi + yj + zk, where w, x, y, and z are real numbers, and i, j, and k are the fundamental quaternion units. The quaternion has the following properties: i^2 = j^2 = k^2 = ijk = -1. (Hamillton representation) This can be used to represent rotations in 3D space. Also can be used to represent rotations in 3D space.
Public Static Attributes Documentation¶
variable OBJECT_TYPE¶
constexpr static ObjectType translotator::Quaternion< Type >::OBJECT_TYPE;
Public Functions Documentation¶
function Im [1/2]¶
inline const Vector < 3, Type > translotator::Quaternion::Im () const
function Im [2/2]¶
inline Vector < 3, Type > & translotator::Quaternion::Im ()
function Quaternion [1/4]¶
inline translotator::Quaternion::Quaternion ()
constructors
function Quaternion [2/4]¶
inline explicit translotator::Quaternion::Quaternion (
Type w,
Type x,
Type y,
Type z
)
function Quaternion [3/4]¶
inline explicit translotator::Quaternion::Quaternion (
Type w,
const Vector < 3, Type > & v
)
function Quaternion [4/4]¶
inline explicit translotator::Quaternion::Quaternion (
const ComplexNum < Type > & cplx
)
function Re [1/2]¶
inline const Type translotator::Quaternion::Re () const
function Re [2/2]¶
inline Type & translotator::Quaternion::Re ()
function canonicalize¶
inline void translotator::Quaternion::canonicalize ()
function canonicalized¶
normalize the quaternion
inline Quaternion < Type > translotator::Quaternion::canonicalized () const
get the canonicalized quaternion
function conjugate¶
inline void translotator::Quaternion::conjugate ()
function conjugated¶
inline Quaternion < Type > translotator::Quaternion::conjugated () const
function inverse¶
inline void translotator::Quaternion::inverse ()
function inversed¶
inline Quaternion < Type > translotator::Quaternion::inversed () const
function norm¶
inline Type translotator::Quaternion::norm () const
function normSquared¶
inline Type translotator::Quaternion::normSquared () const
utils
function normalize¶
inline void translotator::Quaternion::normalize ()
function normalized¶
inline Quaternion < Type > translotator::Quaternion::normalized () const
function operator*¶
inline Quaternion < Type > translotator::Quaternion::operator* (
const Quaternion < Type > & q
) const
function operator*=¶
inline void translotator::Quaternion::operator*= (
const Quaternion < Type > & q
)
function operator/¶
inline Quaternion < Type > translotator::Quaternion::operator/ (
const Quaternion < Type > & q
) const
function operator/=¶
inline void translotator::Quaternion::operator/= (
const Quaternion < Type > & q
)
function operator[]¶
inline Type translotator::Quaternion::operator[] (
size_t i
) const
function operator[]¶
inline Type & translotator::Quaternion::operator[] (
size_t i
)
function quatNumDiv¶
inline Quaternion < Type > translotator::Quaternion::quatNumDiv (
const Quaternion < Type > & q
) const
function quatNumDivEq¶
inline void translotator::Quaternion::quatNumDivEq (
const Quaternion < Type > & q
)
function quatNumMul¶
inline Quaternion < Type > translotator::Quaternion::quatNumMul (
const Quaternion < Type > & q
) const
function quatNumMulEq¶
inline void translotator::Quaternion::quatNumMulEq (
const Quaternion < Type > & q
)
function toMulMatrix¶
get the matrix that represents the quaternion multiplication
inline SquareMatrix < 4, Type > translotator::Quaternion::toMulMatrix () const
casting
function toRightMulMatrix¶
inline SquareMatrix < 4, Type > translotator::Quaternion::toRightMulMatrix () const
function w [1/2]¶
inline Type translotator::Quaternion::w () const
accessors
function w [2/2]¶
inline Type & translotator::Quaternion::w ()
function x [1/2]¶
inline Type translotator::Quaternion::x () const
function x [2/2]¶
inline Type & translotator::Quaternion::x ()
function y [1/2]¶
inline Type translotator::Quaternion::y () const
function y [2/2]¶
inline Type & translotator::Quaternion::y ()
function z [1/2]¶
inline Type translotator::Quaternion::z () const
function z [2/2]¶
inline Type & translotator::Quaternion::z ()
The documentation for this class was generated from the following file include/translotator/objects/Quaternion.hpp