RobWorkProject  24.8.23-
Rotation2D< T > Class Template Reference

A 2x2 rotation matrix $$\mathbf{R}\in SO(2)$$. More...

#include <Rotation2D.hpp>

## Public Types

typedef T value_type
Value type.

typedef Eigen::Rotation2D< T > EigenMatrix2x2
The type of the internal Eigen matrix implementation.

## Public Member Functions

Rotation2D ()
A rotation matrix with uninitialized storage.

Rotation2D (T r11, T r12, T r21, T r22)
Constructs an initialized 2x2 rotation matrix. More...

Rotation2D (const rw::math::Vector2D< T > &i, const rw::math::Vector2D< T > &j)
Constructs an initialized 2x2 rotation matrix $$\robabx{a}{b}{\mathbf{R}} = \left[ \begin{array}{cc} \robabx{a}{b}{\mathbf{i}} & \robabx{a}{b}{\mathbf{j}} \end{array} \right]$$. More...

Rotation2D (const T theta)
Constructs an initialized 2x2 rotation matrix $$\robabx{a}{b}{\mathbf{R}} = \left[ \begin{array}{cc} \robabx{a}{b}{\mathbf{i}} & \robabx{a}{b}{\mathbf{j}} \end{array} \right]$$. More...

Rotation2D (const rw::math::Vector2D< T > &i)
Construct an initialized 2x2 rotation matrix. More...

template<class R >
Rotation2D (const EigenMatrix2x2 &m)
Construct a rotation matrix from an Eigen matrix.

T & operator() (size_t row, size_t column)
Returns reference to matrix element. More...

const T & operator() (size_t row, size_t column) const
Returns reference to matrix element. More...

bool operator== (const Rotation2D< T > &rhs) const
Comparison operator. More...

bool operator!= (const Rotation2D< T > &rhs) const
Comparison operator. More...

EigenMatrix2x2 e () const
Returns a Eigen 2x2 matrix $$\mathbf{M}\in SO(2)$$ that represents this rotation. More...

const Rotation2D operator* (const Rotation2D &bRc) const
Calculates $$\robabx{a}{c}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{R}}$$ where this object is $$\robabx{a}{b}{\mathbf{R}}$$. More...

const rw::math::Vector2D< T > operator* (const rw::math::Vector2D< T > &bVc) const
Calculates $$\robabx{a}{c}{\mathbf{v}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{v}}$$ where this object is $$\robabx{a}{b}{\mathbf{R}}$$. More...

## Static Public Member Functions

static const Rotation2D identity ()
Constructs a 2x2 rotation matrix set to identity. More...

## Friends

std::ostream & operator<< (std::ostream &os, const Rotation2D &r)
Writes rotation matrix to stream. More...

## Related Functions

(Note that these are not member functions.)

template<class T >
const Rotation2D< T > inverse (const Rotation2D< T > &aRb)
The inverse $$\robabx{b}{a}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}}^{-1}$$ of a rotation matrix. More...

template<>
void write (const rw::math::Rotation2D< double > &sobject, rw::common::OutputArchive &oarchive, const std::string &id)

template<>
void write (const rw::math::Rotation2D< float > &sobject, rw::common::OutputArchive &oarchive, const std::string &id)

template<>
void read (rw::math::Rotation2D< double > &sobject, rw::common::InputArchive &iarchive, const std::string &id)

template<>
void read (rw::math::Rotation2D< float > &sobject, rw::common::InputArchive &iarchive, const std::string &id)

template<class Archive , class T >
void serialize (Archive &archive, rw::math::Rotation2D< T > &R, const unsigned int version)
Boost serialization. More...

## Detailed Description

### template<class T = double> class rw::math::Rotation2D< T >

A 2x2 rotation matrix $$\mathbf{R}\in SO(2)$$.

$$\mathbf{R}= \left[ \begin{array}{cc} {}^A\hat{X}_B & {}^A\hat{Y}_B \end{array} \right] = \left[ \begin{array}{cc} r_{11} & r_{12} \\ r_{21} & r_{22} \end{array} \right]$$

## ◆ Rotation2D() [1/4]

 Rotation2D ( T r11, T r12, T r21, T r22 )
inline

Constructs an initialized 2x2 rotation matrix.

Parameters
 r11 $$r_{11}$$ r12 $$r_{12}$$ r21 $$r_{21}$$ r22 $$r_{22}$$

$$\mathbf{R} = \left[ \begin{array}{cc} r_{11} & r_{12} \\ r_{21} & r_{22} \end{array} \right]$$

## ◆ Rotation2D() [2/4]

 Rotation2D ( const rw::math::Vector2D< T > & i, const rw::math::Vector2D< T > & j )
inline

Constructs an initialized 2x2 rotation matrix $$\robabx{a}{b}{\mathbf{R}} = \left[ \begin{array}{cc} \robabx{a}{b}{\mathbf{i}} & \robabx{a}{b}{\mathbf{j}} \end{array} \right]$$.

Parameters
 i $$\robabx{a}{b}{\mathbf{i}}$$ j $$\robabx{a}{b}{\mathbf{j}}$$

## ◆ Rotation2D() [3/4]

 Rotation2D ( const T theta )
inline

Constructs an initialized 2x2 rotation matrix $$\robabx{a}{b}{\mathbf{R}} = \left[ \begin{array}{cc} \robabx{a}{b}{\mathbf{i}} & \robabx{a}{b}{\mathbf{j}} \end{array} \right]$$.

Parameters
 theta

## ◆ Rotation2D() [4/4]

 Rotation2D ( const rw::math::Vector2D< T > & i )
