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. | |
T | IXX () const |
Get IXX. | |
bool | IXX (const T &_v) |
Set IXX. | |
T | IXY () const |
Get IXY. | |
bool | IXY (const T &_v) |
Set IXY. | |
T | IXZ () const |
Get IXZ. | |
bool | IXZ (const T &_v) |
Set IXZ. | |
T | IYY () const |
Get IYY. | |
bool | IYY (const T &_v) |
Set IYY. | |
T | IYZ () const |
Get IYZ. | |
bool | IYZ (const T &_v) |
Set IYZ. | |
T | IZZ () const |
Get IZZ. | |
bool | IZZ (const T &_v) |
Set IZZ. | |
T | 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. | |
MassMatrix3 & | operator= (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. | |
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.
|
inline |
Default Constructor.
|
inline |
Constructor.
[in] | _mass | Mass value in kg if using metric. |
[in] | _ixxyyzz | Diagonal moments of inertia. |
[in] | _ixyxzyz | Off-diagonal moments of inertia |
|
inline |
Copy constructor.
[in] | _massMatrix | MassMatrix3 element to copy |
|
inlinevirtual |
Destructor.
|
inline |
Get the diagonal moments of inertia (Ixx, Iyy, Izz).
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::operator=(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::operator==().
|
inline |
Set the diagonal moments of inertia (Ixx, Iyy, Izz).
[in] | _ixxyyzz | diagonal moments of inertia |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().
|
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.
[in] | _size | Dimensions of box aligned with principal axes. |
[in] | _rot | Rotational offset of principal axes. |
[in] | _tol | Relative tolerance. |
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().
|
inline |
Set the moment of inertia matrix.
[in] | _ixx | X second moment of inertia (MOI) about x axis. |
[in] | _iyy | Y second moment of inertia about y axis. |
[in] | _izz | Z second moment of inertia about z axis. |
[in] | _ixy | XY inertia. |
[in] | _ixz | XZ inertia. |
[in] | _iyz | YZ inertia. |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().
|
inline |
Verify that inertia values are positive definite.
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IXX(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IXY(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IYY(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::MOI().
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::EquivalentBox(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().
|
inline |
Verify that inertia values are positive definite and satisfy the triangle inequality.
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsPositive(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::PrincipalMoments(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::ValidMoments().
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::DiagonalMoments(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::InertiaMatrix(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IXX(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IXY(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IXZ(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IYY(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IYZ(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IZZ(), 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::MassMatrix3< T >::OffDiagonalMoments().
|
inline |
Get IXX.
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsPositive().
|
inline |
Set IXX.
[in] | _v | IXX value |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().
|
inline |
Get IXY.
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsPositive().
|
inline |
Set IXY.
[in] | _v | IXY value |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().
|
inline |
Get IXZ.
|
inline |
Set IXZ.
[in] | _v | IXZ value |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().
|
inline |
Get IYY.
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsPositive().
|
inline |
Set IYY.
[in] | _v | IYY value |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().
|
inline |
Get IYZ.
|
inline |
Set IYZ.
[in] | _v | IYZ value |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().
|
inline |
Get IZZ.
|
inline |
Set IZZ.
[in] | _v | IZZ value |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().
|
inline |
Get the mass.
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::SetFromBox(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::SetFromBox(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::SetFromCylinderZ(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::SetFromCylinderZ(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::SetFromSphere(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::SetFromSphere().
|
inline |
Set the mass.
[in] | _m | New mass value. |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::operator=(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::operator==().
|
inline |
returns Moments of Inertia as a Matrix3
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsPositive(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::SetFromBox(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::SetFromCylinderZ(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::SetFromSphere().
|
inline |
Sets Moments of Inertia (MOI) from a Matrix3.
Symmetric component of input matrix is used by averaging off-axis terms.
[in] | Moments | of Inertia as a Matrix3 |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().
|
inline |
Get the off-diagonal moments of inertia (Ixy, Ixz, Iyz).
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::operator=(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::operator==().
|
inline |
Set the off-diagonal moments of inertia (Ixy, Ixz, Iyz).
[in] | _ixyxzyz | off-diagonal moments of inertia |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().
|
inline |
Inequality test operator.
[in] | _m | MassMatrix3<T> to test |
|
inline |
Equal operator.
[in] | _massMatrix | MassMatrix3 to copy. |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::DiagonalMoments(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::Mass(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::OffDiagonalMoments().
|
inline |
Equality comparison operator.
[in] | _m | MassMatrix3 to copy. |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::DiagonalMoments(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::equal(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::Mass(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::OffDiagonalMoments().
|
inline |
Compute rotational offset of principal axes.
[in] | _tol | Relative 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. |
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().
|
inline |
Compute principal moments of inertia, which are the eigenvalues of the moment of inertia matrix.
[in] | _tol | Relative 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. |
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().
|
inline |
Set inertial properties based on mass and equivalent box.
[in] | _mass | Mass to set. |
[in] | _size | Size of equivalent box. |
[in] | _rot | Rotational offset of equivalent box. |
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().
|
inline |
Set inertial properties based on equivalent box using the current mass value.
[in] | _size | Size of equivalent box. |
[in] | _rot | Rotational offset of equivalent box. |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::Mass(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector3< T >::Min(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::MOI(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Transposed(), 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().
|
inline |
Set inertial properties based on equivalent cylinder aligned with Z axis using the current mass value.
[in] | _length | Length of cylinder along Z axis. |
[in] | _radius | Radius of cylinder. |
[in] | _rot | Rotational offset of equivalent cylinder. |
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().
|
inline |
Set inertial properties based on mass and equivalent cylinder aligned with Z axis.
[in] | _mass | Mass to set. |
[in] | _length | Length of cylinder along Z axis. |
[in] | _radius | Radius of cylinder. |
[in] | _rot | Rotational offset of equivalent cylinder. |
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().
|
inline |
Set inertial properties based on mass and equivalent sphere.
[in] | _mass | Mass to set. |
[in] | _radius | Radius of equivalent, uniform sphere. |
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().
|
inline |
Set inertial properties based on equivalent sphere using the current mass value.
[in] | _radius | Radius of equivalent, uniform sphere. |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::Mass(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::MOI().
|
inlinestatic |
Verify that principal moments are positive and satisfy the triangle inequality.
[in] | _moments | Principal moments of inertia. |
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::EquivalentBox(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::IsValid().