cisst-saw
Loading...
Searching...
No Matches
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_typeThisType
typedef vctFixedSizeVector< value_type, DIMENSIONAxisType
typedef cmnTypeTraits< _elementType > TypeTraits

Public Member Functions

 VCT_CONTAINER_TRAITS_TYPEDEFS (_elementType)
 vctAxisAngleRotation3 ()
ThisTypeAssign (const ThisType &other)
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) CISST_THROW(std
template<class _vectorOwnerType>
 vctAxisAngleRotation3 (const vctDynamicConstVectorBase< _vectorOwnerType, value_type > &axis, AngleType angle) CISST_THROW(std
template<class _containerType>
 vctAxisAngleRotation3 (const vctQuaternionRotation3Base< _containerType > &quaternionRotation) CISST_THROW(std
template<class _containerType>
 vctAxisAngleRotation3 (const vctMatrixRotation3Base< _containerType > &matrixRotation) CISST_THROW(std
template<class _containerType>
 vctAxisAngleRotation3 (const vctRodriguezRotation3Base< _containerType > &rodriguezRotation) CISST_THROW(std
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) CISST_THROW(std
template<class _vectorOwnerType>
ThisTypeFrom (const vctDynamicConstVectorBase< _vectorOwnerType, value_type > &axis, AngleType angle) CISST_THROW(std
template<class _containerType>
ThisTypeFrom (const vctQuaternionRotation3Base< _containerType > &quaternionRotation) CISST_THROW(std
template<class _containerType>
ThisTypeFrom (const vctMatrixRotation3Base< _containerType > &matrixRotation) CISST_THROW(std
template<class _containerType>
ThisTypeFrom (const vctRodriguezRotation3Base< _containerType > &rodriguezRotation) CISST_THROW(std
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)
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 Equal (const ThisType &other) const
bool operator== (const ThisType &other) 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)

Protected Member Functions

void ThrowUnlessIsNormalized (void) const CISST_THROW(std
template<class _inputType>
void ThrowUnlessIsNormalized (const _inputType &input) const CISST_THROW(std

Protected Attributes

AxisType AxisMember
AngleType AngleMember

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)
const AxisTypeAxis (void) const
AxisTypeAxis (void)
const AngleType & Angle (void) const
AngleType & Angle (void)
static CISST_EXPORT const ThisTypeIdentity ()

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

◆ AxisType

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

◆ ThisType

template<class _elementType>
typedef vctAxisAngleRotation3<value_type> vctAxisAngleRotation3< _elementType >::ThisType

◆ TypeTraits

template<class _elementType>
typedef cmnTypeTraits<_elementType> vctAxisAngleRotation3< _elementType >::TypeTraits

Member Enumeration Documentation

◆ anonymous enum

template<class _elementType>
anonymous enum
Enumerator
DIMENSION 

Constructor & Destructor Documentation

◆ vctAxisAngleRotation3() [1/11]

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

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

◆ vctAxisAngleRotation3() [2/11]

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

Constructor from an axis and an angle.

Parameters
axisA unit vector of size 3.
angleThe angle in radian

◆ vctAxisAngleRotation3() [3/11]

template<class _elementType>
template<class _vectorOwnerType>
vctAxisAngleRotation3< _elementType >::vctAxisAngleRotation3 ( const vctDynamicConstVectorBase< _vectorOwnerType, value_type > & axis,
AngleType angle )
inline

Constructor from an axis and an angle.

Parameters
axisA unit vector of size 3.
angleThe angle in radian

◆ vctAxisAngleRotation3() [4/11]

template<class _elementType>
template<class _containerType>
vctAxisAngleRotation3< _elementType >::vctAxisAngleRotation3 ( const vctQuaternionRotation3Base< _containerType > & quaternionRotation)
inlineexplicit

Constructor from a vctQuaternionRotation3.

◆ vctAxisAngleRotation3() [5/11]

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

Constructor from a vctMatrixRotation3.

◆ vctAxisAngleRotation3() [6/11]

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

Constructor from a vctRodriguezRotation3.

◆ vctAxisAngleRotation3() [7/11]

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)

◆ vctAxisAngleRotation3() [8/11]

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)

◆ vctAxisAngleRotation3() [9/11]

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

Constructor from a vctQuaternionRotation3.

◆ vctAxisAngleRotation3() [10/11]

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

Constructor from a vctMatrixRotation3.

◆ vctAxisAngleRotation3() [11/11]

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

Constructor from a vctRodriguezRotation3.

Member Function Documentation

◆ AlmostEqual()

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

◆ 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

◆ Angle() [1/2]

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

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

◆ Angle() [2/2]

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

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

◆ Assign()

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

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

◆ Axis() [1/2]

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

Reference to the rotation axis data member.

◆ Axis() [2/2]

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

Const reference to the rotation axis data member.

◆ DeSerializeRaw()

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

Binary deserialization

◆ Equal()

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

◆ From() [1/5]

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

Conversion from an angle and an axis.

◆ From() [2/5]

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

Conversion from an angle and an axis.

◆ From() [3/5]

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

Conversion from a vctMatrixRotation3.

◆ From() [4/5]

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

Conversion from a vctQuaternionRotation3.

◆ From() [5/5]

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

Conversion from a vctRodriguezRotation3.

◆ FromNormalized() [1/4]

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.

◆ FromNormalized() [2/4]

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

Conversion from a vctMatrixRotation3.

◆ FromNormalized() [3/4]

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

Conversion from an axis and an angle.

◆ FromNormalized() [4/4]

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

Conversion from a vctRodriguezRotation3.

◆ FromRaw() [1/4]

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.

◆ FromRaw() [2/4]

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

Conversion from a vctMatrixRotation3.

◆ FromRaw() [3/4]

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

Conversion from a vctQuaternionRotation3.

◆ FromRaw() [4/4]

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

Conversion from a vctRodriguezRotation3.

◆ Identity()

template<class _elementType>
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.

◆ Inverse()

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().

◆ InverseOf()

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

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

◆ 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.

◆ IsNormalized()

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.

◆ Normalized()

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().

◆ NormalizedOf()

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.

◆ NormalizedSelf()

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.

◆ operator==()

template<class _elementType>
bool vctAxisAngleRotation3< _elementType >::operator== ( const ThisType & other) const
inline

◆ SerializeRaw()

template<class _elementType>
void vctAxisAngleRotation3< _elementType >::SerializeRaw ( std::ostream & outputStream) const
inline

Binary serialization

◆ ThrowUnlessIsNormalized() [1/2]

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

Throw an exception unless the input is normalized.

Parameters
inputAn object with IsNormalized method.

◆ ThrowUnlessIsNormalized() [2/2]

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

Throw an exception unless this rotation is normalized.

◆ ToStream()

template<class _elementType>
void vctAxisAngleRotation3< _elementType >::ToStream ( std::ostream & outputStream) const
inline

Print the matrix in a human readable format

◆ ToStreamRaw()

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

◆ ToString()

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

◆ VCT_CONTAINER_TRAITS_TYPEDEFS()

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

Member Data Documentation

◆ AngleMember

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

◆ AxisMember

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

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