inline

Construct an initialized 2x2 rotation matrix.

The second of column of the matrix is deduced from the first column.

Parameters
 i [in] The first column of the rotation matrix.

## ◆ e()

 EigenMatrix2x2 e ( ) const
inline

Returns a Eigen 2x2 matrix $$\mathbf{M}\in SO(2)$$ that represents this rotation.

Returns
$$\mathbf{M}\in SO(2)$$

## ◆ identity()

 static const Rotation2D identity ( )
inlinestatic

Constructs a 2x2 rotation matrix set to identity.

Returns
a 2x2 identity rotation matrix

$$\mathbf{R} = \left[ \begin{array}{cc} 1 & 0\\ 0 & 1 \end{array} \right]$$

## ◆ operator!=()

 bool operator!= ( const Rotation2D< T > & rhs ) const
inline

Comparison operator.

The comparison operator makes a element wise comparison. Returns true if any of the elements are different.

Parameters
 rhs [in] Rotation2D to compare with
Returns
True if not equal.

## ◆ operator()() [1/2]

 T& operator() ( size_t row, size_t column )
inline

Returns reference to matrix element.

Parameters
 row [in] row column [in] column
Returns
reference to the element

## ◆ operator()() [2/2]

 const T& operator() ( size_t row, size_t column ) const
inline

Returns reference to matrix element.

Parameters
 row [in] row column [in] column
Returns
reference to the element

## ◆ operator*() [1/2]

 const Rotation2D operator* ( const Rotation2D< T > & bRc ) const
inline

Calculates $$\robabx{a}{c}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{R}}$$ where this object is $$\robabx{a}{b}{\mathbf{R}}$$.

Parameters
 bRc [in] $$\robabx{b}{c}{\mathbf{R}}$$
Returns
$$\robabx{a}{c}{\mathbf{R}}$$

## ◆ operator*() [2/2]

 const rw::math::Vector2D operator* ( const rw::math::Vector2D< T > & bVc ) const
inline

Calculates $$\robabx{a}{c}{\mathbf{v}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{v}}$$ where this object is $$\robabx{a}{b}{\mathbf{R}}$$.

Parameters
 bVc [in] $$\robabx{b}{c}{\mathbf{v}}$$
Returns
$$\robabx{a}{c}{\mathbf{v}}$$

## ◆ operator==()

 bool operator== ( const Rotation2D< T > & rhs ) const
inline

Comparison operator.

The comparison operator makes a element wise comparison. Returns true only if all elements are equal.

Parameters
 rhs [in] Rotation2D to compare with
Returns
True if equal.

## ◆ inverse()

 const Rotation2D< T > inverse ( const Rotation2D< T > & aRb )
related

The inverse $$\robabx{b}{a}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}}^{-1}$$ of a rotation matrix.

Parameters
 aRb [in] the rotation matrix $$\robabx{a}{b}{\mathbf{R}}$$
Returns
the matrix inverse $$\robabx{b}{a}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}}^{-1}$$

$$\robabx{b}{a}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}}^{-1} = \robabx{a}{b}{\mathbf{R}}^T$$

## ◆ operator<<

 std::ostream& operator<< ( std::ostream & os, const Rotation2D< T > & r )
friend

Writes rotation matrix to stream.

Parameters
 os [in/out] output stream to use r [in] rotation matrix to print
Returns
the updated output stream

 void read ( rw::math::Rotation2D< double > & sobject, rw::common::InputArchive & iarchive, const std::string & id )
related

Parameters
 sobject [out] the object in which the data should be streamed into iarchive [in] the InputArchive from which to read data. id [in] The id of the serialized sobject.
Note
the id can be empty in which case the overloaded method should provide a default identifier. E.g. the Vector3D class defined "Vector3D" as its default id.

 void read ( rw::math::Rotation2D< float > & sobject, rw::common::InputArchive & iarchive, const std::string & id )
related

Parameters
 sobject [out] the object in which the data should be streamed into iarchive [in] the InputArchive from which to read data. id [in] The id of the serialized sobject.
Note
the id can be empty in which case the overloaded method should provide a default identifier. E.g. the Vector3D class defined "Vector3D" as its default id.

## ◆ serialize()

 void serialize ( Archive & archive, rw::math::Rotation2D< T > & R, const unsigned int version )
related

Boost serialization.

Parameters
 archive [in] the boost archive to read from or write to. R [in/out] the rotation matrix to read/write. version [in] class version (currently version 0).

## ◆ write() [1/2]

 void write ( const rw::math::Rotation2D< double > & sobject, rw::common::OutputArchive & oarchive, const std::string & id )
related

Enable write-serialization of class T by overloading this method. Data is written to oarchive from the sobject.

Parameters
 sobject [in] the object from which the data should be streamed. oarchive [out] the OutputArchive in which data should be written. id [in] The id of the serialized sobject.
Note
the id can be empty in which case the overloaded method should provide a default identifier. E.g. the Vector3D class defined "Vector3D" as its default id.

## ◆ write() [2/2]

 void write ( const rw::math::Rotation2D< float > & sobject, rw::common::OutputArchive & oarchive, const std::string & id )
related

Enable write-serialization of class T by overloading this method. Data is written to oarchive from the sobject.

Parameters
 sobject [in] the object from which the data should be streamed. oarchive [out] the OutputArchive in which data should be written. id [in] The id of the serialized sobject.
Note
the id can be empty in which case the overloaded method should provide a default identifier. E.g. the Vector3D class defined "Vector3D" as its default id.

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