cisst-saw
Loading...
Searching...
No Matches
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 ()
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) CISST_THROW(std
template<class _containerType>
 vctAngleRotation2 (const vctMatrixRotation2Base< _containerType > &matrixRotation) 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()).
ThisTypeFrom (const AngleType angle) CISST_THROW(std
template<class _containerType>
ThisTypeFrom (const vctMatrixRotation2Base< _containerType > &matrixRotation) 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.

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

Protected Member Functions

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

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

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

◆ ThisType

◆ TypeTraits

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
DIMENSION 

Constructor & Destructor Documentation

◆ vctAngleRotation2() [1/5]

vctAngleRotation2::vctAngleRotation2 ( )
inline

Default constructor. Sets the angle to zero.

◆ vctAngleRotation2() [2/5]

vctAngleRotation2::vctAngleRotation2 ( const AngleType angle)
inlineexplicit

Constructor from an angle (in radians).

◆ vctAngleRotation2() [3/5]

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

Constructor from a rotation matrix.

◆ vctAngleRotation2() [4/5]

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

Constructor from an angle (in radians).

◆ vctAngleRotation2() [5/5]

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

Constructor from a rotation matrix.

Member Function Documentation

◆ Angle() [1/2]

AngleType & vctAngleRotation2::Angle ( void )
inline

◆ Angle() [2/2]

const AngleType & vctAngleRotation2::Angle ( void ) const
inline

◆ DeSerializeRaw()

void vctAngleRotation2::DeSerializeRaw ( std::istream & inputStream)
inline

Binary deserialization

◆ From() [1/2]

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

Conversion from an angle (in radians).

◆ From() [2/2]

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

Conversion from a rotation matrix.

◆ FromNormalized() [1/2]

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

Conversion from an angle (in radians).

◆ FromNormalized() [2/2]

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

Conversion from a rotation matrix.

◆ FromRaw() [1/2]

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

Conversion from an angle (in radians).

◆ FromRaw() [2/2]

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

Conversion from a rotation matrix.

◆ Identity()

CISST_EXPORT const ThisType & vctAngleRotation2::Identity ( )
static

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

◆ Inverse()

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

◆ InverseOf()

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

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

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

◆ IsNormalized()

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.

◆ Normalized()

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

◆ NormalizedOf()

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.

◆ NormalizedSelf()

ThisType & vctAngleRotation2::NormalizedSelf ( void )
inline

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

◆ SerializeRaw()

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

Binary serialization

◆ ThrowUnlessIsNormalized() [1/2]

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

Throw an exception unless the input is normalized.

Parameters
inputAn object with IsNormalized method.

◆ ThrowUnlessIsNormalized() [2/2]

void vctAngleRotation2::ThrowUnlessIsNormalized ( void ) const
inlineprotected

Throw an exception unless this rotation is normalized.

◆ ToStream()

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

Print the matrix in a human readable format

◆ ToStreamRaw()

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

Print in machine processable format

◆ ToString()

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

◆ VCT_CONTAINER_TRAITS_TYPEDEFS()

vctAngleRotation2::VCT_CONTAINER_TRAITS_TYPEDEFS ( double )

Member Data Documentation

◆ AngleMember

AngleType vctAngleRotation2::AngleMember
protected

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