cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
vctAxisAngleRotation3< _elementType > Class Template Reference

Define a rotation based on an axis and an angle for a space of dimension 3. More...

#include <vctAxisAngleRotation3.h>

Public Types

enum  { DIMENSION = 3 }
 
typedef vctAxisAngleRotation3
< value_type > 
ThisType
 
typedef vctFixedSizeVector
< value_type, DIMENSION
AxisType
 
typedef cmnTypeTraits
< _elementType > 
TypeTraits
 

Public Member Functions

 VCT_CONTAINER_TRAITS_TYPEDEFS (_elementType)
 
 vctAxisAngleRotation3 ()
 
ThisTypeAssign (const ThisType &other)
 
const AxisTypeAxis (void) const
 
AxisTypeAxis (void)
 
const AngleType & Angle (void) const
 
AngleType & Angle (void)
 
ThisTypeInverseSelf (void)
 
ThisTypeInverseOf (const ThisType &otherRotation)
 
ThisType Inverse (void) const
 
ThisTypeNormalizedSelf (void)
 
ThisTypeNormalizedOf (const ThisType &otherRotation)
 
ThisType Normalized (void) const
 
bool IsNormalized (value_type tolerance=TypeTraits::Tolerance()) const
 
bool AlmostEqual (const ThisType &other, value_type tolerance=TypeTraits::Tolerance()) const
 
bool AlmostEquivalent (const ThisType &other, value_type tolerance=TypeTraits::Tolerance()) const
 
std::string ToString (void) const
 
void ToStream (std::ostream &outputStream) const
 
void ToStreamRaw (std::ostream &outputStream, const char delimiter= ' ', bool headerOnly=false, const std::string &headerPrefix="") const
 
void SerializeRaw (std::ostream &outputStream) const
 
void DeSerializeRaw (std::istream &inputStream)
 
Constructors with normalization test.

These constructors will check that the input is valid, i.e. normalized. If the input is not normalized, an exception (of type std::runtime_error) will be thrown. Each constructor uses the corresponding From() method based on the input type.

Note
See the cmnThrow() function if an abort is better than an exception for your application.
template<stride_type __stride, class __dataPtrType >
 vctAxisAngleRotation3 (const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &axis, const AngleType angle) throw (std::runtime_error)
 
template<class _vectorOwnerType >
 vctAxisAngleRotation3 (const vctDynamicConstVectorBase< _vectorOwnerType, value_type > &axis, AngleType angle) throw (std::runtime_error)
 
template<class _containerType >
 vctAxisAngleRotation3 (const vctQuaternionRotation3Base< _containerType > &quaternionRotation) throw (std::runtime_error)
 
template<class _containerType >
 vctAxisAngleRotation3 (const vctMatrixRotation3Base< _containerType > &matrixRotation) throw (std::runtime_error)
 
template<class _containerType >
 vctAxisAngleRotation3 (const vctRodriguezRotation3Base< _containerType > &rodriguezRotation) throw (std::runtime_error)
 
Constructors without normalization test

These constructors will either assume that the input is normalized or normalize the input (a copy of it, if required) based on the last parameter provided:

  • If the normalization flag is set to VCT_DO_NOT_NORMALIZE, the input is considered already normalized and the constructor will not perform any sanity check. This can lead to numerical instabilities which have to be handled by the caller.

  • If the normalization flag is set to VCT_NORMALIZE, the input will be normalized. This option should be used whenever it is important to obtain a result as "normalized" as possible.

template<stride_type __stride, class __dataPtrType >
 vctAxisAngleRotation3 (const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &axis, const AngleType angle, bool normalizeInput)
 
template<class _vectorOwnerType >
 vctAxisAngleRotation3 (const vctDynamicConstVectorBase< _vectorOwnerType, value_type > &axis, AngleType angle, bool normalizeInput)
 
template<class _containerType >
 vctAxisAngleRotation3 (const vctQuaternionRotation3Base< _containerType > &quaternionRotation, bool normalizeInput)
 
template<class _containerType >
 vctAxisAngleRotation3 (const vctMatrixRotation3Base< _containerType > &matrixRotation, bool normalizeInput)
 
template<class _containerType >
 vctAxisAngleRotation3 (const vctRodriguezRotation3Base< _containerType > &rodriguezRotation, bool normalizeInput)
 
