ML Reference
ml::TQuaternion< DT > Class Template Reference

Declaration of complex type traits. More...

#include <mlQuaternion.h>

Public Types

typedef DT value_type
 Scalar type used for qx, qy, qz, and qw. More...
 

Public Member Functions

DT dot (const TQuaternion< DT > &p) const
 Dot product, equivalent to four component vector dot product. More...
 
TQuaternion< DT > odd (const TQuaternion< DT > &p) const
 Odd product, also known as cross-product or Grassman outer product. More...
 
TQuaternion< DT > even (const TQuaternion< DT > &p) const
 Even product, also known as Grassman inner product. More...
 
TQuaternion< DT > mult (const TQuaternion< DT > &q) const
 Multiplies this quaternion with another one (which is non-commutative). It is also called Grassman product. More...
 
TQuaternion< DT > euclideanMult (const TQuaternion< DT > &q) const
 Euclidean product of this quaternion with another one (which is non-commutative). More...
 
TQuaternion< DT > outer (const TQuaternion< DT > &q) const
 Euclidean outer product of this quaternion with another one. More...
 
TQuaternion< DT > div (const TQuaternion< DT > &d, bool *isError=nullptr) const
 Divides a quaternion by another quaternion. More...
 
TQuaternion< DT > mult (DT s) const
 Multiplies this quaternion with a scalar factor s. More...
 
TQuaternion< DT > add (const TQuaternion< DT > &b) const
 Adds another quaternion b to this one and returns the sum. More...
 
TQuaternion< DT > add (DT s) const
 Adds a scalar s to the quaternion and returns the sum. It is equivalent to a 'scalar add' of s to the qw component. More...
 
TQuaternion< DT > conjugate () const
 Computes the conjugate. More...
 
TQuaternion< DT > negate () const
 Computes the negation. More...
 
DT norm () const
 Computes the d-norm. More...
 
DT norm2 () const
 Computes the magnitude of the quaternion. More...
 
DT absoluteValue () const
 Returns the absolute value of a quaternion, which is the scalar quantity that determines the length of the quaternion from the origin. More...
 
TQuaternion< DT > normalize (bool *isError=nullptr) const
 Returns the normalization of the quaternion. More...
 
TQuaternion< DT > arg (bool *isError=nullptr) const
 Computes the quaternion argument. More...
 
TQuaternion< DT > sgn (bool *isError=nullptr) const
 Returns the sign of the quaternion. More...
 
TQuaternion< DT > inverse (bool *isInvertible=nullptr) const
 Computes and returns the inverse. More...
 
TQuaternion< DT > sqrt (bool *isError=nullptr) const
 Computes the square root of a quaternion. More...
 
TQuaternion< DT > exp () const
 Exponential and logarithmic functions: natural exponential, natural logarithm, power. More...
 
TQuaternion< DT > ln () const
 Computes the natural logarithm. More...
 
TQuaternion< DT > pow (const TQuaternion< DT > &quat) const
 Computes the power of a quaternion. More...
 
TQuaternion< DT > sin () const
 Trigonometric functions: sine, cosine, tangent, cotangent. More...
 
TQuaternion< DT > cos () const
 Computes the cosine. More...
 
TQuaternion< DT > tan (bool *isError=nullptr) const
 Computes the tangent; for error handling see _ML_QUATERNION_CALC_CHECKED. More...
 
TQuaternion< DT > cotan (bool *isError=nullptr) const
 Computes the cotangent; for error handling see _ML_QUATERNION_CALC_CHECKED. More...
 
TQuaternion< DT > sinh () const
 Hyperbolic functions: Hyperbolic sine, hyperbolic cosine, hyperbolic tangent https://en.wikipedia.org/wiki/Quaternion. More...
 
TQuaternion< DT > cosh () const
 Computes the hyperbolic cosine. More...
 
TQuaternion< DT > tanh (bool *isError=nullptr) const
 Computes the hyperbolic tangent; for error handling see _ML_QUATERNION_CALC_CHECKED. More...
 
TQuaternion< DT > cotanh (bool *isError=nullptr) const
 Computes the hyperbolic cotangent; for error handling see _ML_QUATERNION_CALC_CHECKED. More...
 
TQuaternion< DT > arcsinh () const
 Inverse hyperbolic function: arcsinh, arccosh, arctanh. More...
 
TQuaternion< DT > arccosh () const
 Computes the inverse hyperbolic cosine. More...
 
TQuaternion< DT > arctanh () const
 Computes the inverse hyperbolic tangent. More...
 
TQuaternion< DT > arcsin (bool *isError=nullptr) const
 Inverse trigonometric functions: Inverse sine, inverse cosine, inverse tangent. More...
 
TQuaternion< DT > arccos (bool *isError=nullptr) const
 Inverse cosine; for error handling see _ML_QUATERNION_CALC_CHECKED. More...
 
TQuaternion< DT > arctan (bool *isError=nullptr) const
 Inverse tangent; for error handling see _ML_QUATERNION_CALC_CHECKED. More...
 
Constructors
 TQuaternion ()
 Standard constructor that is setting all elements to 0. More...
 
 TQuaternion (DT d)
 Builds a quaternion from a scalar by setting all elements to 0 and qw to the scalar; use explicitly to avoid undesired use of quaternions instead of scalars. More...
 
template<typename DT2 >
 TQuaternion (const TQuaternion< DT2 > &q2)
 Copy constructor from another TQuaternion of same or different type. More...
 
 TQuaternion (const TQuaternion &q2)=default
 Explicitly generating the default constructor to avoid a warning message with gcc9. More...
 
 TQuaternion (DT x, DT y, DT z, DT w)
 Creates a new TQuaternion with the DT values given. More...
 
 TQuaternion (const FloatingPointVector< DT, 4 > &v)
 Creates a new TQuaternion from the four-dimensional parameter vector. More...
 
 TQuaternion (const FloatingPointVector< DT, 3, Vector3DataContainer< DT > > &v, DT w)
 Constructor with a vector and DT parameter. More...
 
Access to parts.
FloatingPointVector< DT, 3, Vector3DataContainer< DT > > getImaginaryPart () const
 Returns a copy of the quaternion's imaginary part. More...
 
DT getRealPart () const
 Returns a copy of the quaternion's real part, also called scalar() of a quaternion. More...
 
const FloatingPointVector< DT, 3, Vector3DataContainer< DT > > & qv () const
 Returns a constant reference to the quaternion's imaginary part as vector object. More...
 
FloatingPointVector< DT, 3, Vector3DataContainer< DT > > & qv ()
 Returns a modifiable reference to the quaternion's imaginary part as vector object, see same named constant version of this method. More...
 
void set (const FloatingPointVector< DT, 3, Vector3DataContainer< DT > > &v, const DT w)
 Sets all quaternion elements from a vector and DT parameter. More...
 
void set (const DT x, const DT y, const DT z, const DT w)
 Sets all quaternion elements qx, qy, qz, and qw from parameters x, y, z, and w, respectively. More...
 
Tmat4< DT > getAsMat4 (bool *isConvertible=nullptr) const
 Converts this quaternion to a 4x4 matrix. More...
 
Operators
DT operator[] (const size_t i) const
 Constant indexing operator. More...
 
DT & operator[] (const size_t i)
 Indexing operator. More...
 
TQuaternion< DT > & operator= (const TQuaternion< DT > &q)
 Assignment operator. More...
 
Functions and operators.
TQuaternion< DT > operator+ (const TQuaternion< DT > &b) const
 Adds the corresponding component from b to each component. More...
 
TQuaternion< DT > & operator+= (const TQuaternion< DT > &b)
 Adds the corresponding component from b to each component. More...
 
TQuaternion< DT > operator- (const TQuaternion< DT > &b) const
 Subtracts the corresponding component from b from each component. More...
 
TQuaternion< DT > & operator-= (const TQuaternion< DT > &b)
 Subtracts the corresponding component from b from each component. More...
 
TQuaternion< DT > operator* (const TQuaternion< DT > &b) const
 Multiplies each components with its corresponding components from b. More...
 
TQuaternion< DT > & operator*= (const TQuaternion< DT > &b)
 Multiplies each components with its corresponding components from b. More...
 
TQuaternion< DT > operator/ (DT d) const
 Divides by a scalar d. The caller must guarantee that d is non-zero. More...
 
TQuaternion< DT > & operator/= (DT d)
 Divides by a scalar d. The caller must guarantee that d is non-zero. More...
 
TQuaternion< DT > operator/ (const TQuaternion< DT > &q) const
 Divides by a quaternion by another. More...
 
TQuaternion< DT > compDiv (const TQuaternion< DT > &b, bool *isError=nullptr) const
 Divides each component by its corresponding component from b. More...
 
bool operator== (const TQuaternion< DT > &b) const
 Equality operator: Returns whether each component of this is equal to its corresponding component of b. More...
 
bool operator!= (const TQuaternion< DT > &b) const
 Inequality operator: Returns whether any component differs from its corresponding component of b. More...
 

Public Attributes

DT qx
 First element of imaginary part. More...
 
DT qy
 Second element of imaginary part. More...
 
DT qz
 Third element of imaginary part. More...
 
DT qw
 Real part. More...
 
DT array [4]
 Provides access to all members as an array with three imaginary components indexed by [0,1,2] and real part indexed by 3. More...
 
Members are public
union {
   struct {
      DT   qx
 First element of imaginary part. More...
 
      DT   qy
 Second element of imaginary part. More...
 
      DT   qz
 Third element of imaginary part. More...
 
      DT   qw
 Real part. More...
 
   } 
 All four elements as qx, qy, qz, qw, where qw (the last component) is the real part. More...
 
   DT   array [4]
 Provides access to all members as an array with three imaginary components indexed by [0,1,2] and real part indexed by 3. More...
 
}; 
 

Detailed Description

template<typename DT>
class ml::TQuaternion< DT >

Declaration of complex type traits.

Implementation of a Quaternion with common operations.

Declaration of quaternion type traits

This class is intended to be used with scalar floating point types as DT and DT2.

Definition at line 39 of file mlQuaternion.h.

Member Typedef Documentation

◆ value_type

template<typename DT >
typedef DT ml::TQuaternion< DT >::value_type

Scalar type used for qx, qy, qz, and qw.

Definition at line 45 of file mlQuaternion.h.

Constructor & Destructor Documentation

◆ TQuaternion() [1/7]

template<typename DT >
ml::TQuaternion< DT >::TQuaternion ( )
inline

Standard constructor that is setting all elements to 0.

Definition at line 90 of file mlQuaternion.h.

◆ TQuaternion() [2/7]

template<typename DT >
ml::TQuaternion< DT >::TQuaternion ( DT  d)
inlineexplicit

Builds a quaternion from a scalar by setting all elements to 0 and qw to the scalar; use explicitly to avoid undesired use of quaternions instead of scalars.

Definition at line 95 of file mlQuaternion.h.

◆ TQuaternion() [3/7]

template<typename DT >
template<typename DT2 >
ml::TQuaternion< DT >::TQuaternion ( const TQuaternion< DT2 > &  q2)
inlineexplicit

Copy constructor from another TQuaternion of same or different type.

The constructor takes another quaternion as a parameter and initializes this quaternion with copies of the parameter quaternion's data. q2 is the referenced quaternion, whose values are to be copied.

Definition at line 105 of file mlQuaternion.h.

References ml::TQuaternion< DT >::qw, ml::TQuaternion< DT >::qx, ml::TQuaternion< DT >::qy, and ml::TQuaternion< DT >::qz.

◆ TQuaternion() [4/7]

template<typename DT >
ml::TQuaternion< DT >::TQuaternion ( const TQuaternion< DT > &  q2)
default

Explicitly generating the default constructor to avoid a warning message with gcc9.

◆ TQuaternion() [5/7]

template<typename DT >
ml::TQuaternion< DT >::TQuaternion ( DT  x,
DT  y,
DT  z,
DT  w 
)
inlineexplicit

Creates a new TQuaternion with the DT values given.

Creates a new TQuaternion from the real and imaginary part values given as DT parameters: x Imaginary part x value. y Imaginary part y value. z Imaginary part z value. w Real part w value.

Definition at line 123 of file mlQuaternion.h.

◆ TQuaternion() [6/7]

template<typename DT >
ml::TQuaternion< DT >::TQuaternion ( const FloatingPointVector< DT, 4 > &  v)
inlineexplicit

Creates a new TQuaternion from the four-dimensional parameter vector.

Creates another TQuaternion object from the vector parameter. The four vector components correspond to the four quaternion components: v The vector containing the components: v[0] Real part (w) v[1], v[2], v[3] Imaginary part (x, y, z) The order of the components is crucial, since real and imaginary parts can become mixed up easily.

Definition at line 139 of file mlQuaternion.h.

◆ TQuaternion() [7/7]

template<typename DT >
ml::TQuaternion< DT >::TQuaternion ( const FloatingPointVector< DT, 3, Vector3DataContainer< DT > > &  v,
DT  w 
)
inlineexplicit

Constructor with a vector and DT parameter.

Constructs the quaternion with the real part given by w and the imaginary part contained in the vector v. Standard order x, y, z is consistent with the vector's components.

Definition at line 151 of file mlQuaternion.h.

Member Function Documentation

◆ absoluteValue()

template<typename DT >
DT ml::TQuaternion< DT >::absoluteValue ( ) const
inline

Returns the absolute value of a quaternion, which is the scalar quantity that determines the length of the quaternion from the origin.

It is a synonym for norm2().

Definition at line 523 of file mlQuaternion.h.

◆ add() [1/2]

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::add ( const TQuaternion< DT > &  b) const
inline

Adds another quaternion b to this one and returns the sum.

Definition at line 502 of file mlQuaternion.h.

References ml::TQuaternion< DT >::qw, ml::TQuaternion< DT >::qx, ml::TQuaternion< DT >::qy, and ml::TQuaternion< DT >::qz.

◆ add() [2/2]

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::add ( DT  s) const
inline

Adds a scalar s to the quaternion and returns the sum. It is equivalent to a 'scalar add' of s to the qw component.

Definition at line 505 of file mlQuaternion.h.

◆ arccos()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::arccos ( bool *  isError = nullptr) const
inline

Inverse cosine; for error handling see _ML_QUATERNION_CALC_CHECKED.

Definition at line 888 of file mlQuaternion.h.

References _ML_QUAT_CALC_EXP, and _ML_QUATERNION_CALC_CHECKED.

◆ arccosh()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::arccosh ( ) const
inline

Computes the inverse hyperbolic cosine.

Definition at line 826 of file mlQuaternion.h.

◆ arcsin()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::arcsin ( bool *  isError = nullptr) const
inline

Inverse trigonometric functions: Inverse sine, inverse cosine, inverse tangent.

https://en.wikipedia.org/wiki/Quaternion Inverse sine, for error handling see _ML_QUATERNION_CALC_CHECKED.

Definition at line 877 of file mlQuaternion.h.

References _ML_QUAT_CALC_EXP, and _ML_QUATERNION_CALC_CHECKED.

◆ arcsinh()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::arcsinh ( ) const
inline

Inverse hyperbolic function: arcsinh, arccosh, arctanh.

https://en.wikipedia.org/wiki/Quaternion Computes the inverse hyperbolic sine.

Definition at line 823 of file mlQuaternion.h.

◆ arctan()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::arctan ( bool *  isError = nullptr) const
inline

Inverse tangent; for error handling see _ML_QUATERNION_CALC_CHECKED.

Definition at line 899 of file mlQuaternion.h.

References _ML_QUAT_CALC_EXP, and _ML_QUATERNION_CALC_CHECKED.

◆ arctanh()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::arctanh ( ) const
inline

Computes the inverse hyperbolic tangent.

Definition at line 829 of file mlQuaternion.h.

◆ arg()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::arg ( bool *  isError = nullptr) const
inline

Computes the quaternion argument.

norm2 of quaternion must be non-zero or errors will occur. If isError is NULL, an error is posted to the error handling system if norm2 of the quaternion is 0. If isError is non-NULL, no error is posted, however, *isError is set to true, otherwise it is set to false. In error case and isError is non-NULL, the default quaternion is returned.

Definition at line 561 of file mlQuaternion.h.

References ML_BAD_PARAMETER, MLValueIs0WOM(), and ml::printTemplateError().

◆ compDiv()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::compDiv ( const TQuaternion< DT > &  b,
bool *  isError = nullptr 
) const
inline

Divides each component by its corresponding component from b.

The caller must guarantee that b does not contain any 0 or errors will occur in case that error is NULL. If error is passed as non-NULL, *isError will be set.

Definition at line 389 of file mlQuaternion.h.

References ML_CHECK_FLOAT, ml::TQuaternion< DT >::qw, ml::TQuaternion< DT >::qx, ml::TQuaternion< DT >::qy, ml::TQuaternion< DT >::qz, and ml::TQuaternion< DT >::set().

◆ conjugate()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::conjugate ( ) const
inline

Computes the conjugate.

Definition at line 508 of file mlQuaternion.h.

◆ cos()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::cos ( ) const
inline

◆ cosh()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::cosh ( ) const
inline

Computes the hyperbolic cosine.

Definition at line 789 of file mlQuaternion.h.

References ml::FloatingPointVector< T, size, DataContainer >::length(), MLValueIs0WOM(), and ml::TQuaternion< DT >::set().

◆ cotan()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::cotan ( bool *  isError = nullptr) const
inline

Computes the cotangent; for error handling see _ML_QUATERNION_CALC_CHECKED.

Definition at line 764 of file mlQuaternion.h.

◆ cotanh()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::cotanh ( bool *  isError = nullptr) const
inline

Computes the hyperbolic cotangent; for error handling see _ML_QUATERNION_CALC_CHECKED.

Definition at line 811 of file mlQuaternion.h.

◆ div()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::div ( const TQuaternion< DT > &  d,
bool *  isError = nullptr 
) const
inline

Divides a quaternion by another quaternion.

If isError is NULL, a division by zero it is posted to the error handling system. If isError is non-NULL, then no error is posted. However, in division by zero case *isError is set to true; otherwise, it is set to false. In error case and if isError is non-NULL, the unchanged quaternion is returned. Be aware multiplication of quaternions is not commutative. But there is a possibility; Source: https://www.mathworks.com/help/aeroblks/quaterniondivision.html

Definition at line 469 of file mlQuaternion.h.

References ML_BAD_PARAMETER, ml::printTemplateError(), ml::TQuaternion< DT >::qw, ml::TQuaternion< DT >::qx, ml::TQuaternion< DT >::qy, ml::TQuaternion< DT >::qz, and ml::TQuaternion< DT >::set().

◆ dot()

template<typename DT >
DT ml::TQuaternion< DT >::dot ( const TQuaternion< DT > &  p) const
inline

Dot product, equivalent to four component vector dot product.

Definition at line 435 of file mlQuaternion.h.

References ml::TQuaternion< DT >::qw, ml::TQuaternion< DT >::qx, ml::TQuaternion< DT >::qy, and ml::TQuaternion< DT >::qz.

◆ euclideanMult()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::euclideanMult ( const TQuaternion< DT > &  q) const
inline

Euclidean product of this quaternion with another one (which is non-commutative).

Definition at line 455 of file mlQuaternion.h.

Referenced by ml::TQuaternion< DT >::outer().

◆ even()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::even ( const TQuaternion< DT > &  p) const
inline

Even product, also known as Grassman inner product.

It is the purely symmetric product; therefore, it is completely commutative.

Definition at line 446 of file mlQuaternion.h.

References ml::TQuaternion< DT >::qw, ml::TQuaternion< DT >::qx, ml::TQuaternion< DT >::qy, and ml::TQuaternion< DT >::qz.

◆ exp()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::exp ( ) const
inline

Exponential and logarithmic functions: natural exponential, natural logarithm, power.

https://en.wikipedia.org/wiki/Quaternion Computes the natural exponential.

Definition at line 687 of file mlQuaternion.h.

References MLValueIs0WOM(), and ml::TQuaternion< DT >::mult().

◆ getAsMat4()

template<typename DT >
Tmat4<DT> ml::TQuaternion< DT >::getAsMat4 ( bool *  isConvertible = nullptr) const
inline

Converts this quaternion to a 4x4 matrix.

IfisConvertible is passed as NULL (the default), the object must be convertible; otherwise, errors will be posted. If a non-NULL bool pointer is passed, then *isConvertible is set true in case of successfully conversion or false in case of failure and no error will be posted.

Definition at line 224 of file mlQuaternion.h.

References ML_BAD_PARAMETER, ml::printTemplateError(), and ml::Tmat4< DT >::set().

◆ getImaginaryPart()

template<typename DT >
FloatingPointVector<DT, 3, Vector3DataContainer<DT> > ml::TQuaternion< DT >::getImaginaryPart ( ) const
inline

Returns a copy of the quaternion's imaginary part.

Fetches the imaginary part and returns it as a 3D vector.

Definition at line 166 of file mlQuaternion.h.

◆ getRealPart()

template<typename DT >
DT ml::TQuaternion< DT >::getRealPart ( ) const
inline

Returns a copy of the quaternion's real part, also called scalar() of a quaternion.

Definition at line 172 of file mlQuaternion.h.

◆ inverse()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::inverse ( bool *  isInvertible = nullptr) const
inline

Computes and returns the inverse.

If isInvertible is passed as NULL (the default), the object must be invertible. Otherwise, errors will be posted. If a non-NULL bool pointer is passed, then *isInvertible is set true in case of successfully inversion or false in case of failure and no error will be posted.

Definition at line 621 of file mlQuaternion.h.

References ML_BAD_PARAMETER, MLValueIs0WOM(), ml::TQuaternion< DT >::mult(), and ml::printTemplateError().

◆ ln()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::ln ( ) const
inline

Computes the natural logarithm.

Definition at line 703 of file mlQuaternion.h.

References MLValueIs0WOM(), and ml::TQuaternion< DT >::set().

◆ mult() [1/2]

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::mult ( const TQuaternion< DT > &  q) const
inline

Multiplies this quaternion with another one (which is non-commutative). It is also called Grassman product.

Definition at line 452 of file mlQuaternion.h.

References ml::FloatingPointVector< T, size, DataContainer >::cross(), ml::FloatingPointVector< T, size, DataContainer >::dot(), ml::TQuaternion< DT >::qv(), and ml::TQuaternion< DT >::qw.

Referenced by ml::TQuaternion< DT >::exp(), and ml::TQuaternion< DT >::inverse().

◆ mult() [2/2]

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::mult ( DT  s) const
inline

Multiplies this quaternion with a scalar factor s.

Definition at line 499 of file mlQuaternion.h.

◆ negate()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::negate ( ) const
inline

Computes the negation.

Definition at line 511 of file mlQuaternion.h.

◆ norm()

template<typename DT >
DT ml::TQuaternion< DT >::norm ( ) const
inline

Computes the d-norm.

Definition at line 514 of file mlQuaternion.h.

◆ norm2()

template<typename DT >
DT ml::TQuaternion< DT >::norm2 ( ) const
inline

Computes the magnitude of the quaternion.

norm2 is also known as the absolute value.

Definition at line 519 of file mlQuaternion.h.

◆ normalize()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::normalize ( bool *  isError = nullptr) const
inline

Returns the normalization of the quaternion.

If the sign cannot be determined, an error is created. If isError is NULL, it is posted to the error handling system. If isError is non-NULL, no error is posted, however, *isError is set to true; otherwise, it is set to false. In error case and isError is non-NULL, 0 is returned.

Definition at line 529 of file mlQuaternion.h.

References ML_BAD_PARAMETER, MLValueIs0WOM(), ml::printTemplateError(), and ml::TQuaternion< DT >::set().

◆ odd()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::odd ( const TQuaternion< DT > &  p) const
inline

Odd product, also known as cross-product or Grassman outer product.

It is equivalent to the vector cross-product, and returns a vector quantity only.

Definition at line 439 of file mlQuaternion.h.

References ml::TQuaternion< DT >::qx, ml::TQuaternion< DT >::qy, and ml::TQuaternion< DT >::qz.

◆ operator!=()

template<typename DT >
bool ml::TQuaternion< DT >::operator!= ( const TQuaternion< DT > &  b) const
inline

Inequality operator: Returns whether any component differs from its corresponding component of b.

Definition at line 429 of file mlQuaternion.h.

References ml::operator==().

◆ operator*()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::operator* ( const TQuaternion< DT > &  b) const
inline

Multiplies each components with its corresponding components from b.

Definition at line 357 of file mlQuaternion.h.

◆ operator*=()

template<typename DT >
TQuaternion<DT>& ml::TQuaternion< DT >::operator*= ( const TQuaternion< DT > &  b)
inline

Multiplies each components with its corresponding components from b.

Definition at line 359 of file mlQuaternion.h.

◆ operator+()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::operator+ ( const TQuaternion< DT > &  b) const
inline

Adds the corresponding component from b to each component.

Definition at line 347 of file mlQuaternion.h.

References ml::TQuaternion< DT >::qw, ml::TQuaternion< DT >::qx, ml::TQuaternion< DT >::qy, and ml::TQuaternion< DT >::qz.

◆ operator+=()

template<typename DT >
TQuaternion<DT>& ml::TQuaternion< DT >::operator+= ( const TQuaternion< DT > &  b)
inline

Adds the corresponding component from b to each component.

Definition at line 349 of file mlQuaternion.h.

References ml::TQuaternion< DT >::qw, ml::TQuaternion< DT >::qx, ml::TQuaternion< DT >::qy, and ml::TQuaternion< DT >::qz.

◆ operator-()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::operator- ( const TQuaternion< DT > &  b) const
inline

Subtracts the corresponding component from b from each component.

Definition at line 352 of file mlQuaternion.h.

References ml::TQuaternion< DT >::qw, ml::TQuaternion< DT >::qx, ml::TQuaternion< DT >::qy, and ml::TQuaternion< DT >::qz.

◆ operator-=()

template<typename DT >
TQuaternion<DT>& ml::TQuaternion< DT >::operator-= ( const TQuaternion< DT > &  b)
inline

Subtracts the corresponding component from b from each component.

Definition at line 354 of file mlQuaternion.h.

References ml::TQuaternion< DT >::qw, ml::TQuaternion< DT >::qx, ml::TQuaternion< DT >::qy, and ml::TQuaternion< DT >::qz.

◆ operator/() [1/2]

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::operator/ ( const TQuaternion< DT > &  q) const
inline

Divides by a quaternion by another.

Definition at line 380 of file mlQuaternion.h.

◆ operator/() [2/2]

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::operator/ ( DT  d) const
inline

Divides by a scalar d. The caller must guarantee that d is non-zero.

Definition at line 362 of file mlQuaternion.h.

References ML_CHECK_FLOAT.

◆ operator/=()

template<typename DT >
TQuaternion<DT>& ml::TQuaternion< DT >::operator/= ( DT  d)
inline

Divides by a scalar d. The caller must guarantee that d is non-zero.

Definition at line 371 of file mlQuaternion.h.

References ML_CHECK_FLOAT.

◆ operator=()

template<typename DT >
TQuaternion<DT>& ml::TQuaternion< DT >::operator= ( const TQuaternion< DT > &  q)
inline

◆ operator==()

template<typename DT >
bool ml::TQuaternion< DT >::operator== ( const TQuaternion< DT > &  b) const
inline

Equality operator: Returns whether each component of this is equal to its corresponding component of b.

Definition at line 423 of file mlQuaternion.h.

References MLValuesAreEqualWOM(), ml::TQuaternion< DT >::qw, ml::TQuaternion< DT >::qx, ml::TQuaternion< DT >::qy, and ml::TQuaternion< DT >::qz.

◆ operator[]() [1/2]

template<typename DT >
DT& ml::TQuaternion< DT >::operator[] ( const size_t  i)
inline

Indexing operator.

Permits read and write access to qx, qy, qz, and qw via indexes 0,1,2 and 3, respectively. The caller must guarantee that i is within [0,...,3].

Definition at line 325 of file mlQuaternion.h.

◆ operator[]() [2/2]

template<typename DT >
DT ml::TQuaternion< DT >::operator[] ( const size_t  i) const
inline

Constant indexing operator.

Permits read access to qx, qy, qz, and qw via indexes 0,1,2, and 3, respectively. The caller must guarantee that i is within [0,...,3].

Definition at line 320 of file mlQuaternion.h.

◆ outer()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::outer ( const TQuaternion< DT > &  q) const
inline

Euclidean outer product of this quaternion with another one.

Definition at line 458 of file mlQuaternion.h.

References ml::TQuaternion< DT >::euclideanMult().

◆ pow()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::pow ( const TQuaternion< DT > &  quat) const
inline

Computes the power of a quaternion.

Definition at line 721 of file mlQuaternion.h.

◆ qv() [1/2]

template<typename DT >
FloatingPointVector<DT, 3, Vector3DataContainer<DT> >& ml::TQuaternion< DT >::qv ( )
inline

Returns a modifiable reference to the quaternion's imaginary part as vector object, see same named constant version of this method.

BUG: This function in the current version breaks strict aliasing and should be fixed; see MMS Bug 57542 for details.

Definition at line 193 of file mlQuaternion.h.

◆ qv() [2/2]

template<typename DT >
const FloatingPointVector<DT, 3, Vector3DataContainer<DT> >& ml::TQuaternion< DT >::qv ( ) const
inline

Returns a constant reference to the quaternion's imaginary part as vector object.

