Public Types | Public Member Functions

gmtl::EulerAngle< DATA_TYPE, ROTATION_ORDER > Class Template Reference
[Abstract Data Types: Matrix, Vec, Quat, Coord, Sphere, Plane]

EulerAngle: Represents a group of euler angles. More...

#include <EulerAngle.h>

Collaboration diagram for gmtl::EulerAngle< DATA_TYPE, ROTATION_ORDER >:
Collaboration graph
[legend]

List of all members.

Public Types

enum  Params { Size = 3, Order = ROTATION_ORDER::ID }
typedef DATA_TYPE DataType
 Use this to declare single value types of the same type as this object.

Public Member Functions

 EulerAngle ()
 default constructor.
 EulerAngle (const EulerAngle &e)
 copy constructor.
 EulerAngle (DATA_TYPE p0, DATA_TYPE p1, DATA_TYPE p2)
 data constructor.
void set (const DATA_TYPE &p0, const DATA_TYPE &p1, const DATA_TYPE &p2)
 set data.

DATA_TYPE & operator[] (const unsigned i)
 Gets the ith component in this EulerAngle.
const DATA_TYPE & operator[] (const unsigned i) const

DATA_TYPE * getData ()
 Gets the internal array of the components.
const DATA_TYPE * getData () const
 Gets the internal array of the components (const version).

Detailed Description

template<typename DATA_TYPE, typename ROTATION_ORDER>
class gmtl::EulerAngle< DATA_TYPE, ROTATION_ORDER >

EulerAngle: Represents a group of euler angles.

Euler angle can be used to represent rotations in 3-space.

To some people this rotation format can be more intuitive to specify than Matrix, Quat, or AxisAngle formatted rotation.

For efficiency and to minimize problems from gimbal-lock, you should use one of the other rotation formats instead (Quat or Matrix are preferred).

The internal data format is an array of 3 DATA_TYPE angle values, plus a RotationOrder that specifies how to build a rotation transform from the 3 angle value.

IMPORTANT: The 3 angles are in the order set getOrder(), not XYZ. The values do not swap when order is changed after setting the angles.

Precondition:
all angles are in radians.
See also:
EulerAnglef, EulerAngled
Matrix, Quat, AxisAngle

Definition at line 38 of file EulerAngle.h.


Member Typedef Documentation

template<typename DATA_TYPE, typename ROTATION_ORDER>
typedef DATA_TYPE gmtl::EulerAngle< DATA_TYPE, ROTATION_ORDER >::DataType

Use this to declare single value types of the same type as this object.

Definition at line 42 of file EulerAngle.h.


Member Enumeration Documentation

template<typename DATA_TYPE, typename ROTATION_ORDER>
enum gmtl::EulerAngle::Params
Enumerator:
Size 
Order 

Definition at line 44 of file EulerAngle.h.

{ Size = 3, Order = ROTATION_ORDER::ID };


Constructor & Destructor Documentation

template<typename DATA_TYPE, typename ROTATION_ORDER>
gmtl::EulerAngle< DATA_TYPE, ROTATION_ORDER >::EulerAngle (  )  [inline]

default constructor.

initializes to identity rotation (no rotation).

Definition at line 47 of file EulerAngle.h.

   {
      gmtlASSERT( ROTATION_ORDER::IS_ROTORDER == 1 && 
            "you must specify a RotationOrder derived type for the rotationorder in euler angle." );
      mData[0] = DATA_TYPE( 0 );
      mData[1] = DATA_TYPE( 0 );
      mData[2] = DATA_TYPE( 0 );
   }

template<typename DATA_TYPE, typename ROTATION_ORDER>
gmtl::EulerAngle< DATA_TYPE, ROTATION_ORDER >::EulerAngle ( const EulerAngle< DATA_TYPE, ROTATION_ORDER > &  e  )  [inline]

copy constructor.

Definition at line 57 of file EulerAngle.h.

   {
      mData[0] = e.mData[0];
      mData[1] = e.mData[1];
      mData[2] = e.mData[2];
   }

template<typename DATA_TYPE, typename ROTATION_ORDER>
gmtl::EulerAngle< DATA_TYPE, ROTATION_ORDER >::EulerAngle ( DATA_TYPE  p0,
DATA_TYPE  p1,
DATA_TYPE  p2 
) [inline]

data constructor.

angles are in radians.

Definition at line 65 of file EulerAngle.h.

   {
      mData[0] = p0;
      mData[1] = p1;
      mData[2] = p2;
   }


Member Function Documentation

template<typename DATA_TYPE, typename ROTATION_ORDER>
DATA_TYPE* gmtl::EulerAngle< DATA_TYPE, ROTATION_ORDER >::getData (  )  [inline]

Gets the internal array of the components.

Returns:
a pointer to the component array with length SIZE

Definition at line 103 of file EulerAngle.h.

{ return mData; }

template<typename DATA_TYPE, typename ROTATION_ORDER>
const DATA_TYPE* gmtl::EulerAngle< DATA_TYPE, ROTATION_ORDER >::getData (  )  const [inline]

Gets the internal array of the components (const version).

Returns:
a pointer to the component array with length SIZE

Definition at line 108 of file EulerAngle.h.

{ return mData; }

template<typename DATA_TYPE, typename ROTATION_ORDER>
DATA_TYPE& gmtl::EulerAngle< DATA_TYPE, ROTATION_ORDER >::operator[] ( const unsigned  i  )  [inline]

Gets the ith component in this EulerAngle.

Parameters:
i the zero-based index of the component to access.
Precondition:
0 <= i < 3
Returns:
a reference to the ith component

Definition at line 87 of file EulerAngle.h.

   {
      gmtlASSERT( i < Size );
      return mData[i];
   }

template<typename DATA_TYPE, typename ROTATION_ORDER>
const DATA_TYPE& gmtl::EulerAngle< DATA_TYPE, ROTATION_ORDER >::operator[] ( const unsigned  i  )  const [inline]

Definition at line 92 of file EulerAngle.h.

   {
      gmtlASSERT( i < Size );
      return mData[i];
   }

template<typename DATA_TYPE, typename ROTATION_ORDER>
void gmtl::EulerAngle< DATA_TYPE, ROTATION_ORDER >::set ( const DATA_TYPE &  p0,
const DATA_TYPE &  p1,
const DATA_TYPE &  p2 
) [inline]

set data.

angles are in radians.

Definition at line 73 of file EulerAngle.h.

   {
      mData[0] = p0;
      mData[1] = p1;
      mData[2] = p2;
   }


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