Public Types | Public Member Functions

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

AxisAngle: Represents a "twist about an axis" AxisAngle is used to specify a rotation in 3-space. More...

#include <AxisAngle.h>

Inheritance diagram for gmtl::AxisAngle< DATA_TYPE >:
Inheritance graph
[legend]
Collaboration diagram for gmtl::AxisAngle< DATA_TYPE >:
Collaboration graph
[legend]

List of all members.

Public Types

enum  Params { Size = 4 }
 

The number of components this VecB has.

More...

Public Member Functions

 AxisAngle ()
 default constructor.
 AxisAngle (const AxisAngle &e)
 copy constructor.
 AxisAngle (const DATA_TYPE &rad_angle, const DATA_TYPE &x, const DATA_TYPE &y, const DATA_TYPE &z)
 data constructor (angle/x,y,z).
 AxisAngle (const DATA_TYPE &rad_angle, const Vec< DATA_TYPE, 3 > &axis)
 data constructor (angle/Vec3).
void set (const DATA_TYPE &rad_angle, const DATA_TYPE &x, const DATA_TYPE &y, const DATA_TYPE &z)
 set raw data.
void set (const DATA_TYPE &rad_angle, const Vec< DATA_TYPE, 3 > &axis)
 set data.
void setAxis (const Vec< DATA_TYPE, 3 > &axis)
 set the axis portion of the AxisAngle
void setAngle (const DATA_TYPE &rad_angle)
 set the angle (twist) part of the AxisAngle, as a radian value.
Vec< DATA_TYPE, 3 > getAxis () const
 get the axis portion of the AxisAngle
const DATA_TYPE & getAngle () const
 get the angle (twist) part of the AxisAngle.

Detailed Description

template<typename DATA_TYPE>
class gmtl::AxisAngle< DATA_TYPE >

AxisAngle: Represents a "twist about an axis" AxisAngle is used to specify a rotation in 3-space.

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

AxisAngle is very similar to Quat, except it is human readable. For efficiency, you should use Quat instead (Quat or Matrix are preferred).

The internal data format is an array of 4 DATA_TYPE values. Angle is first, the axis is the last 3.

Precondition:
angles are in radians, the axis is usually normalized by the user.
See also:
AxisAnglef, AxisAngled
Matrix, Quat, EulerAngle

Definition at line 35 of file AxisAngle.h.


Member Enumeration Documentation

template<typename DATA_TYPE>
enum gmtl::AxisAngle::Params

The number of components this VecB has.

Enumerator:
Size 

Reimplemented from gmtl::VecBase< DATA_TYPE, 4 >.

Definition at line 38 of file AxisAngle.h.

{ Size = 4 };


Constructor & Destructor Documentation

template<typename DATA_TYPE>
gmtl::AxisAngle< DATA_TYPE >::AxisAngle (  )  [inline]

default constructor.

initializes to identity rotation (no rotation).

Definition at line 41 of file AxisAngle.h.

               : 
      VecBase<DATA_TYPE, 4>( (DATA_TYPE)0.0, (DATA_TYPE)1.0, 
                             (DATA_TYPE)0.0, (DATA_TYPE)0.0 )
   {
   }

template<typename DATA_TYPE>
gmtl::AxisAngle< DATA_TYPE >::AxisAngle ( const AxisAngle< DATA_TYPE > &  e  )  [inline]

copy constructor.

Definition at line 48 of file AxisAngle.h.

                                   : VecBase<DATA_TYPE, 4>( e )
   {
   }

template<typename DATA_TYPE>
gmtl::AxisAngle< DATA_TYPE >::AxisAngle ( const DATA_TYPE &  rad_angle,
const DATA_TYPE &  x,
const DATA_TYPE &  y,
const DATA_TYPE &  z 
) [inline]

data constructor (angle/x,y,z).

angles are in radians.

Definition at line 53 of file AxisAngle.h.

                                                       :
            VecBase<DATA_TYPE, 4>( rad_angle, x, y, z )
   {
   }

template<typename DATA_TYPE>
gmtl::AxisAngle< DATA_TYPE >::AxisAngle ( const DATA_TYPE &  rad_angle,
const Vec< DATA_TYPE, 3 > &  axis 
) [inline]

data constructor (angle/Vec3).

angles are in radians.

Definition at line 60 of file AxisAngle.h.

                                                                          :
            VecBase<DATA_TYPE, 4>( rad_angle, axis[0], axis[1], axis[2] )
   {
   }


Member Function Documentation

template<typename DATA_TYPE>
const DATA_TYPE& gmtl::AxisAngle< DATA_TYPE >::getAngle (  )  const [inline]

get the angle (twist) part of the AxisAngle.

Returns:
the twist value in radians

Definition at line 111 of file AxisAngle.h.

template<typename DATA_TYPE>
Vec<DATA_TYPE, 3> gmtl::AxisAngle< DATA_TYPE >::getAxis (  )  const [inline]

get the axis portion of the AxisAngle

Returns:
a vector of the axis, which may or may not be normalized.

Definition at line 101 of file AxisAngle.h.

template<typename DATA_TYPE>
void gmtl::AxisAngle< DATA_TYPE >::set ( const DATA_TYPE &  rad_angle,
const Vec< DATA_TYPE, 3 > &  axis 
) [inline]

set data.

angles are in radians.

Definition at line 73 of file AxisAngle.h.

   {
      VecBase<DATA_TYPE, 4>::set( rad_angle, axis[0], axis[1], axis[2] );
   }

template<typename DATA_TYPE>
void gmtl::AxisAngle< DATA_TYPE >::set ( const DATA_TYPE &  rad_angle,
const DATA_TYPE &  x,
const DATA_TYPE &  y,
const DATA_TYPE &  z 
) [inline]

set raw data.

angles are in radians.

Definition at line 66 of file AxisAngle.h.

   {
      VecBase<DATA_TYPE, 4>::set( rad_angle, x, y, z );
   }

template<typename DATA_TYPE>
void gmtl::AxisAngle< DATA_TYPE >::setAngle ( const DATA_TYPE &  rad_angle  )  [inline]

set the angle (twist) part of the AxisAngle, as a radian value.

Parameters:
rad_angle the desired twist angle, in radians
Postcondition:
the angle of the object is set

Definition at line 93 of file AxisAngle.h.

   {
      VecBase<DATA_TYPE, 4>::operator[]( 0 ) = rad_angle;
   }

template<typename DATA_TYPE>
void gmtl::AxisAngle< DATA_TYPE >::setAxis ( const Vec< DATA_TYPE, 3 > &  axis  )  [inline]

set the axis portion of the AxisAngle

Parameters:
axis the desired 3D vector axis to rotate about
Postcondition:
the axis of the object is set

Definition at line 82 of file AxisAngle.h.


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