Ignition Math

API Reference

6.4.0

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, which inializes the mass and moments to zero. More...
 
 MassMatrix3 (const T &_mass, const Vector3< T > &_ixxyyzz, const Vector3< T > &_ixyxzyz)
 Constructor. More...
 
 MassMatrix3 (const MassMatrix3< T > &_m)
 Copy constructor. More...
 
virtual ~MassMatrix3 ()
 Destructor. More...
 
Vector3< TDiagonalMoments () const
 Get the diagonal moments of inertia (Ixx, Iyy, Izz). More...
 
T Epsilon (const T _tolerance=IGN_MASSMATRIX3_DEFAULT_TOLERANCE< T >) const
 Get an epsilon value that represents the amount of acceptable error in a MassMatrix3. The epsilon value is related to machine precision multiplied by the largest possible moment of inertia. More...
 
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. To compute this, the Matrix3 is diagonalized. The eigenvalues on the diagonal and the rotation offset of the principal axes are returned. More...
 
bool IsNearPositive (const T _tolerance=IGN_MASSMATRIX3_DEFAULT_TOLERANCE< T >) const
 Verify that inertia values are positive semidefinite. More...
 
bool IsPositive (const T _tolerance=IGN_MASSMATRIX3_DEFAULT_TOLERANCE< T >) const
 Verify that inertia values are positive definite. More...
 
bool IsValid (const T _tolerance=IGN_MASSMATRIX3_DEFAULT_TOLERANCE< T >) const
 Verify that inertia values are positive semi-definite and satisfy the triangle inequality. More...
 
T Ixx () const
 Get IXX. More...
 
T Ixy () const
 Get IXY. More...
 
T Ixz () const
 Get IXZ. More...
 
T Iyy () const
 Get IYY. More...
 
T Iyz () const
 Get IYZ. More...
 
T Izz () const
 Get IZZ. More...
 
T Mass () const
 Get the mass. More...
 
Matrix3< TMoi () const
 returns Moments of Inertia as a Matrix3 More...
 
Vector3< TOffDiagonalMoments () const
 Get the off-diagonal moments of inertia (Ixy, Ixz, Iyz). More...
 
bool operator!= (const MassMatrix3< T > &_m) const
 Inequality test operator. More...
 
MassMatrix3operator= (const MassMatrix3< T > &_massMatrix)
 Equal operator. More...
 
bool operator== (const MassMatrix3< T > &_m) const
 Equality comparison operator. More...
 
Quaternion< TPrincipalAxesOffset (const T _tol=1e-6) const
 Compute rotational offset of principal axes. More...
 
Vector3< TPrincipalMoments (const T _tol=1e-6) const
 Compute principal moments of inertia, which are the eigenvalues of the moment of inertia matrix. More...
 
bool SetDiagonalMoments (const Vector3< T > &_ixxyyzz)
 Set the diagonal moments of inertia (Ixx, Iyy, Izz). More...
 
bool SetFromBox (const Material &_mat, const Vector3< T > &_size, const Quaternion< T > &_rot=Quaternion< T >::Identity)
 Set inertial properties based on a Material and equivalent box. More...
 
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. More...
 
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. More...
 
bool SetFromCylinderZ (const Material &_mat, const T _length, const T _radius, const Quaternion< T > &_rot=Quaternion< T >::Identity)
 Set inertial properties based on a Material and equivalent cylinder aligned with Z axis. More...
 
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. More...
 
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. More...
 
bool SetFromSphere (const Material &_mat, const T _radius)
 Set inertial properties based on a material and equivalent sphere. More...
 
bool SetFromSphere (const T _mass, const T _radius)
 Set inertial properties based on mass and equivalent sphere. More...
 
bool SetFromSphere (const T _radius)
 Set inertial properties based on equivalent sphere using the current mass value. More...
 
bool SetInertiaMatrix (const T &_ixx, const T &_iyy, const T &_izz, const T &_ixy, const T &_ixz, const T &_iyz)
 Set the moment of inertia matrix. More...
 
bool SetIxx (const T &_v)
 Set IXX. More...
 
bool SetIxy (const T &_v)
 Set IXY. More...
 
bool SetIxz (const T &_v)
 Set IXZ. More...
 
bool SetIyy (const T &_v)
 Set IYY. More...
 
