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

Implementation of a Quaternion with common operations. More...

#include <mlQuaternion.h>

List of all members.

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=NULL) 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=NULL) const
 Returns the normalization of the quaternion.
TQuaternion< DT > arg (bool *isError=NULL) const
 Computes the quaternion argument.
TQuaternion< DT > sgn (bool *isError=NULL) const
 Returns the sign of the quaternion.
TQuaternion< DT > inverse (bool *isInvertible=NULL) const
 Computes and returns the inverse.
TQuaternion< DT > sqrt (bool *isError=NULL) 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
 Compute the natural logarithm.
TQuaternion< DT > pow (const TQuaternion< DT > &quat) const
 Compute the power of a quaternion.
TQuaternion< DT > sin () const
 Trigonometric functions: sine, cosine, tangent, cotangent.
TQuaternion< DT > cos () const
 Compute the cosine.
TQuaternion< DT > tan (bool *isError=NULL) const
 Compute the tangent, for error handling see _ML_QUATERNION_CALC_CHECKED.
TQuaternion< DT > cotan (bool *isError=NULL) const
 Compute 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
 Compute the hyperbolic cosine.
TQuaternion< DT > tanh (bool *isError=NULL) const
 Compute the hyperbolic tangent, for error handling see _ML_QUATERNION_CALC_CHECKED..
TQuaternion< DT > cotanh (bool *isError=NULL) const
 Compute 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
 Compute the inverse hyperbolic cosine.
TQuaternion< DT > arctanh () const
 Compute the inverse hyperbolic tangent.
TQuaternion< DT > arcsin (bool *isError=NULL) const
 Inverse trigonometric functions: Inverse sine, inverse cosine, inverse tangent.
TQuaternion< DT > arccos (bool *isError=NULL) const
 Inverse cosine, for error handling see _ML_QUATERNION_CALC_CHECKED.
TQuaternion< DT > arctan (bool *isError=NULL) 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 (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=NULL) 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
 To each component add the corresponding component from b.
TQuaternion< DT > & operator+= (const TQuaternion< DT > &b)
 To each component add the corresponding component from b.
TQuaternion< DT > operator- (const TQuaternion< DT > &b) const
 From each component subtract the corresponding component from b.
TQuaternion< DT > & operator-= (const TQuaternion< DT > &b)
 From each component subtract the corresponding component from b.
TQuaternion< DT > operator* (const TQuaternion< DT > &b) const
 Multiply each components with its corresponding components from b.
TQuaternion< DT > & operator*= (const TQuaternion< DT > &b)
 Multiply each components with its corresponding components from b.
TQuaternion< DT > operator/ (DT d) const
 Division with scalar, the caller must guarantee that d is non-zero.
TQuaternion< DT > & operator/= (DT d)
 Division with scalar, the caller must guarantee that d is non-zero.
TQuaternion< DT > operator/ (const TQuaternion< DT > &q) const
 Division of a quaternion by another.
TQuaternion< DT > compDiv (const TQuaternion< DT > &b, bool *isError=NULL) const
 Divide 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 true if each component of a is equal to its corresponding component of b, otherwise false.
bool operator!= (const TQuaternion< DT > &b) const
 Inequality operator: Returns true if any component differs from its corresponding component of b, otherwise false.

Public Attributes

DT qx
 First element of imaginary part.
DT qy
 Second element of imaginary part.
DT qz
 Third element of imaginary part.
DT qw
 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.
Members are public
union {
   struct {
      DT   qx
 First element of imaginary part.
      DT   qy
 Second element of imaginary part.
      DT   qz
 Third element of imaginary part.
      DT   qw
 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.
}; 

Detailed Description

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

Implementation of a Quaternion with common operations.

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

Definition at line 38 of file mlQuaternion.h.


Constructor & Destructor Documentation

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

Standard constructor, setting all elements to 0.

Definition at line 84 of file mlQuaternion.h.

template<typename DT>
ml::TQuaternion< DT >::TQuaternion ( DT  d) [inline, explicit]

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

References ML_TRACE_IN_TIME_CRITICAL.

template<typename DT>
template<typename DT2 >
ml::TQuaternion< DT >::TQuaternion ( const TQuaternion< DT2 > &  q2) [inline, explicit]

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

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

template<typename DT>
ml::TQuaternion< DT >::TQuaternion ( DT  x,
DT  y,
DT  z,
DT  w 
) [inline, explicit]

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

References ML_TRACE_IN_TIME_CRITICAL.

template<typename DT>
ml::TQuaternion< DT >::TQuaternion ( const FloatingPointVector< DT, 4 > &  v) [inline, explicit]

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

References ML_TRACE_IN_TIME_CRITICAL.

template<typename DT>
ml::TQuaternion< DT >::TQuaternion ( const FloatingPointVector< DT, 3, Vector3DataContainer< DT > > &  v,
DT  w 
) [inline, explicit]

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

References ML_TRACE_IN_TIME_CRITICAL.


Member Function Documentation

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

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

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

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

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

Inverse cosine, for error handling see _ML_QUATERNION_CALC_CHECKED.

Definition at line 1014 of file mlQuaternion.h.

References _ML_QUAT_CALC_EXP, and _ML_QUATERNION_CALC_CHECKED.

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

Compute the inverse hyperbolic cosine.

Definition at line 947 of file mlQuaternion.h.

template<typename DT>
TQuaternion<DT> ml::TQuaternion< DT >::arcsin ( bool *  isError = NULL) 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 1003 of file mlQuaternion.h.

References _ML_QUAT_CALC_EXP, and _ML_QUATERNION_CALC_CHECKED.

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 Compute the inverse hyperbolic sine.

Definition at line 944 of file mlQuaternion.h.

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

Inverse tangent, for error handling see _ML_QUATERNION_CALC_CHECKED.

Definition at line 1025 of file mlQuaternion.h.

References _ML_QUAT_CALC_EXP, and _ML_QUATERNION_CALC_CHECKED.

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

Compute the inverse hyperbolic tangent.

Definition at line 950 of file mlQuaternion.h.

template<typename DT>
TQuaternion<DT> ml::TQuaternion< DT >::arg ( bool *  isError = NULL) 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 600 of file mlQuaternion.h.

References ML_BAD_PARAMETER, ML_CATCH_RETHROW, ML_PRINT_ERROR, ML_TRACE_IN, ML_TRY, and MLValueIs0WOM().

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

Divide 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 409 of file mlQuaternion.h.

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

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

Computes the conjugate.

Definition at line 540 of file mlQuaternion.h.

template<typename DT>
TQuaternion<DT> ml::TQuaternion< DT >::cos ( ) const [inline]
template<typename DT>
TQuaternion<DT> ml::TQuaternion< DT >::cosh ( ) const [inline]
template<typename DT>
TQuaternion<DT> ml::TQuaternion< DT >::cotan ( bool *  isError = NULL) const [inline]

Compute the cotangent, for error handling see _ML_QUATERNION_CALC_CHECKED.

Definition at line 855 of file mlQuaternion.h.

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

Compute the hyperbolic cotangent, for error handling see _ML_QUATERNION_CALC_CHECKED..

Definition at line 923 of file mlQuaternion.h.

References ml::TQuaternion< DT >::div(), ML_CATCH_RETHROW, ML_TRACE_IN, and ML_TRY.

template<typename DT>
TQuaternion<DT> ml::TQuaternion< DT >::div ( const TQuaternion< DT > &  d,
bool *  isError = NULL 
) 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 495 of file mlQuaternion.h.

References ML_BAD_PARAMETER, ML_CATCH_RETHROW, ML_PRINT_ERROR, ML_TRACE_IN, ML_TRY, ml::TQuaternion< DT >::qw, ml::TQuaternion< DT >::qx, ml::TQuaternion< DT >::qy, ml::TQuaternion< DT >::qz, and ml::TQuaternion< DT >::set().

Referenced by ml::TQuaternion< DT >::cotanh(), and ml::TQuaternion< DT >::tanh().

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

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

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

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

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

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

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 Compute the natural exponential.

Definition at line 752 of file mlQuaternion.h.

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

template<typename DT>
Tmat4<DT> ml::TQuaternion< DT >::getAsMat4 ( bool *  isConvertible = NULL) 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_CATCH_RETHROW, ML_PRINT_ERROR, ML_TRACE_IN, ML_TRY, and ml::Tmat4< DT >::set().

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

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

template<typename DT>
TQuaternion<DT> ml::TQuaternion< DT >::inverse ( bool *  isInvertible = NULL) 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 672 of file mlQuaternion.h.

References ML_BAD_PARAMETER, ML_CATCH_RETHROW, ML_PRINT_ERROR, ML_TRACE_IN, ML_TRY, MLValueIs0WOM(), and ml::TQuaternion< DT >::mult().

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

Compute the natural logarithm.

Definition at line 774 of file mlQuaternion.h.

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

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

References ml::FloatingPointVector< DT, 3, Vector3DataContainer< DT > >::cross(), ml::FloatingPointVector< DT, 3, Vector3DataContainer< DT > >::dot(), ml::TQuaternion< DT >::qv(), and ml::TQuaternion< DT >::qw.

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

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

Multiplies this quaternion with a scalar factor.

Definition at line 531 of file mlQuaternion.h.

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

Computes the negation.

Definition at line 543 of file mlQuaternion.h.

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

Computes the d norm.

Definition at line 546 of file mlQuaternion.h.

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

template<typename DT>
TQuaternion<DT> ml::TQuaternion< DT >::normalize ( bool *  isError = NULL) 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 561 of file mlQuaternion.h.

References ML_BAD_PARAMETER, ML_CATCH_RETHROW, ML_PRINT_ERROR, ML_TRACE_IN, ML_TRY, MLValueIs0WOM(), and ml::TQuaternion< DT >::set().

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

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

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

Inequality operator: Returns true if any component differs from its corresponding component of b, otherwise false.

Definition at line 455 of file mlQuaternion.h.

References ml::operator==().

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

Multiply each components with its corresponding components from b.

Definition at line 366 of file mlQuaternion.h.

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

Multiply each components with its corresponding components from b.

Definition at line 368 of file mlQuaternion.h.

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

To each component add the corresponding component from b.

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.

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

To each component add the corresponding component from b.

Definition at line 358 of file mlQuaternion.h.

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

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

From each component subtract the corresponding component from b.

Definition at line 361 of file mlQuaternion.h.

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

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

From each component subtract the corresponding component from b.

Definition at line 363 of file mlQuaternion.h.

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

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

Division with scalar, the caller must guarantee that d is non-zero.

Definition at line 371 of file mlQuaternion.h.

References ML_CATCH_RETHROW, ML_CHECK_FLOAT, ML_TRACE_IN, and ML_TRY.

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

Division of a quaternion by another.

Definition at line 400 of file mlQuaternion.h.

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

Division with scalar, the caller must guarantee that d is non-zero.

Definition at line 386 of file mlQuaternion.h.

References ML_CATCH_RETHROW, ML_CHECK_FLOAT, ML_TRACE_IN, and ML_TRY.

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

Equality operator: Returns true if each component of a is equal to its corresponding component of b, otherwise false.

Definition at line 449 of file mlQuaternion.h.

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

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

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

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

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

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

Compute the power of a quaternion.

Definition at line 798 of file mlQuaternion.h.

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

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

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

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.

References ML_TRACE_IN_TIME_CRITICAL.

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

References ML_TRACE_IN_TIME_CRITICAL.

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

template<typename DT>
TQuaternion<DT> ml::TQuaternion< DT >::sgn ( bool *  isError = NULL) 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 637 of file mlQuaternion.h.

References ML_CATCH_RETHROW, ML_CHECK_FLOAT, ML_TRACE_IN, and ML_TRY.

template<typename DT>
TQuaternion<DT> ml::TQuaternion< DT >::sin ( ) const [inline]
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.

Compute the hyperbolic sine.

Definition at line 865 of file mlQuaternion.h.

References ml::FloatingPointVector< DT, 3, Vector3DataContainer< DT > >::length(), ML_CATCH_RETHROW, ML_TRACE_IN, ML_TRY, MLValueIs0WOM(), and ml::TQuaternion< DT >::set().

template<typename DT>
TQuaternion<DT> ml::TQuaternion< DT >::sqrt ( bool *  isError = NULL) 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 707 of file mlQuaternion.h.

References ML_BAD_PARAMETER, ML_CATCH_RETHROW, ML_PRINT_ERROR, ML_TRACE_IN, ML_TRY, MLValueIs0WOM(), and ml::TQuaternion< DT >::set().

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

Compute the tangent, for error handling see _ML_QUATERNION_CALC_CHECKED.

Definition at line 852 of file mlQuaternion.h.

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

Compute the hyperbolic tangent, for error handling see _ML_QUATERNION_CALC_CHECKED..

Definition at line 909 of file mlQuaternion.h.

References ml::TQuaternion< DT >::div(), ML_CATCH_RETHROW, ML_TRACE_IN, and ML_TRY.


Member Data Documentation

union { ... }
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 74 of file mlQuaternion.h.


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