RobWorkProject  24.12.4-
Public Types | Public Member Functions | Static Public Member Functions | Friends | Related Functions | List of all members
Transform2D< T > Class Template Reference

Public Types

typedef T value_type
 Value type.
 

Public Member Functions

 Transform2D ()
 Default Constructor. More...
 
 Transform2D (const Vector2D< T > &d, const Rotation2D< T > &R)
 Constructs a homogeneous transform. More...
 
T & operator() (std::size_t row, std::size_t col)
 Returns matrix element reference. More...
 
const T & operator() (std::size_t row, std::size_t col) const
 Returns const matrix element reference. More...
 
bool operator== (const Transform2D< T > &rhs) const
 Comparison operator. More...
 
bool operator!= (const Transform2D< T > &rhs) const
 Comparison operator. More...
 
const Transform2D operator* (const Transform2D &bTc) const
 Calculates \( \robabx{a}{c}{\mathbf{T}} = \robabx{a}{b}{\mathbf{T}} \robabx{b}{c}{\mathbf{T}} \) where this object is \( \robabx{a}{b}{\mathbf{T}} \). More...
 
const Vector2D< T > operator* (const Vector2D< T > &bP) const
 Calculates \( \robax{a}{\mathbf{p}} = \robabx{a}{b}{\mathbf{T}} \robax{b}{\mathbf{p}} \) thus transforming point \( \mathbf{p} \) from frame \( b \) to frame \( a \). This object is \( \robabx{a}{c}{\mathbf{T}} \). More...
 
Rotation2D< T > & R ()
 Gets the rotation part \( \mathbf{R} \) from \( \mathbf{T} \). More...
 
const Rotation2D< T > & R () const
 Gets the rotation part \( \mathbf{R} \) from \( \mathbf{T} \). More...
 
Vector2D< T > & P ()
 Gets the position part \( \mathbf{d} \) from \( \mathbf{T} \). More...
 
const Vector2D< T > & P () const
 Gets the position part \( \mathbf{d} \) from \( \mathbf{T} \). More...
 

Static Public Member Functions

static const Transform2Didentity ()
 Constructs the identity transform. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const Transform2D< T > &t)
 Outputs transform to stream. More...
 

Related Functions

(Note that these are not member functions.)

template<class T >
const Transform2D< T > inverse (const Transform2D< T > &aTb)
 Calculates \( \robabx{b}{a}{\mathbf{T}} = \robabx{a}{b}{\mathbf{T}}^{-1} \). More...
 
template<>
void write (const rw::math::Transform2D< double > &sobject, rw::common::OutputArchive &oarchive, const std::string &id)
 
template<>
void write (const rw::math::Transform2D< float > &sobject, rw::common::OutputArchive &oarchive, const std::string &id)
 
template<>
void read (rw::math::Transform2D< double > &sobject, rw::common::InputArchive &iarchive, const std::string &id)
 
template<>
void read (rw::math::Transform2D< float > &sobject, rw::common::InputArchive &iarchive, const std::string &id)
 
template<class Archive , class T >
void serialize (Archive &archive, rw::math::Transform2D< T > &transform, const unsigned int version)
 Boost serialization. More...
 

Constructor & Destructor Documentation

◆ Transform2D() [1/2]

Transform2D ( )
inline

Default Constructor.

Initializes with 0 translation and Identity matrix as rotation

◆ Transform2D() [2/2]

Transform2D ( const Vector2D< T > &  d,
const Rotation2D< T > &  R 
)
inline

Constructs a homogeneous transform.

Parameters
d[in] \( \mathbf{d} \) A 2x1 translation vector
R[in] \( \mathbf{R} \) A 2x2 rotation matrix

Member Function Documentation

◆ identity()

static const Transform2D& identity ( )
inlinestatic

Constructs the identity transform.

Returns
the identity transform

\( \mathbf{T} = \left[ \begin{array}{ccc} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right] \)

◆ operator!=()

bool operator!= ( const Transform2D< 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] Transform to compare with
Returns
True if not equal.

◆ operator()() [1/2]

T& operator() ( std::size_t  row,
std::size_t  col 
)
inline

Returns matrix element reference.

Parameters
row[in] row, row must be \( < 2 \)
col[in] col, col must be \( < 3 \)
Returns
reference to matrix element