bool SetIyz (const T &_v)
 Set IYZ. More...
 
bool SetIzz (const T &_v)
 Set IZZ. More...
 
bool SetMass (const T &_m)
 Set the mass. More...
 
bool SetMoi (const Matrix3< T > &_moi)
 Sets Moments of Inertia (MOI) from a Matrix3. Symmetric component of input matrix is used by averaging off-axis terms. More...
 
bool SetOffDiagonalMoments (const Vector3< T > &_ixyxzyz)
 Set the off-diagonal moments of inertia (Ixy, Ixz, Iyz). More...
 

Static Public Member Functions

static T Epsilon (const Vector3< T > &_moments, const T _tolerance=IGN_MASSMATRIX3_DEFAULT_TOLERANCE< T >)
 Get an epsilon value that represents the amount of acceptable error in a MassMatrix3. The epsilon value is related to machine precision multiplied by the largest possible moment of inertia. More...
 
static bool ValidMoments (const Vector3< T > &_moments, const T _tolerance=IGN_MASSMATRIX3_DEFAULT_TOLERANCE< T >)
 Verify that principal moments are positive and satisfy the triangle inequality. More...
 

Public Attributes

bool const T_ixx
 Set the moment of inertia matrix. More...
 
bool const Vector3< T > & _ixxyyzz
 Set the diagonal moments of inertia (Ixx, Iyy, Izz). More...
 
bool const T const T const T const T_ixy
 
bool const Vector3< T > & _ixyxzyz
 Set the off-diagonal moments of inertia (Ixy, Ixz, Iyz). More...
 
bool const T const T const T const T const T_ixz
 
bool const T const T_iyy
 
bool const T const T const T const T const T const T_iyz
 
bool const T const T const T_izz
 
 bool
 Set the mass. More...
 
 Matrix3< T >
 returns Moments of Inertia as a Matrix3 More...
 
 T
 Get IXX. More...
 

Detailed Description

template<typename T>
class ignition::math::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]

MassMatrix3 ( )
inline

Default Constructor, which inializes the mass and moments to zero.

◆ MassMatrix3() [2/3]

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]

MassMatrix3 ( const MassMatrix3< T > &  _m)
inline

Copy constructor.

Parameters
[in]_mMassMatrix3 element to copy

◆ ~MassMatrix3()

virtual ~MassMatrix3 ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ DiagonalMoments()

Vector3<T> DiagonalMoments ( ) const
inline

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

Returns
The diagonal moments.

Referenced by MassMatrix3< T >::Epsilon(), MassMatrix3< T >::operator=(), and MassMatrix3< T >::operator==().

◆ Epsilon() [1/2]

T Epsilon ( const T  _tolerance = IGN_MASSMATRIX3_DEFAULT_TOLERANCE<T>) const
inline

Get an epsilon value that represents the amount of acceptable error in a MassMatrix3. The epsilon value is related to machine precision multiplied by the largest possible moment of inertia.

Parameters
[in]_toleranceA factor that is used to adjust the return value. A value of zero will cause the return value to be zero. A good value is 10, which is also the MASSMATRIX3_DEFAULT_TOLERANCE.

References MassMatrix3< T >::DiagonalMoments().

Referenced by MassMatrix3< T >::IsNearPositive(), MassMatrix3< T >::IsPositive(), and MassMatrix3< T >::ValidMoments().

◆ Epsilon() [2/2]

static T Epsilon ( const Vector3< T > &  _moments,
const T  _tolerance = IGN_MASSMATRIX3_DEFAULT_TOLERANCE<T> 
)
inlinestatic

Get an epsilon value that represents the amount of acceptable error in a MassMatrix3. The epsilon value is related to machine precision multiplied by the largest possible moment of inertia.

This function is used by IsValid(), IsNearPositive(), IsPositive(), and ValidMoments().

Parameters
[in]_momentsPrincipal moments of inertia.
[in]_toleranceA factor that is used to adjust the return value. A value of zero will cause the return value to be zero. A good value is 10, which is also the MASSMATRIX3_DEFAULT_TOLERANCE.
Returns
The epsilon value computed using:
T maxPossibleMoI = 0.5 * std::abs(_moments.Sum());
return _tolerance *
std::numeric_limits<T>::epsilon() * maxPossibleMoI;