Conversion from normalized input.

These methods will check that the input is normalized. If the input is not normalized, an exception (std::runtime_error) will be thrown using cmnThrow().

Note
Since all exceptions are thrown using cmnThrow(), it is possible to configure these methods to use abort() if the normalization requirements are not met (see cmnThrow()).
template<stride_type __stride, class __dataPtrType >
ThisTypeFrom (const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &axis, const AngleType angle) throw (std::runtime_error)
 
template<class _vectorOwnerType >
ThisTypeFrom (const vctDynamicConstVectorBase< _vectorOwnerType, value_type > &axis, AngleType angle) throw (std::runtime_error)
 
template<class _containerType >
ThisTypeFrom (const vctQuaternionRotation3Base< _containerType > &quaternionRotation) throw (std::runtime_error)
 
template<class _containerType >
ThisTypeFrom (const vctMatrixRotation3Base< _containerType > &matrixRotation) throw (std::runtime_error)
 
template<class _containerType >
ThisTypeFrom (const vctRodriguezRotation3Base< _containerType > &rodriguezRotation) throw (std::runtime_error)
 
Conversion and normalization.

These method will accept any input and attempt to either normalize the input and then convert or convert and then normalize the quaternion itself.
The order depends on the type of input.

template<stride_type __stride, class __dataPtrType >
ThisTypeFromNormalized (const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &axis, const AngleType angle)
 
template<class _containerType >
ThisTypeFromNormalized (const vctQuaternionRotation3Base< _containerType > &quaternionRotation)
 
template<class _containerType >
ThisTypeFromNormalized (const vctMatrixRotation3Base< _containerType > &matrixRotation)
 
template<class _containerType >
ThisTypeFromNormalized (const vctRodriguezRotation3Base< _containerType > &rodriguezRotation)
 
Conversion.

These method don't check if the input is normalized nor try to normalize the results. They should be used with caution since the resulting rotation (in this case a quaternion) might not be normalized.

template<stride_type __stride, class __dataPtrType >
ThisTypeFromRaw (const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &axis, const AngleType angle)
 
template<class _containerType >
ThisTypeFromRaw (const vctQuaternionRotation3Base< _containerType > &quaternionRotation)
 
template<class _containerType >
ThisTypeFromRaw (const vctMatrixRotation3Base< _containerType > &matrixRotation)
 
template<class _containerType >
ThisTypeFromRaw (const vctRodriguezRotation3Base< _containerType > &rodriguezRotation)
 
bool Equal (const ThisType &other) const
 
bool operator== (const ThisType &other) const
 

Static Public Member Functions

static CISST_EXPORT const
ThisType
Identity ()
 

Protected Member Functions

void ThrowUnlessIsNormalized (void) const throw (std::runtime_error)
 
template<class _inputType >
void ThrowUnlessIsNormalized (const _inputType &input) const throw (std::runtime_error)
 

Protected Attributes

AxisType AxisMember
 
AngleType AngleMember
 

Detailed Description

template<class _elementType>
class vctAxisAngleRotation3< _elementType >

Define a rotation based on an axis and an angle for a space of dimension 3.

This class is templated by the element type. It contains a fixed size vector and an angle.

Parameters
_elementTypeThe type of elements.
See Also
vctQuaternion

Member Typedef Documentation

template<class _elementType>
typedef vctFixedSizeVector<value_type, DIMENSION> vctAxisAngleRotation3< _elementType >::AxisType
template<class _elementType>
typedef vctAxisAngleRotation3<value_type> vctAxisAngleRotation3< _elementType >::ThisType
template<class _elementType>
typedef cmnTypeTraits<_elementType> vctAxisAngleRotation3< _elementType >::TypeTraits

Member Enumeration Documentation

template<class _elementType>
anonymous enum
Enumerator
DIMENSION 

Constructor & Destructor Documentation

template<class _elementType>
vctAxisAngleRotation3< _elementType >::vctAxisAngleRotation3 ( )
inline

Default constructor. Sets the axis to (1, 0, 0) and the angle to zero.

template<class _elementType>
template<stride_type __stride, class __dataPtrType >
vctAxisAngleRotation3< _elementType >::vctAxisAngleRotation3 ( const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &  axis,
const AngleType  angle 
)
throw (std::runtime_error
)
inline