It uses a hack by casting the reference to the first three array components to a scalar vector template. This is not nice, however, it became necessary to provide compatibility to former versions, where qv was a class union component, which is not allowed anymore under newer compiler versions. BUG: This function in the current version breaks strict aliasing and should be fixed; see MMS Bug 57542 for details.

Definition at line 184 of file mlQuaternion.h.

Referenced by ml::TQuaternion< DT >::mult().

◆ set() [1/2]

template<typename DT >
void ml::TQuaternion< DT >::set ( const DT  x,
const DT  y,
const DT  z,
const DT  w 
)
inline

Sets all quaternion elements qx, qy, qz, and qw from parameters x, y, z, and w, respectively.

Definition at line 211 of file mlQuaternion.h.

◆ set() [2/2]

template<typename DT >
void ml::TQuaternion< DT >::set ( const FloatingPointVector< DT, 3, Vector3DataContainer< DT > > &  v,
const DT  w 
)
inline

Sets all quaternion elements from a vector and DT parameter.

Constructs the quaternion with the real part given by w and the imaginary part contained in the vector v.

Definition at line 201 of file mlQuaternion.h.

Referenced by ml::TQuaternion< DT >::compDiv(), ml::TQuaternion< DT >::cos(), ml::TQuaternion< DT >::cosh(), ml::TQuaternion< DT >::div(), ml::TQuaternion< DT >::ln(), ml::TQuaternion< DT >::normalize(), ml::TQuaternion< DT >::sin(), ml::TQuaternion< DT >::sinh(), and ml::TQuaternion< DT >::sqrt().

◆ sgn()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::sgn ( bool *  isError = nullptr) const
inline

Returns the sign of the quaternion.

If the sign cannot be determined, an error is posted. If isError is NULL, it is posted to the error handling system. If isError is non-NULL, no error is posted, however, *isError is set to true, otherwise it is set to false. In error case and isError is non-NULL, the default quaternion is returned.

Definition at line 592 of file mlQuaternion.h.

References ML_CHECK_FLOAT.

◆ sin()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::sin ( ) const
inline

Trigonometric functions: sine, cosine, tangent, cotangent.

https://en.wikipedia.org/wiki/Quaternion Computes the sine.

Definition at line 729 of file mlQuaternion.h.

References ml::FloatingPointVector< T, size, DataContainer >::length(), MLValueIs0WOM(), and ml::TQuaternion< DT >::set().

◆ sinh()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::sinh ( ) const
inline

Hyperbolic functions: Hyperbolic sine, hyperbolic cosine, hyperbolic tangent https://en.wikipedia.org/wiki/Quaternion.

Computes the hyperbolic sine.

Definition at line 773 of file mlQuaternion.h.

References ml::FloatingPointVector< T, size, DataContainer >::length(), MLValueIs0WOM(), and ml::TQuaternion< DT >::set().

◆ sqrt()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::sqrt ( bool *  isError = nullptr) const
inline

Computes the square root of a quaternion.

If sqrt cannot be determined, an error is created. If isError is NULL, it is posted to the error handling system. If isError is non-NULL, no error is posted, however, *isError is set to true, otherwise it is set to false. In error case and isError is non-NULL, the default quaternion is returned.

Definition at line 649 of file mlQuaternion.h.

References ML_BAD_PARAMETER, MLValueIs0WOM(), ml::printTemplateError(), and ml::TQuaternion< DT >::set().

◆ tan()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::tan ( bool *  isError = nullptr) const
inline

Computes the tangent; for error handling see _ML_QUATERNION_CALC_CHECKED.

Definition at line 761 of file mlQuaternion.h.

◆ tanh()

template<typename DT >
TQuaternion<DT> ml::TQuaternion< DT >::tanh ( bool *  isError = nullptr) const
inline

Computes the hyperbolic tangent; for error handling see _ML_QUATERNION_CALC_CHECKED.

Definition at line 805 of file mlQuaternion.h.

Member Data Documentation

◆ 

union { ... }

◆ array

template<typename DT >
DT ml::TQuaternion< DT >::array[4]

Provides access to all members as an array with three imaginary components indexed by [0,1,2] and real part indexed by 3.

For performance reasons, no checks are performed: the caller must guarantee that indexes are within [0,...,3].

Definition at line 80 of file mlQuaternion.h.

◆ qw

◆ qx

◆ qy

◆ qz


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