References numeric_limits::epsilon(), Vector3< T >::Sum(), and MassMatrix3< T >::T.

◆ EquivalentBox()

bool 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 MassMatrix3< T >::IsPositive(), MassMatrix3< T >::PrincipalAxesOffset(), MassMatrix3< T >::PrincipalMoments(), MassMatrix3< T >::ValidMoments(), Vector3< T >::X(), Vector3< T >::Y(), and Vector3< T >::Z().

◆ IsNearPositive()

bool IsNearPositive ( const T  _tolerance = IGN_MASSMATRIX3_DEFAULT_TOLERANCE<T>) const
inline

Verify that inertia values are positive semidefinite.

Parameters
[in]_toleranceThe amount of relative error to accept when checking whether this MassMatrix3 has a valid mass and moment of inertia. Refer to Epsilon() for a description of _tolerance.
Returns
True if mass is nonnegative and moment of inertia matrix is positive semidefinite. The following is how the return value is calculated
const T epsilon = this->Epsilon(_tolerance);
return (this->mass + epsilon >= 0) &&
(this->IXX() + epsilon >= 0) &&
(this->IXX() * this->IYY() - std::pow(this->IXY(), 2) +
epsilon >= 0) &&
(this->Moi().Determinant() + epsilon >= 0);

References MassMatrix3< T >::Epsilon(), MassMatrix3< T >::Ixx(), MassMatrix3< T >::Ixy(), MassMatrix3< T >::Iyy(), MassMatrix3< T >::Moi(), std::pow(), and MassMatrix3< T >::T.

Referenced by MassMatrix3< T >::IsValid().

◆ IsPositive()

bool IsPositive ( const T  _tolerance = IGN_MASSMATRIX3_DEFAULT_TOLERANCE<T>) const
inline

Verify that inertia values are positive definite.

Parameters
[in]_toleranceThe amount of error to accept when checking whether this MassMatrix3 has a valid mass and moment of inertia. Refer to Epsilon() for a description of _tolerance.
Returns
True if mass is positive and moment of inertia matrix is positive definite. The following is how the return value is calculated
const T epsilon = this->Epsilon(_tolerance);
return (this->mass + epsilon > 0) &&
(this->IXX() + epsilon > 0) &&
(this->IXX() * this->IYY() - std::pow(this->IXY(), 2) +
epsilon > 0) &&
(this->Moi().Determinant() + epsilon > 0);

References MassMatrix3< T >::Epsilon(), MassMatrix3< T >::Ixx(), MassMatrix3< T >::Ixy(), MassMatrix3< T >::Iyy(), MassMatrix3< T >::Moi(), std::pow(), and MassMatrix3< T >::T.

Referenced by MassMatrix3< T >::EquivalentBox().

◆ IsValid()

bool IsValid ( const T  _tolerance = IGN_MASSMATRIX3_DEFAULT_TOLERANCE<T>) const
inline

Verify that inertia values are positive semi-definite and satisfy the triangle inequality.

Parameters
[in]_toleranceThe amount of error to accept when checking whether the MassMatrix3 has a valid mass and moment of inertia. This value is passed on to IsNearPositive() and ValidMoments(), which in turn pass the tolerance value to Epsilon(). Refer to Epsilon() for a description of _tolerance.
Returns
True if IsNearPositive(_tolerance) and ValidMoments(this->PrincipalMoments(), _tolerance) both return true.

References MassMatrix3< T >::IsNearPositive(), MassMatrix3< T >::PrincipalMoments(), and MassMatrix3< T >::ValidMoments().

Referenced by MassMatrix3< T >::SetDiagonalMoments(), MassMatrix3< T >::SetInertiaMatrix(), MassMatrix3< T >::SetIxx(), MassMatrix3< T >::SetIxy(), MassMatrix3< T >::SetIxz(), MassMatrix3< T >::SetIyy(), MassMatrix3< T >::SetIyz(), MassMatrix3< T >::SetIzz(), MassMatrix3< T >::SetMass(), MassMatrix3< T >::SetMoi(), and MassMatrix3< T >::SetOffDiagonalMoments().

◆ Ixx()

T Ixx ( ) const
inline

◆ Ixy()

T Ixy ( ) const
inline

◆ Ixz()

T Ixz ( ) const
inline

