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

Define a rotation based on an angle for a space of dimension 2. More...

#include <vctAngleRotation2.h>

Public Types

enum  { DIMENSION = 2 }
 
typedef vctAngleRotation2 ThisType
 
typedef cmnTypeTraits< AngleType > TypeTraits
 

Public Member Functions

 VCT_CONTAINER_TRAITS_TYPEDEFS (double)
 
 vctAngleRotation2 ()
 
ThisTypeInverseSelf (void)
 
ThisTypeInverseOf (const ThisType &otherRotation)
 
ThisType Inverse (void) const
 
ThisTypeNormalizedSelf (void)
 
ThisTypeNormalizedOf (const ThisType &otherRotation)
 
ThisType Normalized (void) const
 
bool IsNormalized (AngleType CMN_UNUSED(tolerance)=TypeTraits::Tolerance()) const
 
std::string ToString (void) const
 
void ToStream (std::ostream &outputStream) const
 
void ToStreamRaw (std::ostream &outputStream, const char CMN_UNUSED(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.
 vctAngleRotation2 (const AngleType angle) throw (std::runtime_error)
 
template<class _containerType >
 vctAngleRotation2 (const vctMatrixRotation2Base< _containerType > &matrixRotation) throw (std::runtime_error)
 
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()).
ThisTypeFrom (const AngleType angle) throw (std::runtime_error)
 
template<class _containerType >
ThisTypeFrom (const vctMatrixRotation2Base< _containerType > &matrixRotation) 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.

ThisTypeFromNormalized (const AngleType angle)
 
template<class _containerType >
ThisTypeFromNormalized (const vctMatrixRotation2Base< _containerType > &matrixRotation)
 
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.

ThisTypeFromRaw (const AngleType angle)
 
template<class _containerType >
ThisTypeFromRaw (const vctMatrixRotation2Base< _containerType > &matrixRotation)
 

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

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.

 vctAngleRotation2 (const AngleType angle, bool normalizeInput)
 
template<class _containerType >
 vctAngleRotation2 (const vctMatrixRotation2Base< _containerType > &matrixRotation, bool normalizeInput)
 
const AngleType & Angle (void) const
 
AngleType & Angle (void)
 
static CISST_EXPORT const
ThisType
Identity ()
 

Detailed Description

Define a rotation based on an angle for a space of dimension 2.

This class is not templated by the element type. It contains an angle of type AngleType.

See Also
vctMatrixRotation2Base vctMatrixRotation2

Member Typedef Documentation

Member Enumeration Documentation

anonymous enum
Enumerator
DIMENSION 

Constructor & Destructor Documentation

vctAngleRotation2::vctAngleRotation2 ( )
inline

Default constructor. Sets the angle to zero.

vctAngleRotation2::vctAngleRotation2 ( const AngleType  angle)
throw (std::runtime_error
)
inlineexplicit

Constructor from an angle (in radians).

template<class _containerType >
vctAngleRotation2::vctAngleRotation2 ( const vctMatrixRotation2Base< _containerType > &  matrixRotation)
throw (std::runtime_error
)
inline

Constructor from a rotation matrix.

vctAngleRotation2::vctAngleRotation2 ( const AngleType  angle,
bool  normalizeInput 
)
inline

Constructor from an angle (in radians).

template<class _containerType >
vctAngleRotation2::vctAngleRotation2 ( const vctMatrixRotation2Base< _containerType > &  matrixRotation,
bool  normalizeInput 
)
inline

Constructor from a rotation matrix.

Member Function Documentation

const AngleType& vctAngleRotation2::Angle ( void  ) const
inline
AngleType& vctAngleRotation2::Angle ( void  )
inline
void vctAngleRotation2::DeSerializeRaw ( std::istream &  inputStream)
inline

Binary deserialization

ThisType& vctAngleRotation2::From ( const AngleType  angle)
throw (std::runtime_error
)
inline

Conversion from an angle (in radians).

template<class _containerType >
ThisType& vctAngleRotation2::From ( const vctMatrixRotation2Base< _containerType > &  matrixRotation)
throw (std::runtime_error
)
inline

Conversion from a rotation matrix.

ThisType& vctAngleRotation2::FromNormalized ( const AngleType  angle)
inline

Conversion from an angle (in radians).

template<class _containerType >
ThisType& vctAngleRotation2::FromNormalized ( const vctMatrixRotation2Base< _containerType > &  matrixRotation)
inline

Conversion from a rotation matrix.

ThisType& vctAngleRotation2::FromRaw ( const AngleType  angle)
inline

Conversion from an angle (in radians).

template<class _containerType >
ThisType& vctAngleRotation2::FromRaw ( const vctMatrixRotation2Base< _containerType > &  matrixRotation)
inline

Conversion from a rotation matrix.

static CISST_EXPORT const ThisType& vctAngleRotation2::Identity ( )
static

Const reference to the identity. In this case, the angle is set to zero.

ThisType vctAngleRotation2::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().

ThisType& vctAngleRotation2::InverseOf ( const ThisType otherRotation)
inline

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

ThisType& vctAngleRotation2::InverseSelf ( void  )
inline

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

bool vctAngleRotation2::IsNormalized ( AngleType   CMN_UNUSEDtolerance = TypeTraits::Tolerance()) const
inline

Test if this rotation is normalized. This methods always return "true" since any angle is considered valid. This method is provided mostly for API completion.

Parameters
toleranceTolerance. This variable is not used as this rotation is always normalized. The tolerance parameter is provided just to have the same signature as for other transformations.
ThisType vctAngleRotation2::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().

ThisType& vctAngleRotation2::NormalizedOf ( const ThisType otherRotation)
inline

Sets this rotation as the normalized version of another one.

Parameters
otherRotationAngle rotation used to compute the normalized rotation.
ThisType& vctAngleRotation2::NormalizedSelf ( void  )
inline

Normalizes the angle. This method ensures that the angle is between 0 and 2 * PI.

void vctAngleRotation2::SerializeRaw ( std::ostream &  outputStream) const
inline

Binary serialization

void vctAngleRotation2::ThrowUnlessIsNormalized ( void  ) const
throw (std::runtime_error
)
inlineprotected

Throw an exception unless this rotation is normalized.

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

Throw an exception unless the input is normalized.

Parameters
inputAn object with IsNormalized method.
void vctAngleRotation2::ToStream ( std::ostream &  outputStream) const
inline

Print the matrix in a human readable format

void vctAngleRotation2::ToStreamRaw ( std::ostream &  outputStream,
const char   CMN_UNUSEDdelimiter = ' ',
bool  headerOnly = false,
const std::string &  headerPrefix = "" 
) const
inline

Print in machine processable format

std::string vctAngleRotation2::ToString ( void  ) const
inline
vctAngleRotation2::VCT_CONTAINER_TRAITS_TYPEDEFS ( double  )

Member Data Documentation

AngleType vctAngleRotation2::AngleMember
protected

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