Constructor from an axis and an angle.

Parameters
axisA unit vector of size 3.
angleThe angle in radian
template<class _elementType>
template<class _vectorOwnerType >
vctAxisAngleRotation3< _elementType >::vctAxisAngleRotation3 ( const vctDynamicConstVectorBase< _vectorOwnerType, value_type > &  axis,
AngleType  angle 
)
throw (std::runtime_error
)
inline

Constructor from an axis and an angle.

Parameters
axisA unit vector of size 3.
angleThe angle in radian
template<class _elementType>
template<class _containerType >
vctAxisAngleRotation3< _elementType >::vctAxisAngleRotation3 ( const vctQuaternionRotation3Base< _containerType > &  quaternionRotation)
throw (std::runtime_error
)
inlineexplicit

Constructor from a vctQuaternionRotation3.

template<class _elementType>
template<class _containerType >
vctAxisAngleRotation3< _elementType >::vctAxisAngleRotation3 ( const vctMatrixRotation3Base< _containerType > &  matrixRotation)
throw (std::runtime_error
)
inlineexplicit

Constructor from a vctMatrixRotation3.

template<class _elementType>
template<class _containerType >
vctAxisAngleRotation3< _elementType >::vctAxisAngleRotation3 ( const vctRodriguezRotation3Base< _containerType > &  rodriguezRotation)
throw (std::runtime_error
)
inlineexplicit

Constructor from a vctRodriguezRotation3.

template<class _elementType>
template<stride_type __stride, class __dataPtrType >
vctAxisAngleRotation3< _elementType >::vctAxisAngleRotation3 ( const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &  axis,
const AngleType  angle,
bool  normalizeInput 
)
inline

Constructor from an axis and an angle.

Parameters
axisA vector of size 3.
angleThe angle in radian
normalizeInputNormalize the input or convert as is (VCT_NORMALIZE or VCT_DO_NOT_NORMALIZE)
template<class _elementType>
template<class _vectorOwnerType >
vctAxisAngleRotation3< _elementType >::vctAxisAngleRotation3 ( const vctDynamicConstVectorBase< _vectorOwnerType, value_type > &  axis,
AngleType  angle,
bool  normalizeInput 
)
inline

Constructor from an axis and an angle.

Parameters
axisA vector of size 3.
angleThe angle in radian
normalizeInputNormalize the input or convert as is (VCT_NORMALIZE or VCT_DO_NOT_NORMALIZE)
template<class _elementType>
template<class _containerType >
vctAxisAngleRotation3< _elementType >::vctAxisAngleRotation3 ( const vctQuaternionRotation3Base< _containerType > &  quaternionRotation,
bool  normalizeInput 
)
inline

Constructor from a vctQuaternionRotation3.

template<class _elementType>
template<class _containerType >
vctAxisAngleRotation3< _elementType >::vctAxisAngleRotation3 ( const vctMatrixRotation3Base< _containerType > &  matrixRotation,
bool  normalizeInput 
)
inline

Constructor from a vctMatrixRotation3.

template<class _elementType>
template<class _containerType >
vctAxisAngleRotation3< _elementType >::vctAxisAngleRotation3 ( const vctRodriguezRotation3Base< _containerType > &  rodriguezRotation,
bool  normalizeInput 
)
inline

Constructor from a vctRodriguezRotation3.

Member Function Documentation

template<class _elementType>
bool vctAxisAngleRotation3< _elementType >::AlmostEqual ( const ThisType other,
value_type  tolerance = TypeTraits::Tolerance() 
) const
inline

Return true if this rotation is effectively equal to the other rotation, up to the given tolerance. Rotations may be effectively equal if one is elementwise equal to the other.

The tolerance factor is used to compare each of the elements of the difference vector.

See Also
AlmostEquivalent
template<class _elementType>
bool vctAxisAngleRotation3< _elementType >::AlmostEquivalent ( const ThisType other,
value_type  tolerance = TypeTraits::Tolerance() 
) const
inline

Return true if this rotation is effectively equavilent to the other rotation, up to the given tolerance. Rotation may be effectively equivalent if their axis are aligned and their angles are equal, modulus 2 PI (take into account the direction of the axis).

The tolerance factor is used to compare each of the elements of the difference vector.