Get IXZ.

Returns
IXZ value

References MassMatrix3< T >::Iyz(), and MassMatrix3< T >::T.

Referenced by MassMatrix3< T >::Ixy().

◆ Iyy()

T Iyy ( ) const
inline

◆ Iyz()

T Iyz ( ) const
inline

Get IYZ.

Returns
IYZ value

References MassMatrix3< T >::SetIxx().

Referenced by MassMatrix3< T >::Ixz().

◆ Izz()

T Izz ( ) const
inline

Get IZZ.

Returns
IZZ value

References MassMatrix3< T >::Ixy(), and MassMatrix3< T >::T.

Referenced by MassMatrix3< T >::Iyy().

◆ Mass()

◆ Moi()

Matrix3<T> Moi ( ) const
inline

returns Moments of Inertia as a Matrix3

Returns
Moments of Inertia as a Matrix3

References MassMatrix3< T >::SetMoi().

Referenced by MassMatrix3< T >::IsNearPositive(), and MassMatrix3< T >::IsPositive().

◆ OffDiagonalMoments()

Vector3<T> OffDiagonalMoments ( ) const
inline

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

Returns
The off-diagonal moments of inertia.

References MassMatrix3< T >::_ixxyyzz.

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

◆ operator!=()

bool 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=()

MassMatrix3& operator= ( const MassMatrix3< T > &  _massMatrix)
inline

Equal operator.

Parameters
[in]_massMatrixMassMatrix3 to copy.
Returns
Reference to this object.

References MassMatrix3< T >::DiagonalMoments(), MassMatrix3< T >::Mass(), and MassMatrix3< T >::OffDiagonalMoments().

◆ operator==()

bool operator== ( const MassMatrix3< T > &  _m) const
inline

Equality comparison operator.

Parameters
[in]_mMassMatrix3 to copy.
Returns
true if each component is equal within a default tolerance, false otherwise

References MassMatrix3< T >::DiagonalMoments(), MassMatrix3< T >::Mass(), and MassMatrix3< T >::OffDiagonalMoments().

◆ PrincipalAxesOffset()

Quaternion<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 Vector3< T >::Equal(), IGN_PI_2, Vector2< T >::Normalize(), Angle::Normalize(), std::pow(), MassMatrix3< T >::PrincipalMoments(), Angle::Radian(), Vector2< T >::Set(), Vector2< T >::SquaredLength(), and MassMatrix3< T >::T.

Referenced by MassMatrix3< T >::EquivalentBox().

◆ PrincipalMoments()

Vector3<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 IGN_PI, std::pow(), ignition::math::sort3(), Vector3< T >::Sum(), and MassMatrix3< T >::T.

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

◆ SetDiagonalMoments()

