RobWorkProject
24.8.23-
|
A 3x3 rotation matrix \( \mathbf{R}\in SO(3) \). More...
#include <Rotation3D.hpp>
Public Types | |
typedef T | value_type |
Value type. | |
typedef Eigen::Matrix< T, 3, 3 > | EigenMatrix3x3 |
The type of the internal Eigen matrix implementation. | |
Public Member Functions | |
Rotation3D () | |
A rotation matrix with uninitialized storage. | |
Rotation3D (T r11, T r12, T r13, T r21, T r22, T r23, T r31, T r32, T r33) | |
Constructs an initialized 3x3 rotation matrix. More... | |
Rotation3D (const rw::math::Vector3D< T > &i, const rw::math::Vector3D< T > &j, const rw::math::Vector3D< T > &k) | |
Constructs an initialized 3x3 rotation matrix \( \robabx{a}{b}{\mathbf{R}} = \left[ \begin{array}{ccc} \robabx{a}{b}{\mathbf{i}} & \robabx{a}{b}{\mathbf{j}} & \robabx{a}{b}{\mathbf{k}} \end{array} \right] \). More... | |
Rotation3D (const Rotation3DVector< T > &rotVec) | |
Initialize Rotation3D from other rotation types. More... | |
void | normalize () |
Normalizes the rotation matrix to satisfy SO(3). More... | |
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... | |
const rw::math::Vector3D< T > | getRow (size_t i) const |
Returns the i'th row of the rotation matrix. More... | |
const rw::math::Vector3D< T > | getCol (size_t i) const |
Returns the i'th column of the rotation matrix. More... | |
bool | operator== (const Rotation3D< T > &rhs) const |
Comparison operator. More... | |
bool | operator!= (const Rotation3D< T > &rhs) const |
Comparison operator. More... | |
bool | equal (const Rotation3D< T > &rot, const T precision=std::numeric_limits< T >::epsilon()) const |
Compares rotations with a given precision. More... | |
bool | isProperRotation () const |
Verify that this rotation is a proper rotation. More... | |
bool | isProperRotation (T precision) const |
Verify that this rotation is a proper rotation. More... | |
const EigenMatrix3x3 & | e () const |
Returns a Eigen 3x3 matrix \( \mathbf{M}\in SO(3) \) that represents this rotation. More... | |
EigenMatrix3x3 & | e () |
Returns a Eigen 3x3 matrix \( \mathbf{M}\in SO(3) \) that represents this rotation. More... | |
const Rotation3D | operator* (const Rotation3D &bRc) const |
Calculates \( \robabx{a}{c}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{R}} \). More... | |
template<class R > | |
const Rotation3D | operator* (const Eigen::MatrixBase< R > &rhs) const |
Calculates \( \robabx{a}{c}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{R}} \). More... | |
const rw::math::Vector3D< T > | operator* (const rw::math::Vector3D< T > &bVc) const |
Calculates \( \robabx{a}{c}{\mathbf{v}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{v}} \). More... | |
template<class R > | |
Rotation3D (const EigenMatrix3x3 &r) | |
Construct a rotation matrix from a 3x3 Eigen matrix It is the responsibility of the user that 3x3 matrix is indeed a rotation matrix. | |
template<class R > | |
Rotation3D (const Eigen::MatrixBase< R > &m) | |
Construct a rotation matrix from a 3x3 Eigen matrix It is the responsibility of the user that 3x3 matrix is indeed a rotation matrix. | |
Rotation3D< T > & | inverse () |
Calculate the inverse. More... | |
Rotation3D< T > | inverse (bool copy) |
Calculate the inverse. More... | |
const Rotation3D< T > | inverse (bool copy) const |
Calculate the inverse. of a const Rotation3D. For this function copy is always true. More... | |
T | tr () const |
Rotation3D< T > & | operator= (const Rotation3DVector< T > &rot) |
Assignment of RotationVector to Rotation3D. More... | |
Static Public Member Functions | |
static const Rotation3D< T > | identity () |
Constructs a 3x3 rotation matrix set to identity. More... | |
static void | multiply (const Rotation3D< T > &a, const Rotation3D< T > &b, Rotation3D< T > &result) |
Write to result the product a * b. | |
static void | multiply (const Rotation3D< T > &a, const rw::math::Vector3D< T > &b, rw::math::Vector3D< T > &result) |
Write to result the product a * b. | |
static const Rotation3D< T > | multiply (const Rotation3D< T > &aRb, const Rotation3D< T > &bRc) |
Calculates \( \robabx{a}{c}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{R}} \). More... | |
static const rw::math::Vector3D< T > | multiply (const Rotation3D< T > &aRb, const rw::math::Vector3D< T > &bVc) |
Calculates \( \robabx{a}{c}{\mathbf{v}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{v}} \). More... | |
Friends | |
template<class R > | |
Rotation3D | operator* (const Eigen::MatrixBase< R > &lhs, const Rotation3D< T > &rhs) |
Calculates \( \robabx{a}{c}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{R}} \). More... | |
Related Functions | |
(Note that these are not member functions.) | |
static Rotation3D< T > | skew (const rw::math::Vector3D< T > &v) |
Creates a skew symmetric matrix from a Vector3D. Also known as the cross product matrix of v. More... | |
template<class S , class T > | |
const Rotation3D< S > | cast (const Rotation3D< T > &rot) |
Casts Rotation3D<T> to Rotation3D | |
template<class T > | |
const rw::math::Rotation3D< T > | inverse (const rw::math::Rotation3D< T > &aRb) |
Calculates the inverse \( \robabx{b}{a}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}}^{-1} \) of a rotation matrix. More... | |
template<class T > | |
std::ostream & | operator<< (std::ostream &os, const Rotation3D< T > &r) |
Writes rotation matrix to stream. More... | |
template<> | |
void | write (const rw::math::Rotation3D< double > &sobject, rw::common::OutputArchive &oarchive, const std::string &id) |
template<> | |
void | write (const rw::math::Rotation3D< float > &sobject, rw::common::OutputArchive &oarchive, const std::string &id) |
template<> | |
void | read (rw::math::Rotation3D< double > &sobject, rw::common::InputArchive &iarchive, const std::string &id) |
template<> | |
void | read (rw::math::Rotation3D< float > &sobject, rw::common::InputArchive &iarchive, const std::string &id) |
template<class Archive , class T > | |
void | serialize (Archive &archive, rw::math::Rotation3D< T > &R, const unsigned int version) |
Boost serialization. More... | |
A 3x3 rotation matrix \( \mathbf{R}\in SO(3) \).
\( \mathbf{R}= \left[ \begin{array}{ccc} {}^A\hat{X}_B & {}^A\hat{Y}_B & {}^A\hat{Z}_B \end{array} \right] = \left[ \begin{array}{ccc} r_{11} & r_{12} & r_{13} \\ r_{21} & r_{22} & r_{23} \\ r_{31} & r_{32} & r_{33} \end{array} \right] \)
|
inline |
Constructs an initialized 3x3 rotation matrix.
r11 | \( r_{11} \) |
r12 | \( r_{12} \) |
r13 | \( r_{13} \) |
r21 | \( r_{21} \) |
r22 | \( r_{22} \) |
r23 | \( r_{23} \) |
r31 | \( r_{31} \) |
r32 | \( r_{32} \) |
r33 | \( r_{33} \) |
\( \mathbf{R} = \left[ \begin{array}{ccc} r_{11} & r_{12} & r_{13} \\ r_{21} & r_{22} & r_{23} \\ r_{31} & r_{32} & r_{33} \end{array} \right] \)
|
inline |
Constructs an initialized 3x3 rotation matrix \( \robabx{a}{b}{\mathbf{R}} = \left[ \begin{array}{ccc} \robabx{a}{b}{\mathbf{i}} & \robabx{a}{b}{\mathbf{j}} & \robabx{a}{b}{\mathbf{k}} \end{array} \right] \).
i | \( \robabx{a}{b}{\mathbf{i}} \) |
j | \( \robabx{a}{b}{\mathbf{j}} \) |
k | \( \robabx{a}{b}{\mathbf{k}} \) |
|
explicit |
Initialize Rotation3D from other rotation types.
rotVec | [in] rotation type such as EAA, RPY, or Quaternion |
|
inline |
Returns a Eigen 3x3 matrix \( \mathbf{M}\in SO(3) \) that represents this rotation.
|
inline |
Returns a Eigen 3x3 matrix \( \mathbf{M}\in SO(3) \) that represents this rotation.
|
inline |
Compares rotations with a given precision.
Performs an element wise comparison. Two elements are considered equal if the difference are less than precision.
rot | [in] Rotation to compare with |
precision | [in] The precision to use for testing |
|
inline |
Returns the i'th column of the rotation matrix.
i | [in] Index of the column to return. Only valid indices are 0, 1 and 2. |
|
inline |
Returns the i'th row of the rotation matrix.
i | [in] Index of the row to return. Only valid indices are 0, 1 and 2. |
|
inlinestatic |
Constructs a 3x3 rotation matrix set to identity.
\( \mathbf{R} = \left[ \begin{array}{ccc} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{array} \right] \)
|
inline |
Calculate the inverse.
Rotation3D<T> inverse | ( | bool | copy | ) |
Calculate the inverse.
copy | [in] if coopy is false, This function changes the object that it is invoked on, but this is about x5 faster than rot = inverse( rot ). else it changes the object, making it a bit slower. |
const Rotation3D<T> inverse | ( | bool | copy | ) | const |
Calculate the inverse. of a const Rotation3D. For this function copy is always true.
copy | [in] always true |
bool isProperRotation | ( | ) | const |
Verify that this rotation is a proper rotation.
bool isProperRotation | ( | T | precision | ) | const |
Verify that this rotation is a proper rotation.
|
static |
Calculates \( \robabx{a}{c}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{R}} \).
aRb | [in] \( \robabx{a}{b}{\mathbf{R}} \) |
bRc | [in] \( \robabx{b}{c}{\mathbf{R}} \) |
|
static |
Calculates \( \robabx{a}{c}{\mathbf{v}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{v}} \).
aRb | [in] \( \robabx{a}{b}{\mathbf{R}} \) |
bVc | [in] \( \robabx{b}{c}{\mathbf{v}} \) |
void normalize | ( | ) |
Normalizes the rotation matrix to satisfy SO(3).
Makes a normalization of the rotation matrix such that the columns are normalized and othogonal s.t. it belongs to SO(3).
|
inline |
Comparison operator.
The comparison operator makes a element wise comparison. Returns true if any of the elements are different.
rhs | [in] Rotation to compare with |
|
inline |
Returns reference to matrix element.
row | [in] row |
column | [in] column |
|
inline |
Returns reference to matrix element.
row | [in] row |
column | [in] column |
|
inline |
Calculates \( \robabx{a}{c}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{R}} \).
rhs | [in] \( \robabx{b}{c}{\mathbf{R}} \) |
|
inline |
Calculates \( \robabx{a}{c}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{R}} \).
bRc | [in] \( \robabx{b}{c}{\mathbf{R}} \) |
|
inline |
Calculates \( \robabx{a}{c}{\mathbf{v}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{v}} \).
bVc | [in] \( \robabx{b}{c}{\mathbf{v}} \) |
Rotation3D<T>& operator= | ( | const Rotation3DVector< T > & | rot | ) |
Assignment of RotationVector to Rotation3D.
rot | [in] Rotation input |
|
inline |
Comparison operator.
The comparison operator makes a element wise comparison. Returns true only if all elements are equal.
rhs | [in] Rotation to compare with |
|
related |
Casts Rotation3D<T> to Rotation3D
rot | [in] Rotation3D with type T |
|
related |
Calculates the inverse \( \robabx{b}{a}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}}^{-1} \) of a rotation matrix.
aRb | [in] the rotation matrix \( \robabx{a}{b}{\mathbf{R}} \) |
\( \robabx{b}{a}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}}^{-1} = \robabx{a}{b}{\mathbf{R}}^T \)
|
friend |
Calculates \( \robabx{a}{c}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{R}} \).
lhs | [in] \( \robabx{b}{c}{\mathbf{R}} \) |
rhs | [in] \( \robabx{b}{c}{\mathbf{R}} \) |
|
related |
Writes rotation matrix to stream.
os | [in/out] output stream to use |
r | [in] rotation matrix to print |
|
related |
Enable read-serialization of class T by overloading this method. Data is read from iarchive and filled into sobject.
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. |
|
related |
Enable read-serialization of class T by overloading this method. Data is read from iarchive and filled into sobject.
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. |
|
related |
Boost serialization.
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). |
|
related |
Creates a skew symmetric matrix from a Vector3D. Also known as the cross product matrix of v.
v | [in] vector to create Skew matrix from |
|
related |
Enable write-serialization of class T by overloading this method. Data is written to oarchive from the sobject.
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. |
|
related |
Enable write-serialization of class T by overloading this method. Data is written to oarchive from the sobject.
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. |