Simbody  3.6
SimTK::MassProperties_< P > Class Template Reference

This class contains the mass, center of mass, and unit inertia matrix of a rigid body B. More...

## Public Member Functions

MassProperties_ ()
Create a mass properties object in which the mass, mass center, and inertia are meaningless; you must assign values before using this. More...

MassProperties_ (const P &m, const Vec< 3, P > &com, const Inertia_< P > &inertia)
Create a mass properties object from individually supplied mass, mass center, and inertia matrix. More...

MassProperties_ (const P &m, const Vec< 3, P > &com, const UnitInertia_< P > &gyration)
Create a mass properties object from individually supplied mass, mass center, and unit inertia (gyration) matrix. More...

MassProperties_setMassProperties (const P &m, const Vec< 3, P > &com, const Inertia_< P > &inertia)
Set mass, center of mass, and inertia. More...

MassProperties_setMassProperties (const P &m, const Vec< 3, P > &com, const UnitInertia_< P > &gyration)
Set mass, center of mass, and unit inertia. More...

const P & getMass () const
Return the mass currently stored in this MassProperties object. More...

const Vec< 3, P > & getMassCenter () const
Return the mass center currently stored in this MassProperties object; this is expressed in an implicit frame we call "B", and measured from B's origin, but you have to know what that frame is in order to interpret the returned vector. More...

const UnitInertia_< P > & getUnitInertia () const
Return the unit inertia currently stored in this MassProperties object; this is expressed in an implicit frame we call "B", and measured about B's origin, but you have to know what that frame is in order to interpret the returned value correctly. More...

const Inertia_< P > calcInertia () const
Return the inertia matrix for this MassProperties object; this is equal to the unit inertia times the mass and costs 6 flops. More...

const Inertia_< P > getInertia () const
OBSOLETE – this is just here for compatibility with 2.2; since the UnitInertia is stored now the full inertia must be calculated at a cost of 6 flops, hence the method name should be calcInertia() and that's what you should use unless you want getUnitInertia(). More...

Inertia_< P > calcCentralInertia () const
Return the inertia of this MassProperties object, but measured about the mass center rather than about the (implicit) B frame origin. More...

Inertia_< P > calcShiftedInertia (const Vec< 3, P > &newOriginB) const
Return the inertia of this MassProperties object, but with the "measured about" point shifted from the (implicit) B frame origin to a new point that is supplied in newOriginB which must be a vector measured from the B frame origin and expressed in B. More...

Inertia_< P > calcTransformedInertia (const Transform_< P > &X_BC) const
Return the inertia of this MassProperties object, but transformed to from the implicit B frame to a new frame C whose pose relative to B is supplied. More...

MassProperties_ calcShiftedMassProps (const Vec< 3, P > &newOriginB) const
Return a new MassProperties object that is the same as this one but with the origin point shifted from the (implicit) B frame origin to a new point that is supplied in newOriginB which must be a vector measured from the B frame origin and expressed in B. More...

MassProperties_ calcTransformedMassProps (const Transform_< P > &X_BC) const
Transform these mass properties from the current frame "B" to a new frame "C", given the pose of C in B. Caution: this shifts the point from which the mass properties are measured from the origin of B to the origin of C. More...

MassProperties_ reexpress (const Rotation_< P > &R_BC) const
Re-express these mass properties from the current frame "B" to a new frame "C", given the orientation of C in B. Caution: this does not shift the point from which the mass properties are measured, it just uses a different frame to express that measurement. More...

bool isExactlyMassless () const
Return true only if the mass stored here is exactly zero. If the mass resulted from a computation, you should use isNearlyMassless() instead. More...

bool isNearlyMassless (const P &tol=SignificantReal) const
Return true if the mass stored here is zero to within a small tolerance. More...

bool isExactlyCentral () const
Return true only if the mass center stored here is exactly zero. If the mass center resulted from a computation, you should use isNearlyCentral() instead. More...

bool isNearlyCentral (const P &tol=SignificantReal) const
Return true if the mass center stored here is zero to within a small tolerance. More...

bool isNaN () const
Return true if any element of this MassProperties object is NaN. More...

bool isInf () const
Return true only if there are no NaN's in this MassProperties object, and at least one of the elements is Infinity. Ground's mass properties satisfy these conditions. More...

bool isFinite () const
Return true if none of the elements of this MassProperties object are NaN or Infinity. Note that Ground's mass properties are not finite. More...

Mat< 2, 2, Mat< 3, 3, P > > toSpatialMat () const
Convert this MassProperties object to a spatial inertia matrix and return it as a SpatialMat, which is a 2x2 matrix of 3x3 submatrices. More...

Mat< 6, 6, P > toMat66 () const
Convert this MassProperties object to a spatial inertia matrix in the form of an ordinary 6x6 matrix, not a SpatialMat. More...

## Related Functions

(Note that these are not member functions.)

template<class P >
static std::ostream & operator<< (std::ostream &o, const MassProperties_< P > &mp)
Output a human-readable representation of a MassProperties object to the given output stream. More...

