Loading...
Searching...
No Matches
ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T > Class Template Reference

A class for inertial information about a rigid body consisting of the scalar mass and a 3x3 symmetric moment of inertia matrix stored as two Vector3's. More...

#include <ignition/math/MassMatrix3.hh>

Public Member Functions

 MassMatrix3 ()
 Default Constructor.
 
 MassMatrix3 (const MassMatrix3< T > &_m)
 Copy constructor.
 
 MassMatrix3 (const T &_mass, const Vector3< T > &_ixxyyzz, const Vector3< T > &_ixyxzyz)
 Constructor.
 
virtual ~MassMatrix3 ()
 Destructor.
 
Vector3< T > DiagonalMoments () const
 Get the diagonal moments of inertia (Ixx, Iyy, Izz).
 
bool DiagonalMoments (const Vector3< T > &_ixxyyzz)
 Set the diagonal moments of inertia (Ixx, Iyy, Izz).
 
bool EquivalentBox (Vector3< T > &_size, Quaternion< T > &_rot, const T _tol=1e-6) const
 Get dimensions and rotation offset of uniform box with equivalent mass and moment of inertia.
 
bool InertiaMatrix (const T &_ixx, const T &_iyy, const T &_izz, const T &_ixy, const T &_ixz, const T &_iyz)
 Set the moment of inertia matrix.
 
bool IsPositive () const
 Verify that inertia values are positive definite.
 
bool IsValid () const
 Verify that inertia values are positive definite and satisfy the triangle inequality.
 
IXX () const
 Get IXX.
 
bool IXX (const T &_v)
 Set IXX.
 
IXY () const
 Get IXY.
 
bool IXY (const T &_v)
 Set IXY.
 
IXZ () const
 Get IXZ.
 
bool IXZ (const T &_v)
 Set IXZ.
 
IYY () const
 Get IYY.
 
bool IYY (const T &_v)
 Set IYY.
 
IYZ () const
 Get IYZ.
 
bool IYZ (const T &_v)
 Set IYZ.
 
IZZ () const
 Get IZZ.
 
bool IZZ (const T &_v)
 Set IZZ.
 
Mass () const
 Get the mass.
 
bool Mass (const T &_m)
 Set the mass.
 
Matrix3< T > MOI () const
 returns Moments of Inertia as a Matrix3
 
bool MOI (const Matrix3< T > &_moi)
 Sets Moments of Inertia (MOI) from a Matrix3.
 
Vector3< T > OffDiagonalMoments () const
 Get the off-diagonal moments of inertia (Ixy, Ixz, Iyz).
 
bool OffDiagonalMoments (const Vector3< T > &_ixyxzyz)
 Set the off-diagonal moments of inertia (Ixy, Ixz, Iyz).
 
bool operator!= (const MassMatrix3< T > &_m) const
 Inequality test operator.
 
MassMatrix3operator= (const MassMatrix3< T > &_massMatrix)
 Equal operator.
 
bool operator== (const MassMatrix3< T > &_m) const
 Equality comparison operator.
 
Quaternion< T > PrincipalAxesOffset (const T _tol=1e-6) const
 Compute rotational offset of principal axes.
 
Vector3< T > PrincipalMoments (const T _tol=1e-6) const
 Compute principal moments of inertia, which are the eigenvalues of the moment of inertia matrix.
 
bool SetFromBox (const T _mass, const Vector3< T > &_size, const Quaternion< T > &_rot=Quaternion< T >::Identity)
 Set inertial properties based on mass and equivalent box.
 
bool SetFromBox (const Vector3< T > &_size, const Quaternion< T > &_rot=Quaternion< T >::Identity)
 Set inertial properties based on equivalent box using the current mass value.
 
bool SetFromCylinderZ (const T _length, const T _radius, const Quaternion< T > &_rot)
 Set inertial properties based on equivalent cylinder aligned with Z axis using the current mass value.
 
bool SetFromCylinderZ (const T _mass, const T _length, const T _radius, const Quaternion< T > &_rot=Quaternion< T >::Identity)
 Set inertial properties based on mass and equivalent cylinder aligned with Z axis.
 
bool SetFromSphere (const T _mass, const T _radius)
 Set inertial properties based on mass and equivalent sphere.
 
bool SetFromSphere (const T _radius)
 Set inertial properties based on equivalent sphere using the current mass value.
 

Static Public Member Functions

static bool ValidMoments (const Vector3< T > &_moments)
 Verify that principal moments are positive and satisfy the triangle inequality.
 

Detailed Description

template<typename T>
class ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >

A class for inertial information about a rigid body consisting of the scalar mass and a 3x3 symmetric moment of inertia matrix stored as two Vector3's.

Constructor & Destructor Documentation

◆ MassMatrix3() [1/3]

template<typename T >
ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::MassMatrix3 ( )
inline

Default Constructor.

◆ MassMatrix3() [2/3]

template<typename T >
ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::MassMatrix3 ( const T & _mass,
const Vector3< T > & _ixxyyzz,
const Vector3< T > & _ixyxzyz )
inline

Constructor.

Parameters
[in]_massMass value in kg if using metric.
[in]_ixxyyzzDiagonal moments of inertia.
[in]_ixyxzyzOff-diagonal moments of inertia

◆ MassMatrix3() [3/3]

template<typename T >
ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::MassMatrix3 ( const MassMatrix3< T > & _m)
inline

Copy constructor.

Parameters
[in]_massMatrixMassMatrix3 element to copy

◆ ~MassMatrix3()

template<typename T >
virtual ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::~MassMatrix3 ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ DiagonalMoments() [1/2]

template<typename T >
Vector3< T > ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::DiagonalMoments ( ) const
inline

Get the diagonal moments of inertia (Ixx, Iyy, Izz).

Returns
The diagonal moments.

Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::operator=(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::operator==().

◆ DiagonalMoments() [2/2]

template<typename T >
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::DiagonalMoments ( const Vector3< T > & _ixxyyzz)
inline

Set the diagonal moments of inertia (Ixx, Iyy, Izz).

Parameters
[in]_ixxyyzzdiagonal moments of inertia
Returns
True if the MassMatrix3 is valid.

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().

◆ EquivalentBox()

template<typename T >
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::EquivalentBox ( Vector3< T > & _size,
Quaternion< T > & _rot,
const T _tol = 1e-6 ) const
inline

Get dimensions and rotation offset of uniform box with equivalent mass and moment of inertia.

To compute this, the Matrix3 is diagonalized. The eigenvalues on the diagonal and the rotation offset of the principal axes are returned.

Parameters
[in]_sizeDimensions of box aligned with principal axes.
[in]_rotRotational offset of principal axes.
[in]_tolRelative tolerance.
Returns
True if box properties were computed successfully.
Todo
Use a mock class to test this line

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsPositive(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::PrincipalAxesOffset(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::PrincipalMoments(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::ValidMoments(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector3< T >::X(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector3< T >::Y(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector3< T >::Z().

◆ InertiaMatrix()

template<typename T >
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::InertiaMatrix ( const T & _ixx,
const T & _iyy,
const T & _izz,
const T & _ixy,
const T & _ixz,
const T & _iyz )
inline

Set the moment of inertia matrix.

Parameters
[in]_ixxX second moment of inertia (MOI) about x axis.
[in]_iyyY second moment of inertia about y axis.
[in]_izzZ second moment of inertia about z axis.
[in]_ixyXY inertia.
[in]_ixzXZ inertia.
[in]_iyzYZ inertia.
Returns
True if the MassMatrix3 is valid.

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().

◆ IsPositive()

◆ IsValid()

◆ IXX() [1/2]

template<typename T >
T ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IXX ( ) const
inline

◆ IXX() [2/2]

template<typename T >
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IXX ( const T & _v)
inline

Set IXX.

Parameters
[in]_vIXX value
Returns
True if the MassMatrix3 is valid.

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().

◆ IXY() [1/2]

template<typename T >
T ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IXY ( ) const
inline

◆ IXY() [2/2]

template<typename T >
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IXY ( const T & _v)
inline

Set IXY.

Parameters
[in]_vIXY value
Returns
True if the MassMatrix3 is valid.

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().

◆ IXZ() [1/2]

template<typename T >
T ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IXZ ( ) const
inline

Get IXZ.

Returns
IXZ value

◆ IXZ() [2/2]

template<typename T >
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IXZ ( const T & _v)
inline

Set IXZ.

Parameters
[in]_vIXZ value
Returns
True if the MassMatrix3 is valid.

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().

◆ IYY() [1/2]

template<typename T >
T ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IYY ( ) const
inline

◆ IYY() [2/2]

template<typename T >
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IYY ( const T & _v)
inline

Set IYY.

Parameters
[in]_vIYY value
Returns
True if the MassMatrix3 is valid.

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().

◆ IYZ() [1/2]

template<typename T >
T ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IYZ ( ) const
inline

Get IYZ.

Returns
IYZ value

◆ IYZ() [2/2]

template<typename T >
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IYZ ( const T & _v)
inline

Set IYZ.

Parameters
[in]_vIYZ value
Returns
True if the MassMatrix3 is valid.

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().

◆ IZZ() [1/2]

template<typename T >
T ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IZZ ( ) const
inline

Get IZZ.

Returns
IZZ value

◆ IZZ() [2/2]

template<typename T >
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IZZ ( const T & _v)
inline

Set IZZ.

Parameters
[in]_vIZZ value
Returns
True if the MassMatrix3 is valid.

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().

◆ Mass() [1/2]

◆ Mass() [2/2]

◆ MOI() [1/2]

◆ MOI() [2/2]

template<typename T >
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::MOI ( const Matrix3< T > & _moi)
inline

Sets Moments of Inertia (MOI) from a Matrix3.

Symmetric component of input matrix is used by averaging off-axis terms.

Parameters
[in]Momentsof Inertia as a Matrix3
Returns
True if the MassMatrix3 is valid.

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().

◆ OffDiagonalMoments() [1/2]

template<typename T >
Vector3< T > ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::OffDiagonalMoments ( ) const
inline

Get the off-diagonal moments of inertia (Ixy, Ixz, Iyz).

Returns
The off-diagonal moments of inertia.

Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::operator=(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::operator==().

◆ OffDiagonalMoments() [2/2]

template<typename T >
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::OffDiagonalMoments ( const Vector3< T > & _ixyxzyz)
inline

Set the off-diagonal moments of inertia (Ixy, Ixz, Iyz).

Parameters
[in]_ixyxzyzoff-diagonal moments of inertia
Returns
True if the MassMatrix3 is valid.

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().

◆ operator!=()

template<typename T >
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::operator!= ( const MassMatrix3< T > & _m) const
inline

Inequality test operator.

Parameters
[in]_mMassMatrix3<T> to test
Returns
True if not equal (using the default tolerance of 1e-6)

◆ operator=()

◆ operator==()

◆ PrincipalAxesOffset()

template<typename T >
Quaternion< T > ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::PrincipalAxesOffset ( const T _tol = 1e-6) const
inline

Compute rotational offset of principal axes.

Parameters
[in]_tolRelative tolerance given by absolute value of _tol. Negative values of _tol are interpreted as a flag that causes principal moments to always be sorted from smallest to largest.
Returns
Quaternion representing rotational offset of principal axes. With a rotation matrix constructed from this quaternion R(q) and a diagonal matrix L with principal moments on the diagonal, the original moment of inertia matrix MOI can be reconstructed with MOI = R(q).Transpose() * L * R(q)
Todo
Use a mock class to test this line

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::clamp(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector3< T >::Equal(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::equal(), IGN_PI_2, ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Quaternion< T >::Inverse(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Angle::Normalize(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::PrincipalMoments(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Angle::Radian(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::Set(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::SquaredLength().

Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::EquivalentBox().

◆ PrincipalMoments()

template<typename T >
Vector3< T > ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::PrincipalMoments ( const T _tol = 1e-6) const
inline

Compute principal moments of inertia, which are the eigenvalues of the moment of inertia matrix.

Parameters
[in]_tolRelative tolerance given by absolute value of _tol. Negative values of _tol are interpreted as a flag that causes principal moments to always be sorted from smallest to largest.
Returns
Principal moments of inertia. If the matrix is already diagonal and _tol is positive, they are returned in the existing order. Otherwise, the moments are sorted from smallest to largest.

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::clamp(), IGN_PI, ignition::math::IGNITION_MATH_VERSION_NAMESPACE::sort3(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector3< T >::Sum().

Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::EquivalentBox(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::PrincipalAxesOffset().

◆ SetFromBox() [1/2]

template<typename T >
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::SetFromBox ( const T _mass,
const Vector3< T > & _size,
const Quaternion< T > & _rot = Quaternion<T>::Identity )
inline

Set inertial properties based on mass and equivalent box.

Parameters
[in]_massMass to set.
[in]_sizeSize of equivalent box.
[in]_rotRotational offset of equivalent box.
Returns
True if inertial properties were set successfully.

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::Mass(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector3< T >::Min(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::SetFromBox().

Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::SetFromBox().

◆ SetFromBox() [2/2]

◆ SetFromCylinderZ() [1/2]

template<typename T >
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::SetFromCylinderZ ( const T _length,
const T _radius,
const Quaternion< T > & _rot )
inline

Set inertial properties based on equivalent cylinder aligned with Z axis using the current mass value.

Parameters
[in]_lengthLength of cylinder along Z axis.
[in]_radiusRadius of cylinder.
[in]_rotRotational offset of equivalent cylinder.
Returns
True if inertial properties were set successfully.

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::Mass(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::MOI(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Transposed().

◆ SetFromCylinderZ() [2/2]

template<typename T >
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::SetFromCylinderZ ( const T _mass,
const T _length,
const T _radius,
const Quaternion< T > & _rot = Quaternion<T>::Identity )
inline

Set inertial properties based on mass and equivalent cylinder aligned with Z axis.

Parameters
[in]_massMass to set.
[in]_lengthLength of cylinder along Z axis.
[in]_radiusRadius of cylinder.
[in]_rotRotational offset of equivalent cylinder.
Returns
True if inertial properties were set successfully.

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::Mass(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::SetFromCylinderZ().

Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::SetFromCylinderZ().

◆ SetFromSphere() [1/2]

template<typename T >
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::SetFromSphere ( const T _mass,
const T _radius )
inline

Set inertial properties based on mass and equivalent sphere.

Parameters
[in]_massMass to set.
[in]_radiusRadius of equivalent, uniform sphere.
Returns
True if inertial properties were set successfully.

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::Mass(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::SetFromSphere().

Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::SetFromSphere().

◆ SetFromSphere() [2/2]

template<typename T >
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::SetFromSphere ( const T _radius)
inline

Set inertial properties based on equivalent sphere using the current mass value.

Parameters
[in]_radiusRadius of equivalent, uniform sphere.
Returns
True if inertial properties were set successfully.

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::Mass(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::MOI().

◆ ValidMoments()

template<typename T >
static bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::ValidMoments ( const Vector3< T > & _moments)
inlinestatic

Verify that principal moments are positive and satisfy the triangle inequality.

Parameters
[in]_momentsPrincipal moments of inertia.
Returns
True if moments of inertia are positive and satisfy the triangle inequality.

Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::EquivalentBox(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().


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