See Also
AlmostEqual
template<class _elementType>
const AngleType& vctAxisAngleRotation3< _elementType >::Angle ( void  ) const
inline

Const reference to the rotation angle data member (in radians).

template<class _elementType>
AngleType& vctAxisAngleRotation3< _elementType >::Angle ( void  )
inline

Reference to the rotation angle data member (in radians).

template<class _elementType>
ThisType& vctAxisAngleRotation3< _elementType >::Assign ( const ThisType other)
inline

Assignement method. This method doesn't perform any test on the input.

template<class _elementType>
const AxisType& vctAxisAngleRotation3< _elementType >::Axis ( void  ) const
inline

Const reference to the rotation axis data member.

template<class _elementType>
AxisType& vctAxisAngleRotation3< _elementType >::Axis ( void  )
inline

Reference to the rotation axis data member.

template<class _elementType>
void vctAxisAngleRotation3< _elementType >::DeSerializeRaw ( std::istream &  inputStream)
inline

Binary deserialization

template<class _elementType>
bool vctAxisAngleRotation3< _elementType >::Equal ( const ThisType other) const
inline

Return true if this rotation is exactly equal to the other rotation, without any tolerance error. Rotations may be effectively equal if one is elementwise equal to the other.

See Also
AlmostEqual
template<class _elementType>
template<stride_type __stride, class __dataPtrType >
ThisType& vctAxisAngleRotation3< _elementType >::From ( const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &  axis,
const AngleType  angle 
)
throw (std::runtime_error
)
inline

Conversion from an angle and an axis.

template<class _elementType>
template<class _vectorOwnerType >
ThisType& vctAxisAngleRotation3< _elementType >::From ( const vctDynamicConstVectorBase< _vectorOwnerType, value_type > &  axis,
AngleType  angle 
)
throw (std::runtime_error
)
inline

Conversion from an angle and an axis.

template<class _elementType>
template<class _containerType >
ThisType& vctAxisAngleRotation3< _elementType >::From ( const vctQuaternionRotation3Base< _containerType > &  quaternionRotation)
throw (std::runtime_error
)
inline

Conversion from a vctQuaternionRotation3.

template<class _elementType>
template<class _containerType >
ThisType& vctAxisAngleRotation3< _elementType >::From ( const vctMatrixRotation3Base< _containerType > &  matrixRotation)
throw (std::runtime_error
)
inline

Conversion from a vctMatrixRotation3.

template<class _elementType>
template<class _containerType >
ThisType& vctAxisAngleRotation3< _elementType >::From ( const vctRodriguezRotation3Base< _containerType > &  rodriguezRotation)
throw (std::runtime_error
)
inline

Conversion from a vctRodriguezRotation3.

template<class _elementType>
template<stride_type __stride, class __dataPtrType >
ThisType& vctAxisAngleRotation3< _elementType >::FromNormalized ( const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &  axis,
const AngleType  angle 
)
inline

Conversion from an axis and an angle.

template<class _elementType>
template<class _containerType >
ThisType& vctAxisAngleRotation3< _elementType >::FromNormalized ( const vctQuaternionRotation3Base< _containerType > &  quaternionRotation)
inline

Conversion from an axis and an angle.

template<class _elementType>
template<class _containerType >
ThisType& vctAxisAngleRotation3< _elementType >::FromNormalized ( const vctMatrixRotation3Base< _containerType > &  matrixRotation)
inline

Conversion from a vctMatrixRotation3.

template<class _elementType>
template<class _containerType >
ThisType& vctAxisAngleRotation3< _elementType >::FromNormalized ( const vctRodriguezRotation3Base< _containerType > &  rodriguezRotation)
inline

Conversion from a vctRodriguezRotation3.

template<class _elementType>
template<stride_type __stride, class __dataPtrType >
ThisType& vctAxisAngleRotation3< _elementType >::FromRaw ( const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &  axis,
const AngleType  angle 
)
inline

Conversion from an axis and an angle.

template<class _elementType>
template<class _containerType >
ThisType& vctAxisAngleRotation3< _elementType >::FromRaw ( const vctQuaternionRotation3Base< _containerType > &  quaternionRotation)
inline

Conversion from a vctQuaternionRotation3.