## Detailed Description

### template<class P> class SimTK::MassProperties_< P >

This class contains the mass, center of mass, and unit inertia matrix of a rigid body B.

The center of mass is a vector from B's origin, expressed in the B frame. The inertia is taken about the B origin, and expressed in B. The frame B is implicit; only the measurements are stored here. The unit inertia can be multiplied by the mass to get the inertia matrix for the body.

### Abbreviations

Typedefs exist for the most common invocations of MassProperties_<P>:

## ◆ MassProperties_() [1/3]

template<class P >
 SimTK::MassProperties_< P >::MassProperties_ ( )
inline

Create a mass properties object in which the mass, mass center, and inertia are meaningless; you must assign values before using this.

## ◆ MassProperties_() [2/3]

template<class P >
 SimTK::MassProperties_< P >::MassProperties_ ( const P & m, const Vec< 3, P > & com, const Inertia_< P > & inertia )
inline

Create a mass properties object from individually supplied mass, mass center, and inertia matrix.

The inertia matrix is divided by the mass to produce the unit inertia.

## ◆ MassProperties_() [3/3]

template<class P >
 SimTK::MassProperties_< P >::MassProperties_ ( const P & m, const Vec< 3, P > & com, const UnitInertia_< P > & gyration )
inline

Create a mass properties object from individually supplied mass, mass center, and unit inertia (gyration) matrix.

## ◆ setMassProperties() [1/2]

template<class P >
 MassProperties_& SimTK::MassProperties_< P >::setMassProperties ( const P & m, const Vec< 3, P > & com, const Inertia_< P > & inertia )
inline

Set mass, center of mass, and inertia.

The inertia is divided by the mass to produce the unit inertia. Behaves like an assignment in that a reference to the modified MassProperties object is returned.

## ◆ setMassProperties() [2/2]

template<class P >
 MassProperties_& SimTK::MassProperties_< P >::setMassProperties ( const P & m, const Vec< 3, P > & com, const UnitInertia_< P > & gyration )
inline

Set mass, center of mass, and unit inertia.

Behaves like an assignment in that a reference to the modified MassProperties object is returned.

## ◆ getMass()

template<class P >
 const P& SimTK::MassProperties_< P >::getMass ( ) const
inline

Return the mass currently stored in this MassProperties object.

## ◆ getMassCenter()

template<class P >
 const Vec<3,P>& SimTK::MassProperties_< P >::getMassCenter ( ) const
inline

Return the mass center currently stored in this MassProperties object; this is expressed in an implicit frame we call "B", and measured from B's origin, but you have to know what that frame is in order to interpret the returned vector.

## ◆ getUnitInertia()

template<class P >
 const UnitInertia_

& SimTK::MassProperties_< P >::getUnitInertia ( ) const

inline

Return the unit inertia currently stored in this MassProperties object; this is expressed in an implicit frame we call "B", and measured about B's origin, but you have to know what that frame is in order to interpret the returned value correctly.

## ◆ calcInertia()

template<class P >
 const Inertia_

SimTK::MassProperties_< P >::calcInertia ( ) const

inline

Return the inertia matrix for this MassProperties object; this is equal to the unit inertia times the mass and costs 6 flops.

It is expressed in an implicit frame we call "B", and measured about B's origin, but you have to know what that frame is in order to interpret the returned value correctly.

## ◆ getInertia()

template<class P >
 const Inertia_

SimTK::MassProperties_< P >::getInertia ( ) const

inline

OBSOLETE – this is just here for compatibility with 2.2; since the UnitInertia is stored now the full inertia must be calculated at a cost of 6 flops, hence the method name should be calcInertia() and that's what you should use unless you want getUnitInertia().

## ◆ calcCentralInertia()

template<class P >
 Inertia_

SimTK::MassProperties_< P >::calcCentralInertia ( ) const

inline

Return the inertia of this MassProperties object, but measured about the mass center rather than about the (implicit) B frame origin.

The result is still expressed in B.

## ◆ calcShiftedInertia()

template<class P >
 Inertia_

SimTK::MassProperties_< P >::calcShiftedInertia ( const Vec< 3, P > & newOriginB ) const

inline

Return the inertia of this MassProperties object, but with the "measured about" point shifted from the (implicit) B frame origin to a new point that is supplied in newOriginB which must be a vector measured from the B frame origin and expressed in B.

The result is still expressed in B.

## ◆ calcTransformedInertia()

template<class P >
 Inertia_

SimTK::MassProperties_< P >::calcTransformedInertia ( const Transform_< P > & X_BC ) const

inline

Return the inertia of this MassProperties object, but transformed to from the implicit B frame to a new frame C whose pose relative to B is supplied.

Note that this affects both the "measured about" point and the "expressed in" frame.

## ◆ calcShiftedMassProps()

template<class P >
 MassProperties_ SimTK::MassProperties_< P >::calcShiftedMassProps ( const Vec< 3, P > & newOriginB ) const
inline

Return a new MassProperties object that is the same as this one but with the origin point shifted from the (implicit) B frame origin to a new point that is supplied in newOriginB which must be a vector measured from the B frame origin and expressed in B.

This affects both the mass center vector and the inertia. The result is still expressed in B.

## ◆ calcTransformedMassProps()

template<class P >
 MassProperties_ SimTK::MassProperties_< P >::calcTransformedMassProps ( const Transform_< P > & X_BC ) const
inline

Transform these mass properties from the current frame "B" to a new frame "C", given the pose of C in B. Caution: this shifts the point from which the mass properties are measured from the origin of B to the origin of C.

See reexpress() to change only the measure numbers without moving the "measured from" point. Note that the frame in which a MassProperties object is expressed, and the point about which the mass properties are measured, are implicit; we don't actually have any way to verify that it is in B. Make sure you are certain about the current frame before using this method.

## ◆ reexpress()

template<class P >
 MassProperties_ SimTK::MassProperties_< P >::reexpress ( const Rotation_< P > & R_BC ) const
inline

Re-express these mass properties from the current frame "B" to a new frame "C", given the orientation of C in B. Caution: this does not shift the point from which the mass properties are measured, it just uses a different frame to express that measurement.

See calcTransformedMassProps() to perform a shift as well. Note that the frame in which a MassProperties object is expressed is implicit; we don't actually have any way to verify that it is in B. Make sure you are certain about the current frame before using this method.

## ◆ isExactlyMassless()

template<class P >
 bool SimTK::MassProperties_< P >::isExactlyMassless ( ) const
inline

Return true only if the mass stored here is exactly zero. If the mass resulted from a computation, you should use isNearlyMassless() instead.

isNearlyMassless(), isExactlyCentral()

## ◆ isNearlyMassless()

template<class P >
 bool SimTK::MassProperties_< P >::isNearlyMassless ( const P & tol = `SignificantReal` ) const
inline

Return true if the mass stored here is zero to within a small tolerance.

By default we use SignificantReal (about 1e-14 in double precision) as the tolerance but you can override that. If you are just checking to see whether the mass was explicitly set to zero (rather than calculated) you can use isExactlyMassless() instead.

isExactlyMassless(), isNearlyCentral()

## ◆ isExactlyCentral()

template<class P >
 bool SimTK::MassProperties_< P >::isExactlyCentral ( ) const
inline

Return true only if the mass center stored here is exactly zero. If the mass center resulted from a computation, you should use isNearlyCentral() instead.

isNearlyCentral(), isExactlyMassless()

## ◆ isNearlyCentral()

template<class P >
 bool SimTK::MassProperties_< P >::isNearlyCentral ( const P & tol = `SignificantReal` ) const
inline

Return true if the mass center stored here is zero to within a small tolerance.

By default we use SignificantReal (about 1e-14 in double precision) as the tolerance but you can override that. If you are just checking to see whether the mass center was explicitly set to zero (rather than calculated) you can use isExactlyCentral() instead.

isExactlyCentral(), isNearlyMassless()

## ◆ isNaN()

template<class P >
 bool SimTK::MassProperties_< P >::isNaN ( ) const
inline

Return true if any element of this MassProperties object is NaN.

isInf(), isFinite()

## ◆ isInf()

template<class P >
 bool SimTK::MassProperties_< P >::isInf ( ) const
inline

Return true only if there are no NaN's in this MassProperties object, and at least one of the elements is Infinity. Ground's mass properties satisfy these conditions.

isNan(), isFinite()

## ◆ isFinite()

template<class P >
 bool SimTK::MassProperties_< P >::isFinite ( ) const
inline

Return true if none of the elements of this MassProperties object are NaN or Infinity. Note that Ground's mass properties are not finite.

isNaN(), isInf()

## ◆ toSpatialMat()

template<class P >
 Mat<2,2,Mat<3,3,P> > SimTK::MassProperties_< P >::toSpatialMat ( ) const
inline

Convert this MassProperties object to a spatial inertia matrix and return it as a SpatialMat, which is a 2x2 matrix of 3x3 submatrices.

toMat66()

## ◆ toMat66()

template<class P >
 Mat<6,6,P> SimTK::MassProperties_< P >::toMat66 ( ) const
inline

Convert this MassProperties object to a spatial inertia matrix in the form of an ordinary 6x6 matrix, not a SpatialMat.

Logically these are the same but the ordering of the elements in memory is different between a Mat66 and SpatialMat.

toSpatialMat()

## ◆ operator<<()

template<class P >
 static std::ostream & operator<< ( std::ostream & o, const MassProperties_< P > & mp )
related

Output a human-readable representation of a MassProperties object to the given output stream.

This is assumed to be the mass properties of some body B. We'll show B's mass, center of mass as a vector from B's origin, expressed in B, and unit inertia, abbreviated Uxx, Uyy, and so on so that you won't accidentally think these are mass-scaled inertias normally designated Ixx, Iyy, etc. Note that I=mass*U in these terms. Also note that the unit inertia is taken about the body frame origin, not about the center of mass. And of course the unit inertia is expressed in B.

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