RobWorkProject
Public Member Functions | Friends | Related Functions | List of all members
EAA< T > Class Template Reference

A class for representing an equivalent angle-axis rotation. More...

#include <EAA.hpp>

Inherits Rotation3DVector< T >.

Public Member Functions

 EAA (const Rotation3D< T > &R)
 Extracts Equivalent axis-angle vector from Rotation matrix. More...
 
 EAA ()
 Constructs an EAA vector initialized to $\{0,0,0\}$.
 
 EAA (const Vector3D< T > &axis, T angle)
 Constructs an initialized EAA vector. More...
 
 EAA (T thetakx, T thetaky, T thetakz)
 Constructs an initialized EAA vector $ \thetak = \left[\begin{array}{c} \theta k_x\\ \theta k_y\\ \theta k_z \end{array}\right] $. More...
 
 EAA (const Vector3D< T > &v1, const Vector3D< T > &v2)
 Constructs an EAA vector that will rotate v1 into v2. Where v1 and v2 are normalized and described in the same reference frame. More...
 
 EAA (Vector3D< T > eaa)
 Constructs an initialized EAA vector. More...
 
virtual ~EAA ()
 destructor
 
virtual const Rotation3D< T > toRotation3D () const
 Returns the corresponding $ 3\times 3 $ Rotation matrix. More...
 
angle () const
 Extracts the angle of rotation $ \theta $. More...
 
const Vector3D< T > axis () const
 Extracts the axis of rotation vector $ \mathbf{\hat{\mathbf{k}}} $. More...
 
const T & operator[] (size_t i) const
 Returns element of EAA. More...
 
T & operator[] (size_t i)
 Returns element of EAA. More...
 
const T & operator() (size_t i) const
 Returns element of EAA. More...
 
T & operator() (size_t i)
 Returns element of EAA. More...
 
bool operator== (const EAA< T > &rhs) const
 Comparison operator. More...
 
bool operator!= (const EAA< T > &rhs) const
 Comparison operator. More...
 
size_t size () const
 Get the size of the EAA. More...
 
- Public Member Functions inherited from Rotation3DVector< T >
virtual ~Rotation3DVector ()
 Virtual destructor.
 

Friends

const EAA operator* (const Rotation3D< T > &aRb, const EAA &bTKc)
 Calculates $ \robabx{a}{c}{\thetak} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{\thetak}} $. More...
 
std::ostream & operator<< (std::ostream &os, const EAA< T > &eaa)
 Ouputs EAA to stream. More...
 
const Vector3D< T > cross (const Vector3D< T > &v, const EAA< T > &eaa)
 Calculates the cross product. More...
 

Related Functions

(Note that these are not member functions.)

template<>
void write (const rw::math::EAA< double > &sobject, rw::common::OutputArchive &oarchive, const std::string &id)
 
template<>
void write (const rw::math::EAA< float > &sobject, rw::common::OutputArchive &oarchive, const std::string &id)
 
template<>
void read (rw::math::EAA< double > &sobject, rw::common::InputArchive &iarchive, const std::string &id)
 
template<>
void read (rw::math::EAA< float > &sobject, rw::common::InputArchive &iarchive, const std::string &id)
 

Additional Inherited Members

- Protected Member Functions inherited from Rotation3DVector< T >
 Rotation3DVector (const Rotation3DVector &)
 Copy Constructor. More...
 
Rotation3DVectoroperator= (const Rotation3DVector &)
 Assignment operator is protected to force subclasses to implement it by themself.
 
 Rotation3DVector ()
 Default Constructor.
 

Detailed Description

template<class T = double>
class rw::math::EAA< T >

A class for representing an equivalent angle-axis rotation.

This class defines an equivalent-axis-angle orientation vector also known as an $ \thetak $ vector or "axis+angle" vector

The equivalent-axis-angle vector is the product of a unit vector $ \hat{\mathbf{k}} $ and an angle of rotation around that axis $ \theta $

Note
given two EAA vectors $ \theta_1\mathbf{\hat{k}}_1 $ and $ \theta_2\mathbf{\hat{k}}_2 $ it is generally not possible to subtract or add these vectors, except for the special case when $ \mathbf{\hat{k}}_1 == \mathbf{\hat{k}}_2 $ this is why this class does not have any subtraction or addition operators

Constructor & Destructor Documentation

◆ EAA() [1/5]

EAA ( const Rotation3D< T > &  R)
explicit

Extracts Equivalent axis-angle vector from Rotation matrix.

Parameters
R[in] A 3x3 rotation matrix $ \mathbf{R} $

