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

A 3x3 inertia matrix. More...

#include <InertiaMatrix.hpp>

Public Types

typedef Eigen::Matrix< T, 3, 3 > Base
 The type of the internal Eigen matrix implementation.
 

Public Member Functions

 InertiaMatrix (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...
 
 InertiaMatrix (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...
 
 InertiaMatrix (T i=0.0, T j=0.0, T k=0.0)
 constructor - where only the diagonal is set More...
 
 InertiaMatrix (const Base &r)
 Construct an internal matrix from a Eigen::MatrixBase It is the responsibility of the user that 3x3 matrix is indeed an inertia 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...
 
const Basee () const
 Returns reference to the internal 3x3 matrix.
 
Basee ()
 Returns reference to the internal 3x3 matrix.
 
InertiaMatrix operator* (const rw::math::Rotation3D< T > &bRc) const
 Calculates \( \robabx{a}{c}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{R}} \). More...
 
InertiaMatrix operator+ (const InertiaMatrix &I2) const
 Calculates the addition between the two InertiaMatrices.
 
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...
 
bool operator== (const InertiaMatrix &rhs) const
 Comparison operator. More...
 
bool operator!= (const InertiaMatrix &rhs) const
 Comparison operator. More...
 
rw::math::Vector3D< T > diag () const
 get The diagonal of the Matrix More...
 

Static Public Member Functions

static InertiaMatrix< T > makeSolidSphereInertia (T mass, T radi)
 Make inertia matrix for a solid sphere. More...
 
static InertiaMatrix< T > makeHollowSphereInertia (T mass, T radi)
 Make inertia matrix for a hollow sphere. More...
 
static InertiaMatrix< T > makeCuboidInertia (T mass, T x, T y, T z)
 calculates the inertia of a cuboid where the reference frame is in the center of the cuboid with More...
 

Friends

InertiaMatrix operator* (const rw::math::Rotation3D< T > &aRb, const InertiaMatrix &bRc)
 Calculates \( \robabx{a}{c}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{R}} \). More...
 
std::ostream & operator<< (std::ostream &os, const InertiaMatrix &r)
 Writes rotation matrix to stream. More...
 

Related Functions

(Note that these are not member functions.)

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

Detailed Description

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

A 3x3 inertia matrix.

Constructor & Destructor Documentation

◆ InertiaMatrix() [1/3]

InertiaMatrix ( r11,
r12,
r13,
r21,
r22,
r23,
r31,
r32,
r33 
)
inline

Constructs an initialized 3x3 rotation matrix.

Parameters
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] \)

◆ InertiaMatrix() [2/3]

InertiaMatrix ( const rw::math::Vector3D< T > &  i,
const rw::math::Vector3D< T > &  j,
const rw::math::Vector3D< T > &  k 
)
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] \).

Parameters
i\( \robabx{a}{b}{\mathbf{i}} \)
j\( \robabx{a}{b}{\mathbf{j}} \)
k\( \robabx{a}{b}{\mathbf{k}} \)

◆ InertiaMatrix() [3/3]

InertiaMatrix ( i = 0.0,
j = 0.0,
k = 0.0 
)
inline

constructor - where only the diagonal is set

Parameters
i[in] m(0,0)
j[in] m(1,1)
k[in] m(2,2)

Member Function Documentation

◆ diag()

rw::math::Vector3D<T> diag ( ) const
inline

get The diagonal of the Matrix

Returns
Vector3D< T >

◆ makeCuboidInertia()

static InertiaMatrix<T> makeCuboidInertia ( mass,
x,
y,
z 
)
inlinestatic

calculates the inertia of a cuboid where the reference frame is in the center of the cuboid with

Parameters
mass
x
y
z
Returns

◆ makeHollowSphereInertia()

static InertiaMatrix<T> makeHollowSphereInertia ( mass,
radi 
)
inlinestatic

Make inertia matrix for a hollow sphere.

Parameters
mass[in] mass of hollow sphere.
radi[in] radius of sphere.
Returns
the inertia matrix.

◆ makeSolidSphereInertia()

static InertiaMatrix<T> makeSolidSphereInertia ( mass,
radi 
)
inlinestatic

Make inertia matrix for a solid sphere.

Parameters
mass[in] mass of solid sphere.
radi[in] radius of sphere.
Returns
the inertia matrix.

◆ operator!=()

bool operator!= ( const InertiaMatrix< 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] InertiaMatrix 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]

InertiaMatrix operator* ( const rw::math::Rotation3D< T > &  bRc) const
inline

Calculates \( \robabx{a}{c}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{R}} \).

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

◆ operator*() [2/2]

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

Calculates \( \robabx{a}{c}{\mathbf{v}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{v}} \).

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

◆ operator==()

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

Friends And Related Function Documentation

◆ operator*

InertiaMatrix operator* ( const rw::math::Rotation3D< T > &  aRb,
const InertiaMatrix< T > &  bRc 
)
friend

Calculates \( \robabx{a}{c}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{R}} \).

Parameters
aRb[in] \( \robabx{a}{b}{\mathbf{R}} \)
bRc[in] \( \robabx{b}{c}{\mathbf{R}} \)
Returns
\( \robabx{a}{c}{\mathbf{R}} \)

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const InertiaMatrix< 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

◆ read() [1/2]

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