template<class _elementType>
template<class _containerType >
ThisType& vctAxisAngleRotation3< _elementType >::FromRaw ( const vctMatrixRotation3Base< _containerType > &  matrixRotation)
inline

Conversion from a vctMatrixRotation3.

template<class _elementType>
template<class _containerType >
ThisType& vctAxisAngleRotation3< _elementType >::FromRaw ( const vctRodriguezRotation3Base< _containerType > &  rodriguezRotation)
inline

Conversion from a vctRodriguezRotation3.

template<class _elementType>
static CISST_EXPORT const ThisType& vctAxisAngleRotation3< _elementType >::Identity ( )
static

Const reference to the identity. In this case, the axis is set to (1, 0, 0) and the angle is set to zero.

template<class _elementType>
ThisType vctAxisAngleRotation3< _elementType >::Inverse ( void  ) const
inline

Create and return by copy the inverse of this rotation. This method is not the most efficient since it requires a copy. See also InverseSelf().

template<class _elementType>
ThisType& vctAxisAngleRotation3< _elementType >::InverseOf ( const ThisType otherRotation)
inline

Set this rotation as the inverse of another one. See also InverseSelf().

template<class _elementType>
ThisType& vctAxisAngleRotation3< _elementType >::InverseSelf ( void  )
inline

Inverse this axis angle rotation. This methods assumes that the axis is normalized and the angle is betweem 0 and 2 * PI. The axis is not changed but the angle is set to 2 * PI minus the previous value.

template<class _elementType>
bool vctAxisAngleRotation3< _elementType >::IsNormalized ( value_type  tolerance = TypeTraits::Tolerance()) const
inline

Test if this rotation is normalized. This methods checks that the axis is normalized (with tolerance). Any angle is considered valid.

Parameters
toleranceTolerance for the norm test.
template<class _elementType>
ThisType vctAxisAngleRotation3< _elementType >::Normalized ( void  ) const
inline

Returns the normalized version of this rotation. This method returns a copy of the normalized rotation and does not modify this rotation. See also NormalizedSelf().

template<class _elementType>
ThisType& vctAxisAngleRotation3< _elementType >::NormalizedOf ( const ThisType otherRotation)
inline

Sets this rotation as the normalized version of another one.

Parameters
otherRotationAxis angle rotation used to compute the normalized rotation.
template<class _elementType>
ThisType& vctAxisAngleRotation3< _elementType >::NormalizedSelf ( void  )
inline

Normalizes this rotation. This method first normalizes the axis and then modifies the angle so that it's value is between 0 and 2 * PI.

template<class _elementType>
bool vctAxisAngleRotation3< _elementType >::operator== ( const ThisType other) const
inline
template<class _elementType>
void vctAxisAngleRotation3< _elementType >::SerializeRaw ( std::ostream &  outputStream) const
inline

Binary serialization

template<class _elementType>
void vctAxisAngleRotation3< _elementType >::ThrowUnlessIsNormalized ( void  ) const
throw (std::runtime_error
)
inlineprotected

Throw an exception unless this rotation is normalized.

template<class _elementType>
template<class _inputType >
void vctAxisAngleRotation3< _elementType >::ThrowUnlessIsNormalized ( const _inputType &  input) const
throw (std::runtime_error
)
inlineprotected

Throw an exception unless the input is normalized.

Parameters
inputAn object with IsNormalized method.
template<class _elementType>
void vctAxisAngleRotation3< _elementType >::ToStream ( std::ostream &  outputStream) const
inline

Print the matrix in a human readable format

template<class _elementType>
void vctAxisAngleRotation3< _elementType >::ToStreamRaw ( std::ostream &  outputStream,
const char  delimiter = ' ',
bool  headerOnly = false,
const std::string &  headerPrefix = "" 
) const
inline

Print in machine processable format

template<class _elementType>
std::string vctAxisAngleRotation3< _elementType >::ToString ( void  ) const
inline
template<class _elementType>
vctAxisAngleRotation3< _elementType >::VCT_CONTAINER_TRAITS_TYPEDEFS ( _elementType  )

Member Data Documentation

template<class _elementType>
AngleType vctAxisAngleRotation3< _elementType >::AngleMember
protected
template<class _elementType>
AxisType vctAxisAngleRotation3< _elementType >::AxisMember
protected

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