$ \theta = arccos(\frac{1}{2}(Trace(\mathbf{R})-1)=arccos(\frac{r_{11}+r_{22}+r_{33}-1}{2}) $

$ \thetak=log(\mathbf{R})=\frac{\theta}{2 sin \theta}(\mathbf{R}-\mathbf{R}^T) = \frac{\theta}{2 sin \theta} \left[ \begin{array}{c} r_{32}-r_{23}\\ r_{13}-r_{31}\\ r_{21}-r_{12} \end{array} \right] $

$ \thetak= \left[ \begin{array}{c} 0\\ 0\\ 0 \end{array} \right] $ if $ \theta = 0 $

$ \thetak=\pi \left[ \begin{array}{c} \sqrt{(R(0,0)+1.0)/2.0}\\ \sqrt{(R(1,1)+1.0)/2.0}\\ \sqrt{(R(2,2)+1.0)/2.0} \end{array} \right] $ if $ \theta = \pi $

◆ EAA() [2/5]

EAA ( const Vector3D< T > &  axis,
angle 
)
inline

Constructs an initialized EAA vector.

Parameters
axis[in] $ \mathbf{\hat{k}} $
angle[in] $ \theta $
Precondition
norm_2(axis) = 1

◆ EAA() [3/5]

EAA ( thetakx,
thetaky,
thetakz 
)
inline

Constructs an initialized EAA vector $ \thetak = \left[\begin{array}{c} \theta k_x\\ \theta k_y\\ \theta k_z \end{array}\right] $.

Parameters
thetakx[in] $ \theta k_x $
thetaky[in] $ \theta k_y $
thetakz[in] $ \theta k_z $

◆ EAA() [4/5]

EAA ( const Vector3D< T > &  v1,
const Vector3D< T > &  v2 
)
inline

Constructs an EAA vector that will rotate v1 into v2. Where v1 and v2 are normalized and described in the same reference frame.

Parameters
v1[in] normalized vector
v2[in] normalized vector

◆ EAA() [5/5]

EAA ( Vector3D< T >  eaa)
inlineexplicit

Constructs an initialized EAA vector.

The angle of the EAA are $\|eaa\|$ and the axis is $\frac{eaa}{\|eaa\|}$

Parameters
eaa[in] Values to initialize the EAA

Member Function Documentation

◆ angle()

T angle ( ) const
inline

Extracts the angle of rotation $ \theta $.

Returns
$ \theta $

◆ axis()

const Vector3D<T> axis ( ) const
inline

Extracts the axis of rotation vector $ \mathbf{\hat{\mathbf{k}}} $.

Returns
$ \mathbf{\hat{\mathbf{k}}} $

◆ operator!=()

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

◆ operator()() [1/2]

const T& operator() ( size_t  i) const
inline

Returns element of EAA.

Parameters
i[in] index ( $ 0 < i < 3 $)
Returns
the $ i $'th element

◆ operator()() [2/2]

T& operator() ( size_t  i)
inline

Returns element of EAA.

Parameters
i[in] index ( $ 0 < i < 3 $)
Returns
the $ i $'th element

◆ operator==()

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

◆ operator[]() [1/2]

const T& operator[] ( size_t  i) const
inline

Returns element of EAA.

Parameters
i[in] index ( $ 0 < i < 3 $)
Returns
the $ i $'th element

◆ operator[]() [2/2]

T& operator[] ( size_t  i)
inline

Returns element of EAA.

Parameters
i[in] index ( $ 0 < i < 3 $)
Returns
the $ i $'th element

◆ size()

size_t size ( ) const
inline

Get the size of the EAA.

Returns
the size (always 3).

◆ toRotation3D()

virtual const Rotation3D<T> toRotation3D ( ) const
virtual

Returns the corresponding $ 3\times 3 $ Rotation matrix.

Returns
The rotation matrix

$ \mathbf{R} = e^{[\mathbf{\hat{k}}],\theta}=\mathbf{I}^{3x3}+[\mathbf{\hat{k}}] sin\theta+[{\mathbf{\hat{k}}}]^2(1-cos\theta) = \left[ \begin{array}{ccc} k_xk_xv\theta + c\theta & k_xk_yv\theta - k_zs\theta & k_xk_zv\theta + k_ys\theta \\ k_xk_yv\theta + k_zs\theta & k_yk_yv\theta + c\theta & k_yk_zv\theta - k_xs\theta\\ k_xk_zv\theta - k_ys\theta & k_yk_zv\theta + k_xs\theta & k_zk_zv\theta + c\theta \end{array} \right] $

where:

  • $ c\theta = cos \theta $
  • $ s\theta = sin \theta $
  • $ v\theta = 1-cos \theta $

Implements Rotation3DVector< T >.

Friends And Related Function Documentation

◆ cross

const Vector3D<T> cross ( const Vector3D< T > &  v,
const EAA< T > &  eaa 
)
friend

Calculates the cross product.

Parameters
v[in] a 3D vector
eaa[in] a 3D eaa vector
Returns
the resulting 3D vector

◆ operator*

const EAA operator* ( const Rotation3D< T > &  aRb,
const EAA< T > &  bTKc 
)
friend

Calculates $ \robabx{a}{c}{\thetak} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{\thetak}} $.

Parameters
aRb[in] $ \robabx{a}{b}{\mathbf{R}} $
bTKc[in] $ \robabx{b}{c}{\thetak} $
Returns
$ \robabx{a}{c}{\thetak} $

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const EAA< T > &  eaa 
)
friend

Ouputs EAA to stream.

Parameters
os[in/out] stream to use
eaa[in] equivalent axis-angle
Returns
the resulting stream

◆ read() [1/2]

void read ( rw::math::EAA< 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::EAA< 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.

◆ write() [1/2]

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