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.
 

Public Member Functions

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

Public Attributes

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.
 
   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 41 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 47 of file mlQuaternion.h.

Constructor & Destructor Documentation

◆ TQuaternion() [1/7]

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

Standard constructor, setting all elements to 0.

Definition at line 92 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 explicit to avoid undesired use of quaternions instead of scalars.

Definition at line 97 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 other type.

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

Definition at line 107 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 125 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) Order of the components is crucial, since real and imaginary parts can become mixed up easily.

Definition at line 141 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 qv. Standard order x, y, z is consistent with the vector's components.

Definition at line 153 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 525 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 to this one and returns the sum.

Definition at line 504 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 to the quaternion and returns the sum, it is equivalent to a scalar add of s to the qw component.

Definition at line 507 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 896 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 833 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.

Source: http://www.fraktalstudio.de/ifunct_d.htm http://en.wikipedia.org/wiki/Quaternion Inverse sine, for error handling see _ML_QUATERNION_CALC_CHECKED.

Definition at line 885 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.

Source: http://www.fraktalstudio.de/ifunct_d.htm http://en.wikipedia.org/wiki/Quaternion Computes the inverse hyperbolic sine.

Definition at line 830 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 907 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 836 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 563 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 391 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 510 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 795 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 769 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 817 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: http://www.mathworks.com/access/helpdesk/help/toolbox/aeroblks/quaterniondivision.html

Definition at line 471 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 4 component vector dot product.

Definition at line 437 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 457 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 448 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.

Source: http://www.fraktalstudio.de/ifunct_d.htm http://en.wikipedia.org/wiki/Quaternion Computes the natural exponential.

Definition at line 691 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.

If isConvertible 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 226 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 168 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 174 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 623 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 707 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 454 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.

Definition at line 501 of file mlQuaternion.h.

◆ negate()

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

Computes the negation.

Definition at line 513 of file mlQuaternion.h.

◆ norm()

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

Computes the d norm.

Definition at line 516 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 521 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 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 531 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 441 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 431 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 359 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 361 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 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)
inline

Adds the corresponding component from b to each component .

Definition at line 351 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 354 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 356 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 382 of file mlQuaternion.h.

◆ operator/() [2/2]

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

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

Definition at line 364 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, the caller must guarantee that d is non-zero.

Definition at line 373 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 a is equal to its corresponding component of b.

Definition at line 425 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 327 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 322 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 460 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 725 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 195 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 any more 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 186 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 213 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 qv.

Definition at line 203 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 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 594 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.

Source: http://www.fraktalstudio.de/ifunct_d.htm http://en.wikipedia.org/wiki/Quaternion Computes the sine.

Definition at line 734 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 Source: http://www.fraktalstudio.de/ifunct_d.htm http://en.wikipedia.org/wiki/Quaternion.

Computes the hyperbolic sine.

Definition at line 779 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. Source: http://home.pcisys.net/~bestwork.1/QRW/QuaternionQuantumMechanics.htm

Definition at line 652 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 766 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 811 of file mlQuaternion.h.

Member Data Documentation

◆ [union]

union { ... } ml::TQuaternion< DT >

◆ 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 done: the caller must guarantee that indexes are within [0,...,3].

Definition at line 82 of file mlQuaternion.h.

◆ qw

◆ qx

◆ qy

◆ qz


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