bool SetDiagonalMoments ( 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 MassMatrix3< T >::_ixxyyzz, MassMatrix3< T >::_ixyxzyz, and MassMatrix3< T >::IsValid().

◆ SetFromBox() [1/3]

bool SetFromBox ( const Material _mat,
const Vector3< T > &  _size,
const Quaternion< T > &  _rot = Quaternion<T>::Identity 
)
inline

Set inertial properties based on a Material and equivalent box.

Parameters
[in]_matMaterial that specifies a density. Uniform density is used.
[in]_sizeSize of equivalent box.
[in]_rotRotational offset of equivalent box.
Returns
True if inertial properties were set successfully.

References Material::Density(), MassMatrix3< T >::T, Vector3< T >::X(), Vector3< T >::Y(), and Vector3< T >::Z().

Referenced by OrientedBox< T >::MassMatrix(), and MassMatrix3< T >::SetFromBox().

◆ SetFromBox() [2/3]

bool 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 Vector3< T >::Min(), MassMatrix3< T >::SetFromBox(), and MassMatrix3< T >::SetMass().

◆ SetFromBox() [3/3]

bool SetFromBox ( const Vector3< T > &  _size,
const Quaternion< T > &  _rot = Quaternion<T>::Identity 
)
inline

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

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

References MassMatrix3< T >::Mass(), Vector3< T >::Min(), std::pow(), MassMatrix3< T >::SetMoi(), MassMatrix3< T >::T, Matrix3< T >::Transposed(), Vector3< T >::X(), Vector3< T >::Y(), and Vector3< T >::Z().

◆ SetFromCylinderZ() [1/3]

bool SetFromCylinderZ ( const Material _mat,
const T  _length,
const T  _radius,
const Quaternion< T > &  _rot = Quaternion<T>::Identity 
)
inline

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

Parameters
[in]_matMaterial that specifies a density. Uniform density is used.
[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 Material::Density(), IGN_PI, and MassMatrix3< T >::T.

Referenced by MassMatrix3< T >::SetFromCylinderZ().

◆ SetFromCylinderZ() [2/3]

bool 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 MassMatrix3< T >::SetFromCylinderZ(), and MassMatrix3< T >::SetMass().

◆ SetFromCylinderZ() [3/3]

bool 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 MassMatrix3< T >::Mass(), std::pow(), MassMatrix3< T >::SetMoi(), MassMatrix3< T >::T, and Matrix3< T >::Transposed().

◆ SetFromSphere() [1/3]

bool SetFromSphere ( const Material _mat,
const T  _radius 
)
inline

Set inertial properties based on a material and equivalent sphere.

Parameters
[in]_matMaterial that specifies a density. Uniform density is used.
[in]_radiusRadius of equivalent, uniform sphere.
Returns
True if inertial properties were set successfully.

References Material::Density(), IGN_PI, std::pow(), and MassMatrix3< T >::T.

Referenced by MassMatrix3< T >::SetFromSphere().

◆ SetFromSphere() [2/3]

bool 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 MassMatrix3< T >::SetFromSphere(), and MassMatrix3< T >::SetMass().

◆ SetFromSphere() [3/3]

bool 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 MassMatrix3< T >::Mass(), std::pow(), MassMatrix3< T >::SetMoi(), Vector2< T >::SquaredLength(), and MassMatrix3< T >::T.

◆ SetInertiaMatrix()

bool SetInertiaMatrix ( 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 MassMatrix3< T >::IsValid().

◆ SetIxx()

bool SetIxx ( const T _v)
inline

Set IXX.

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

References MassMatrix3< T >::IsValid(), and MassMatrix3< T >::SetIyy().

Referenced by MassMatrix3< T >::Iyz().

◆ SetIxy()

bool SetIxy ( const T _v)
inline

Set IXY.

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

References MassMatrix3< T >::IsValid(), and MassMatrix3< T >::SetIxz().

Referenced by MassMatrix3< T >::SetIzz().

◆ SetIxz()

bool SetIxz ( const T _v)
inline

Set IXZ.

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

References MassMatrix3< T >::IsValid(), and MassMatrix3< T >::SetIyz().

Referenced by MassMatrix3< T >::SetIxy().

◆ SetIyy()

bool SetIyy ( const T _v)
inline

Set IYY.

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

References MassMatrix3< T >::IsValid(), and MassMatrix3< T >::SetIzz().

Referenced by MassMatrix3< T >::SetIxx().

◆ SetIyz()

bool SetIyz ( const T _v)
inline

Set IYZ.

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

References MassMatrix3< T >::IsValid().

Referenced by MassMatrix3< T >::SetIxz().

◆ SetIzz()

bool SetIzz ( const T _v)
inline

Set IZZ.

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

References MassMatrix3< T >::IsValid(), and MassMatrix3< T >::SetIxy().

Referenced by MassMatrix3< T >::SetIyy().

◆ SetMass()

bool SetMass ( const T _m)
inline

Set the mass.

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

References MassMatrix3< T >::IsValid().

Referenced by MassMatrix3< T >::SetFromBox(), MassMatrix3< T >::SetFromCylinderZ(), and MassMatrix3< T >::SetFromSphere().

◆ SetMoi()

bool SetMoi ( 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]_moiMoments of Inertia as a Matrix3
Returns
True if the MassMatrix3 is valid.

References MassMatrix3< T >::IsValid().

Referenced by MassMatrix3< T >::Moi(), MassMatrix3< T >::SetFromBox(), MassMatrix3< T >::SetFromCylinderZ(), and MassMatrix3< T >::SetFromSphere().

◆ SetOffDiagonalMoments()

bool SetOffDiagonalMoments ( 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 MassMatrix3< T >::_ixyxzyz, MassMatrix3< T >::IsValid(), and MassMatrix3< T >::T.

◆ ValidMoments()

static bool ValidMoments ( const Vector3< T > &  _moments,
const T  _tolerance = IGN_MASSMATRIX3_DEFAULT_TOLERANCE<T> 
)
inlinestatic

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

Parameters
[in]_momentsPrincipal moments of inertia.
[in]_toleranceThe amount of error to accept when checking whether the moments are positive and satisfy the triangle inequality. Refer to Epsilon() for a description of _tolerance.
Returns
True if moments of inertia are positive and satisfy the triangle inequality. The following is how the return value is calculated.
T epsilon = this->Epsilon(_tolerance);
return _moments[0] + epsilon >= 0 &&
_moments[1] + epsilon >= 0 &&
_moments[2] + epsilon >= 0 &&
_moments[0] + _moments[1] + epsilon >= _moments[2] &&
_moments[1] + _moments[2] + epsilon >= _moments[0] &&
_moments[2] + _moments[0] + epsilon >= _moments[1];

References MassMatrix3< T >::Epsilon(), and MassMatrix3< T >::T.

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

Member Data Documentation

◆ _ixx

bool const T& _ixx

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.
Deprecated:
see bool SetInertiaMatrix(const T &, const T &, const T &, const T &, const T &, const T &)

◆ _ixxyyzz

bool const Vector3<T>& _ixxyyzz
Initial value:

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

Parameters
[in]_ixxyyzzdiagonal moments of inertia
Returns
True if the MassMatrix3 is valid.
Deprecated:
See bool SetDiagonalMoments(const Vector3<T> &_ixxyyzz)

Referenced by MassMatrix3< T >::OffDiagonalMoments(), and MassMatrix3< T >::SetDiagonalMoments().

◆ _ixy

bool const T const T const T const T& _ixy

◆ _ixyxzyz

bool const Vector3<T>& _ixyxzyz
Initial value:

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

Parameters
[in]_ixyxzyzoff-diagonal moments of inertia
Returns
True if the MassMatrix3 is valid.
Deprecated:
See bool SetOffDiagonalMoments(const Vector3<T> &_ixyxzyz)

Referenced by MassMatrix3< T >::SetDiagonalMoments(), and MassMatrix3< T >::SetOffDiagonalMoments().

◆ _ixz

bool const T const T const T const T const T& _ixz

◆ _iyy

bool const T const T& _iyy

◆ _iyz

bool const T const T const T const T const T const T& _iyz
Initial value:
{

◆ _izz

bool const T const T const T& _izz

◆ bool

bool
Initial value:
{
return this->SetMass(_m)

Set the mass.

Sets Moments of Inertia (MOI) from a Matrix3. Symmetric component of input matrix is used by averaging off-axis terms.

Set IYZ.

Set IXZ.

Set IXY.

Set IZZ.

Set IYY.

Set IXX.

Parameters
[in]_mNew mass value.
Returns
True if the MassMatrix3 is valid.
Deprecated:
bool SetMass(const T &_m)
Parameters
[in]_vIXX value
Returns
True if the MassMatrix3 is valid.
Deprecated:
See bool SetIxx(const T &_v)
Parameters
[in]_vIYY value
Returns
True if the MassMatrix3 is valid.
Deprecated:
see bool SetIyy(const T &_v)
Parameters
[in]_vIZZ value
Returns
True if the MassMatrix3 is valid.
Deprecated:
See bool SetIzz(const T &_v)
Parameters
[in]_vIXY value
Returns
True if the MassMatrix3 is valid.
Deprecated:
See bool SetIxy(const T &_v)
Parameters
[in]_vIXZ value
Returns
True if the MassMatrix3 is valid.
Deprecated:
See bool SetIxz(const T &_v)
Parameters
[in]_vIYZ value
Returns
True if the MassMatrix3 is valid.
Deprecated:
See bool SetIyz(const T &_v)
Parameters
[in]Momentsof Inertia as a Matrix3
Returns
True if the MassMatrix3 is valid.
Deprecated:
See SetMoi(const Matrix3<T> &_moi)

◆ Matrix3< T >

Matrix3< T >
Initial value:
{
return this->Moi()

returns Moments of Inertia as a Matrix3

Returns
Moments of Inertia as a Matrix3
Deprecated:
See Matrix3<T> Moi() const

◆ T


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