Simbody
Public Member Functions

SimTK::MassProperties_< P > Class Template Reference

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

#include <MassProperties.h>

List of all members.

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.
 MassProperties_ (const RealP &m, const Vec3P &com, const InertiaP &inertia)
 Create a mass properties object from individually supplied mass, mass center, and inertia matrix.
 MassProperties_ (const RealP &m, const Vec3P &com, const UnitInertiaP &gyration)
 Create a mass properties object from individually supplied mass, mass center, and unit inertia (gyration) matrix.
MassProperties_setMassProperties (const RealP &m, const Vec3P &com, const InertiaP &inertia)
 Set mass, center of mass, and inertia.
MassProperties_setMassProperties (const RealP &m, const Vec3P &com, const UnitInertiaP &gyration)
 Set mass, center of mass, and unit inertia, so that the actual inertia is the unit inertia multiplied by the mass.
const RealP & getMass () const
 Return the mass currently stored in this MassProperties object.
const Vec3PgetMassCenter () 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.
const InertiaPgetInertia () const
 Return the 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.
InertiaP calcCentralInertia () const
 Return the inertia of this MassProperties object, but measured about the mass center rather than about the (implicit) B frame origin.
InertiaP calcShiftedInertia (const Vec3P &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.
InertiaP calcTransformedInertia (const TransformP &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.
MassProperties_ calcShiftedMassProps (const Vec3P &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.
MassProperties_ calcTransformedMassProps (const TransformP &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.
MassProperties_ reexpress (const RotationP &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.
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.
bool isNearlyMassless (const RealP &tol=SignificantReal) const
 Return true if the mass stored here is zero to within a small tolerance.
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.
bool isNearlyCentral (const RealP &tol=SignificantReal) const
 Return true if the mass center stored here is zero to within a small tolerance.
bool isNaN () const
 Return true if any element of this MassProperties object is NaN.
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.
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.
SpatialMatP 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.
Mat66P toMat66 () const
 Convert this MassProperties object to a spatial inertia matrix in the form of an ordinary 6x6 matrix, not a SpatialMat.

Detailed Description

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

This class contains the mass, center of mass, and inertia 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.

Abbreviations

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


Constructor & Destructor Documentation

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.

template<class P >
SimTK::MassProperties_< P >::MassProperties_ ( const RealP &  m,
const Vec3P com,
const InertiaP inertia 
) [inline]

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

template<class P >
SimTK::MassProperties_< P >::MassProperties_ ( const RealP &  m,
const Vec3P com,
const UnitInertiaP gyration 
) [inline]

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

The actual inertia is the unit inertia multiplied by the mass.


Member Function Documentation

template<class P >
MassProperties_& SimTK::MassProperties_< P >::setMassProperties ( const RealP &  m,
const Vec3P com,
const InertiaP inertia 
) [inline]

Set mass, center of mass, and inertia.

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

template<class P >
MassProperties_& SimTK::MassProperties_< P >::setMassProperties ( const RealP &  m,
const Vec3P com,
const UnitInertiaP gyration 
) [inline]

Set mass, center of mass, and unit inertia, so that the actual inertia is the unit inertia multiplied by the mass.

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

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

Return the mass currently stored in this MassProperties object.

template<class P >
const Vec3P& 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.

template<class P >
const InertiaP& SimTK::MassProperties_< P >::getInertia ( ) const [inline]

Return the 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.

template<class P >
InertiaP 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.

template<class P >
InertiaP SimTK::MassProperties_< P >::calcShiftedInertia ( const Vec3P 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.

template<class P >
InertiaP SimTK::MassProperties_< P >::calcTransformedInertia ( const TransformP 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.

template<class P >
MassProperties_ SimTK::MassProperties_< P >::calcShiftedMassProps ( const Vec3P 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.

template<class P >
MassProperties_ SimTK::MassProperties_< P >::calcTransformedMassProps ( const TransformP 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.

template<class P >
MassProperties_ SimTK::MassProperties_< P >::reexpress ( const RotationP 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.

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.

See also:
isNearlyMassless(), isExactlyCentral()
template<class P >
bool SimTK::MassProperties_< P >::isNearlyMassless ( const RealP &  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.

See also:
isExactlyMassless(), isNearlyCentral()
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.

See also:
isNearlyCentral(), isExactlyMassless()
template<class P >
bool SimTK::MassProperties_< P >::isNearlyCentral ( const RealP &  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.

See also:
isExactlyCentral(), isNearlyMassless()
template<class P >
bool SimTK::MassProperties_< P >::isNaN ( ) const [inline]

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

See also:
isInf(), isFinite()
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.

See also:
isNan(), 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.

See also:
isNaN(), isInf()
template<class P >
SpatialMatP 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.

See also:
toMat66()
template<class P >
Mat66P 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.

See also:
toSpatialMat()

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines