ML Reference
MeVis/Foundation/Sources/MLLinearAlgebra/mlQuaternion.h File Reference

Template class for quaternion numerics. More...

#include "mlLinearAlgebraSystem.h"
#include "mlVector3.h"

Go to the source code of this file.

Classes

class  ml::TQuaternion< DT >
 Implementation of a Quaternion with common operations. More...

Namespaces

namespace  ml
 

Define the namespace name like in the ML. Default is ml.


namespace  std
 

Provide trigonometric etc.


Defines

#define _ML_QUATERNION_CALC_CHECKED(FUNC_NAME, CALC_EXPR)
 Defines a code fragment which checks and handles some stuff for safe expression calculations.
#define _ML_QUAT_CALC_EXP   TQuaternion<DT>(-v/len,0).mult(mult(TQuaternion<DT>(-v/len,0)).arcsinh());
 Internal helper macro - do not use.
#define _ML_QUAT_CALC_EXP   TQuaternion<DT>(-v/len,0).mult(arccosh());
 Internal helper macro - do not use.
#define _ML_QUAT_CALC_EXP   TQuaternion<DT>(-v/len,0).mult(mult(TQuaternion<DT>(-v/len,0)).arctanh());
 Internal helper macro - do not use.

Typedefs

Specializations for float, double, and long double.
typedef TQuaternion< MLfloatml::Quaternionf
 A smaller Quaternion type as specialization from TQuaternion.
typedef TQuaternion< MLdoubleml::Quaterniond
 The default Quaternion type used in the ML as specialization from TQuaternion.
typedef TQuaternion< MLldoubleml::Quaternionld
 A large Quaternion type for further extensions of the ML as specialization from TQuaternion.
typedef TQuaternion< MLdoubleml::Quaternion
 Define the default Quaternion type which is used by the ML; it uses double as component type.

Functions

template<typename DT >
ostream & std::operator<< (ostream &s, const ml::TQuaternion< DT > &v)
 Overloading the operator "<<" for stream output of TQuaternion objects.

Detailed Description

Template class for quaternion numerics.

Implementation of a Quaternion with common operations; for definition and examples see http://en.wikipedia.org/wiki/Quaternion as reference page. It is also the source of many comments. More sources: http://www.fraktalstudio.de/ifunct_d.htm http://home.pcisys.net/~bestwork.1/QRW/QuaternionQuantumMechanics.htm

Author:
Tobias B�hler, Wolf Spindler, Andreas Burgmann
Date:
09/2004

Definition in file mlQuaternion.h.


Define Documentation

#define _ML_QUAT_CALC_EXP   TQuaternion<DT>(-v/len,0).mult(mult(TQuaternion<DT>(-v/len,0)).arcsinh());

Internal helper macro - do not use.

Definition at line 1023 of file mlQuaternion.h.

Referenced by ml::TQuaternion< DT >::arccos(), ml::TQuaternion< DT >::arcsin(), and ml::TQuaternion< DT >::arctan().

#define _ML_QUAT_CALC_EXP   TQuaternion<DT>(-v/len,0).mult(mult(TQuaternion<DT>(-v/len,0)).arctanh());

Internal helper macro - do not use.

Definition at line 1023 of file mlQuaternion.h.

#define _ML_QUAT_CALC_EXP   TQuaternion<DT>(-v/len,0).mult(arccosh());

Internal helper macro - do not use.

Definition at line 1023 of file mlQuaternion.h.

#define _ML_QUATERNION_CALC_CHECKED (   FUNC_NAME,
  CALC_EXPR 
)
Value:
ML_TRACE_IN("TQuaternion<DT>::" FUNC_NAME "() const");                         \
                                                                                     \
      TQuaternion<DT> retVal;                                                        \
      ML_TRY                                                                         \
      {                                                                              \
        const Tvec3<DT> &v  = qv();                                                  \
        const DT        len = v.length();                                            \
        if (MLValueIs0WOM(len)){                                                     \
          /* Error! Check whether we have a pointer to a return error code value. */ \
          if (isError == NULL){                                                      \
            /* No, post an error. */                                                 \
            ML_PRINT_ERROR("TQuaternion::" FUNC_NAME "() const, " FUNC_NAME          \
                           " of quaternion cannot be calculated",                    \
                           ML_BAD_PARAMETER,                                         \
                           "Returning default quaternion");                          \
          }                                                                          \
          else{                                                                      \
            /* Yes, set return code, retVal is left on default. */                   \
            *isError = true;                                                         \
          }                                                                          \
        }                                                                            \
        else{                                                                        \
          /* Define return values. */                                                \
          if (isError != NULL){ *isError = false; }                                  \
          retVal = CALC_EXPR;                                                        \
        }                                                                            \
      }                                                                              \
      ML_CATCH_RETHROW;                                                              \
      return retVal;                                                                 \

Defines a code fragment which checks and handles some stuff for safe expression calculations.

It calculates and checks the length of qv. If it is non 0 then it executes the expression otherwise it handles the error as follows: If the length is 0, i.e. the expression 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.

Parameters:
FUNC_NAMEis (string) name of the function to be implemented.
CALC_EXPRis the expression to be executed to calculate the TQuaternion

return value.

Definition at line 962 of file mlQuaternion.h.

Referenced by ml::TQuaternion< DT >::arccos(), ml::TQuaternion< DT >::arcsin(), and ml::TQuaternion< DT >::arctan().