Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

gmtl::AxisAngle 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:

Inheritance graph
[legend]
Collaboration diagram for gmtl::AxisAngle:

Collaboration graph
[legend]
List of all members.

Public Types

enum  Params { Size = 4 }

Public Methods

 AxisAngle ()
 default constructor. More...

 AxisAngle (const AxisAngle &e)
 copy constructor. More...

 AxisAngle (const DATA_TYPE &rad_angle, const DATA_TYPE &x, const DATA_TYPE &y, const DATA_TYPE &z)
 data constructor (angle/x,y,z). More...

 AxisAngle (const DATA_TYPE &rad_angle, const Vec< DATA_TYPE, 3 > &axis)
 data constructor (angle/Vec3). More...

void set (const DATA_TYPE &rad_angle, const DATA_TYPE &x, const DATA_TYPE &y, const DATA_TYPE &z)
 set raw data. More...

void set (const DATA_TYPE &rad_angle, const Vec< DATA_TYPE, 3 > &axis)
 set data. More...

void setAxis (const Vec< DATA_TYPE, 3 > &axis)
 set the axis portion of the AxisAngle. More...

void setAngle (const DATA_TYPE &rad_angle)
 set the angle (twist) part of the AxisAngle, as a radian value. More...

Vec< DATA_TYPE, 3 > getAxis () const
 get the axis portion of the AxisAngle. More...

const DATA_TYPE & getAngle () const
 get the angle (twist) part of the AxisAngle. More...


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 64 of file AxisAngle.h.


Member Enumeration Documentation

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

Enumeration values:
Size 

Definition at line 67 of file AxisAngle.h.

00067 { 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 70 of file AxisAngle.h.

References gmtl::VecBase< DATA_TYPE, 4 >::VecBase.

Referenced by AxisAngle.

00070                : 
00071       VecBase<DATA_TYPE, 4>( (DATA_TYPE)0.0, (DATA_TYPE)1.0, 
00072                              (DATA_TYPE)0.0, (DATA_TYPE)0.0 )
00073    {
00074    }

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

copy constructor.

Definition at line 77 of file AxisAngle.h.

References AxisAngle, and gmtl::VecBase< DATA_TYPE, 4 >::VecBase.

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

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 82 of file AxisAngle.h.

References gmtl::VecBase< DATA_TYPE, 4 >::VecBase.

00083                                                        :
00084             VecBase<DATA_TYPE, 4>( rad_angle, x, y, z )
00085    {
00086    }
   

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

References gmtl::VecBase< DATA_TYPE, 4 >::VecBase.

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


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 140 of file AxisAngle.h.

00141    {
00142       return VecBase<DATA_TYPE, 4>::operator[]( 0 );
00143    }

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 130 of file AxisAngle.h.

00131    { 
00132       return Vec<DATA_TYPE, 3>( VecBase<DATA_TYPE, 4>::operator[]( 1 ),
00133                                 VecBase<DATA_TYPE, 4>::operator[]( 2 ),
00134                                 VecBase<DATA_TYPE, 4>::operator[]( 3 ) );
00135    }

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 102 of file AxisAngle.h.

References gmtl::set.

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

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.

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

Definition at line 95 of file AxisAngle.h.

References gmtl::set.

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

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 122 of file AxisAngle.h.

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

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 111 of file AxisAngle.h.

00112    { 
00113       VecBase<DATA_TYPE, 4>::operator[]( 1 ) = axis[0];
00114       VecBase<DATA_TYPE, 4>::operator[]( 2 ) = axis[1];
00115       VecBase<DATA_TYPE, 4>::operator[]( 3 ) = axis[2];
00116    }


The documentation for this class was generated from the following file:
Generated on Mon Apr 7 15:29:27 2003 for GenericMathTemplateLibrary by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002