◆ operator()() [2/2]

const T& operator() ( std::size_t  row,
std::size_t  col 
) const
inline

Returns const matrix element reference.

Parameters
row[in] row, row must be \( < 2 \)
col[in] col, col must be \( < 3 \)
Returns
const reference to matrix element

◆ operator*() [1/2]

const Transform2D operator* ( const Transform2D< T > &  bTc) const
inline

Calculates \( \robabx{a}{c}{\mathbf{T}} = \robabx{a}{b}{\mathbf{T}} \robabx{b}{c}{\mathbf{T}} \) where this object is \( \robabx{a}{b}{\mathbf{T}} \).

Parameters
bTc[in] \( \robabx{b}{c}{\mathbf{T}} \)
Returns
\( \robabx{a}{c}{\mathbf{T}} \)

\( \robabx{a}{c}{\mathbf{T}} = \left[ \begin{array}{cc} \robabx{a}{b}{\mathbf{R}}\robabx{b}{c}{\mathbf{R}} & \robabx{a}{b}{\mathbf{d}} + \robabx{a}{b}{\mathbf{R}}\robabx{b}{c}{\mathbf{d}} \\ \begin{array}{cc} 0 & 0 \end{array} & 1 \end{array} \right] \)

◆ operator*() [2/2]

const Vector2D<T> operator* ( const Vector2D< T > &  bP) const
inline

Calculates \( \robax{a}{\mathbf{p}} = \robabx{a}{b}{\mathbf{T}} \robax{b}{\mathbf{p}} \) thus transforming point \( \mathbf{p} \) from frame \( b \) to frame \( a \). This object is \( \robabx{a}{c}{\mathbf{T}} \).

Parameters
bP[in] \( \robax{b}{\mathbf{p}} \)
Returns
\( \robax{a}{\mathbf{p}} \)

◆ operator==()

bool operator== ( const Transform2D< 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] Transform to compare with
Returns
True if equal.

◆ P() [1/2]

Vector2D<T>& P ( )
inline

Gets the position part \( \mathbf{d} \) from \( \mathbf{T} \).

Returns
\( \mathbf{d} \)

◆ P() [2/2]

const Vector2D<T>& P ( ) const
inline

Gets the position part \( \mathbf{d} \) from \( \mathbf{T} \).

Returns
\( \mathbf{d} \)

◆ R() [1/2]

Rotation2D<T>& R ( )
inline

Gets the rotation part \( \mathbf{R} \) from \( \mathbf{T} \).

Returns
\( \mathbf{R} \)

◆ R() [2/2]

const Rotation2D<T>& R ( ) const
inline

Gets the rotation part \( \mathbf{R} \) from \( \mathbf{T} \).

Returns
\( \mathbf{R} \)

Friends And Related Function Documentation

◆ inverse()

const Transform2D< T > inverse ( const Transform2D< T > &  aTb)
related

Calculates \( \robabx{b}{a}{\mathbf{T}} = \robabx{a}{b}{\mathbf{T}}^{-1} \).

Parameters
aTb[in] the transform matrix \( \robabx{a}{b}{\mathbf{T}} \)
Returns
\( \robabx{b}{a}{\mathbf{T}} = \robabx{a}{b}{\mathbf{T}}^{-1} \)

\( \robabx{a}{b}{\mathbf{T}}^{-1} = \left[ \begin{array}{cc} \robabx{a}{b}{\mathbf{R}}^{T} & - \robabx{a}{b}{\mathbf{R}}^{T} \robabx{a}{b}{\mathbf{d}} \\ \begin{array}{cc}0 & 0\end{array} & 1 \end{array} \right] \)

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Transform2D< T > &  t 
)
friend

Outputs transform to stream.

Parameters
os[in/out] an output stream
t[in] the transform that is to be sent to the output stream
Returns
os

◆ read() [1/2]

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

Enable read-serialization of class T by overloading this method. Data is read from iarchive and filled into sobject.

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.

◆ read() [2/2]

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

Enable read-serialization of class T by overloading this method. Data is read from iarchive and filled into sobject.

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::Transform2D< T > &  transform,
const unsigned int  version 
)
related

Boost serialization.

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

◆ write() [1/2]

void write ( const rw::math::Transform2D< 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::Transform2D< 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: