Gyration_< P > Class Template Reference

A Gyration matrix is a unit-mass inertia matrix; you can convert it to an Inertia by multiplying it by the actual body mass. More...

#include <MassProperties.h>

Inheritance diagram for Gyration_< P >:
Inertia_< P >

List of all members.

Public Member Functions

 Gyration_ ()
 Default is a NaN-ed out mess to avoid accidents, even in Release mode.
 Gyration_ (const RealP &moment)
 Create a principal gyration matrix with identical diagonal elements.
 Gyration_ (const Vec3P &moments, const Vec3P &products=Vec3P(0))
 Create a gyration matrix from a vector of the *moments* of gyration (the gyration matrix diagonal) and optionally a vector of the *products* of gyration (the off-diagonals).
 Gyration_ (const RealP &xx, const RealP &yy, const RealP &zz)
 Create a principal gyration matrix (only non-zero on diagonal).
 Gyration_ (const RealP &xx, const RealP &yy, const RealP &zz, const RealP &xy, const RealP &xz, const RealP &yz)
 This is a general gyration matrix.
 Gyration_ (const SymMat33P &m)
 Construct a Gyration from a symmetric 3x3 matrix.
 Gyration_ (const Mat33P &m)
 Construct a Gyration matrix from a 3x3 symmetric matrix.
 Gyration_ (const Inertia_< P > &I)
 Construct a Gyration matrix from a unit inertia matrix.
Gyration_setGyration (const RealP &xx, const RealP &yy, const RealP &zz)
 Set a gyration matrix to have only principal moments (that is, it will be diagonal).
Gyration_setGyration (const Vec3P &moments, const Vec3P &products=Vec3P(0))
 Set principal moments and optionally off-diagonal terms.
Gyration_setGyration (const RealP &xx, const RealP &yy, const RealP &zz, const RealP &xy, const RealP &xz, const RealP &yz)
 Set this Gyration to a general matrix.
Gyration_ shiftToCentroid (const Vec3P &CF) const
 Assuming that this gyration matrix is currently taken about some (implicit) frame F's origin OF, produce a new gyration matrix which is the same as this one except measured about the body's centroid CF.
Gyration_shiftToCentroidInPlace (const Vec3P &CF)
 Assuming that this gyration matrix is currently taken about some (implicit) frame F's origin OF, modify it so that it is instead taken about the body's centroid CF.
Gyration_ shiftFromCentroid (const Vec3P &p) const
 Assuming that the current Gyration G is a central gyration (that is, it is gyration about the body centroid CF), create a new object that is the same as this one except shifted to some other point p measured from the centroid.
Gyration_shiftFromCentroidInPlace (const Vec3P &p)
 Assuming that the current Gyration G is a central gyration (that is, it is gyration about the body centroid CF), shift it in place to some other point p measured from the centroid.
Gyration_ reexpress (const Rotation_< P > &R_FB) const
 Return a new gyration matrix like this one but re-expressed in another frame (leaving the origin point unchanged).
Gyration_ reexpress (const InverseRotation_< P > &R_FB) const
 Rexpress using an inverse rotation to avoid having to convert it.
Gyration_reexpressInPlace (const Rotation_< P > &R_FB)
 Re-express this gyration matrix in another frame, changing the object in place; see reexpress() if you want to leave this object unmolested and get a new one instead.
Gyration_reexpressInPlace (const InverseRotation_< P > &R_FB)
 Rexpress using an inverse rotation to avoid having to convert it.
 operator const SymMat33P & () const
 This is an implicit conversion to const SymMat33.
const Inertia_< P > & asUnitInertia () const
 Recast this Gyration matrix as a unit inertia matrix.
Gyration_setFromUnitInertia (const Inertia_< P > &I)
 Set from a unit inertia matrix.

Static Public Member Functions

static bool isValidGyrationMatrix (const SymMat33P &m)
 Test some conditions that must hold for a valid Gyration matrix.
Gyration matrix factories

These are Gyration matrix factories for some common 3D solids.

Each defines its own frame aligned (when possible) with principal moments. Each has unit mass and its center of mass located at the origin (usually). Use this with shiftFromCentroid() to move it somewhere else, and with reexpress() to express the Gyration matrix in another frame.



static Gyration_ pointMassAtOrigin ()
 Create a Gyration matrix for a point located at the origin -- that is, an all-zero matrix.
static Gyration_ pointMassAt (const Vec3P &p)
 Create a Gyration matrix for a point of unit mass located at a given location measured from origin OF and expressed in F (where F is the implicit frame of this Gyration matrix).
static Gyration_ sphere (const RealP &r)
 Create a Gyration matrix for a unit mass sphere of radius r centered at the origin.
static Gyration_ cylinderAlongZ (const RealP &r, const RealP &hz)
 Unit-mass cylinder aligned along z axis; use radius and half-length.
static Gyration_ cylinderAlongY (const RealP &r, const RealP &hy)
 Unit-mass cylinder aligned along y axis; use radius and half-length.
static Gyration_ cylinderAlongX (const RealP &r, const RealP &hx)
 Unit-mass cylinder aligned along x axis; use radius and half-length.
static Gyration_ brick (const RealP &hx, const RealP &hy, const RealP &hz)
 Unit-mass brick given by half-lengths in each direction.
static Gyration_ brick (const Vec3P &halfLengths)
 Alternate interface to brick() that takes a Vec3 for the half lengths.
static Gyration_ ellipsoid (const RealP &hx, const RealP &hy, const RealP &hz)
 Unit-mass ellipsoid given by half-lengths in each direction.
static Gyration_ ellipsoid (const Vec3P &halfLengths)
 Alternate interface to ellipsoid() that takes a Vec3 for the half lengths.

Detailed Description

template<class P>
class SimTK::Gyration_< P >

A Gyration matrix is a unit-mass inertia matrix; you can convert it to an Inertia by multiplying it by the actual body mass.

Functionality is limited here to those few operations which ensure unit mass; most operations on a Gyration matrix result in a general Inertia instead. You can use a Gyration object wherever an Inertia is expected but not vice versa.

When constructing a Gyration matrix, note that we cannot verify that it actually has unit mass because every legal Inertia matrix can be viewed as the Gyration matrix for some differently-scaled object.


Constructor & Destructor Documentation

Gyration_ (  )  [inline]

Default is a NaN-ed out mess to avoid accidents, even in Release mode.

Other than this value, a Gyration matrix should always be valid.

Gyration_ ( const RealP &  moment  )  [inline, explicit]

Create a principal gyration matrix with identical diagonal elements.

This is the Gyration matrix of a unit mass sphere of radius r = sqrt(5/2 * moment) centered on the origin.

Gyration_ ( const Vec3P moments,
const Vec3P products = Vec3P(0) 
) [inline, explicit]

Create a gyration matrix from a vector of the *moments* of gyration (the gyration matrix diagonal) and optionally a vector of the *products* of gyration (the off-diagonals).

Moments are in the order xx,yy,zz; products are xy,xz,yz.

Gyration_ ( const RealP &  xx,
const RealP &  yy,
const RealP &  zz 
) [inline]

Create a principal gyration matrix (only non-zero on diagonal).

Gyration_ ( const RealP &  xx,
const RealP &  yy,
const RealP &  zz,
const RealP &  xy,
const RealP &  xz,
const RealP &  yz 
) [inline]

This is a general gyration matrix.

Note the order of these arguments: moments of gyration first, then products of gyration.

Gyration_ ( const SymMat33P m  )  [inline, explicit]

Construct a Gyration from a symmetric 3x3 matrix.

The diagonals must be nonnegative and satisfy the triangle inequality.

Gyration_ ( const Mat33P m  )  [inline, explicit]

Construct a Gyration matrix from a 3x3 symmetric matrix.

In Debug mode we'll test that the supplied matrix is numerically close to symmetric, and that it satisfies other requirements of a Gyration matrix.

Gyration_ ( const Inertia_< P > &  I  )  [inline, explicit]

Construct a Gyration matrix from a unit inertia matrix.

Note that there is no way to check whether this is really a unit inertia -- any inertia matrix may be interpreted as a unit inertia for some shape. So be sure you know what you're doing before you use this constructor!


Member Function Documentation

const Inertia_<P>& asUnitInertia (  )  const [inline]

Recast this Gyration matrix as a unit inertia matrix.

This is just for emphasis; a Gyration matrix is already a kind of Inertia matrix by inheritance.

static Gyration_ brick ( const Vec3P halfLengths  )  [inline, static]

Alternate interface to brick() that takes a Vec3 for the half lengths.

Reimplemented from Inertia_< P >.

References Gyration_< P >::brick().

Referenced by Gyration_< P >::brick().

static Gyration_ brick ( const RealP &  hx,
const RealP &  hy,
const RealP &  hz 
) [inline, static]

Unit-mass brick given by half-lengths in each direction.

One dimension zero gives inertia of a thin rectangular sheet; two zero gives inertia of a thin rod in the remaining direction.

Reimplemented from Inertia_< P >.

static Gyration_ cylinderAlongX ( const RealP &  r,
const RealP &  hx 
) [inline, static]

Unit-mass cylinder aligned along x axis; use radius and half-length.

If r==0 this is a thin rod; hx=0 it is a thin disk.

Reimplemented from Inertia_< P >.

static Gyration_ cylinderAlongY ( const RealP &  r,
const RealP &  hy 
) [inline, static]

Unit-mass cylinder aligned along y axis; use radius and half-length.

If r==0 this is a thin rod; hy=0 it is a thin disk.

Reimplemented from Inertia_< P >.

static Gyration_ cylinderAlongZ ( const RealP &  r,
const RealP &  hz 
) [inline, static]

Unit-mass cylinder aligned along z axis; use radius and half-length.

If r==0 this is a thin rod; hz=0 it is a thin disk.

Reimplemented from Inertia_< P >.

static Gyration_ ellipsoid ( const Vec3P halfLengths  )  [inline, static]

Alternate interface to ellipsoid() that takes a Vec3 for the half lengths.

Reimplemented from Inertia_< P >.

References Gyration_< P >::ellipsoid().

Referenced by Gyration_< P >::ellipsoid().

static Gyration_ ellipsoid ( const RealP &  hx,
const RealP &  hy,
const RealP &  hz 
) [inline, static]

Unit-mass ellipsoid given by half-lengths in each direction.

Reimplemented from Inertia_< P >.

static bool isValidGyrationMatrix ( const SymMat33P m  )  [inline, static]

Test some conditions that must hold for a valid Gyration matrix.

Cost is about 9 flops. TODO: this may not be comprehensive.

operator const SymMat33P & (  )  const [inline]

This is an implicit conversion to const SymMat33.

Reimplemented from Inertia_< P >.

static Gyration_ pointMassAt ( const Vec3P p  )  [inline, static]

Create a Gyration matrix for a point of unit mass located at a given location measured from origin OF and expressed in F (where F is the implicit frame of this Gyration matrix).

Cost is 11 flops.

References SimTK::crossMatSq().

static Gyration_ pointMassAtOrigin (  )  [inline, static]

Create a Gyration matrix for a point located at the origin -- that is, an all-zero matrix.

Reimplemented from Inertia_< P >.

Gyration_ reexpress ( const InverseRotation_< P > &  R_FB  )  const [inline]

Rexpress using an inverse rotation to avoid having to convert it.

See also:
rexpress(Rotation) for information

Reimplemented from Inertia_< P >.

Gyration_ reexpress ( const Rotation_< P > &  R_FB  )  const [inline]

Return a new gyration matrix like this one but re-expressed in another frame (leaving the origin point unchanged).

Call this gyration matrix G_OF_F, that is, it is taken about the origin of some frame F, and expressed in F. We want to return G_OF_B, the same gyration matrix, still taken about the origin of F, but expressed in the B frame, given by G_OF_B=R_BF*G_OF_F*R_FB where R_FB is the rotation matrix giving the orientation of frame B in F. This is handled here by a special method of the Rotation class which rotates a symmetric tensor at a cost of 57 flops.

See also:
reexpressInPlace()

Reimplemented from Inertia_< P >.

Gyration_& reexpressInPlace ( const InverseRotation_< P > &  R_FB  )  [inline]

Rexpress using an inverse rotation to avoid having to convert it.

See also:
rexpressInPlace(Rotation) for information

Reimplemented from Inertia_< P >.

Gyration_& reexpressInPlace ( const Rotation_< P > &  R_FB  )  [inline]

Re-express this gyration matrix in another frame, changing the object in place; see reexpress() if you want to leave this object unmolested and get a new one instead.

Cost is 57 flops.

See also:
reexpress() if you want to leave this object unmolested.

Reimplemented from Inertia_< P >.

Gyration_& setFromUnitInertia ( const Inertia_< P > &  I  )  [inline]

Set from a unit inertia matrix.

Note that we can't check; every Inertia matrix can be interpreted as a unit inertia for some shape.

Gyration_& setGyration ( const RealP &  xx,
const RealP &  yy,
const RealP &  zz,
const RealP &  xy,
const RealP &  xz,
const RealP &  yz 
) [inline]

Set this Gyration to a general matrix.

Note the order of these arguments: moments of gyration first, then products of gyration. Behaves like an assignment statement. Will throw an error message in Debug mode if the supplied elements do not constitute a valid Gyration matrix.

Gyration_& setGyration ( const Vec3P moments,
const Vec3P products = Vec3P(0) 
) [inline]

Set principal moments and optionally off-diagonal terms.

Returns a reference to "this" like an assignment operator.

Gyration_& setGyration ( const RealP &  xx,
const RealP &  yy,
const RealP &  zz 
) [inline]

Set a gyration matrix to have only principal moments (that is, it will be diagonal).

Returns a reference to "this" like an assignment operator.

Gyration_ shiftFromCentroid ( const Vec3P p  )  const [inline]

Assuming that the current Gyration G is a central gyration (that is, it is gyration about the body centroid CF), create a new object that is the same as this one except shifted to some other point p measured from the centroid.

This produces a new inertia G' about the point p given by G' = G + Gp where Gp is the gyration of a fictitious point located at p, taken about CF. Cost is 17 flops.

See also:
shiftFromCentroidInPlace(), shiftToCentroid()

References Inertia_< P >::Inertia_().

Gyration_& shiftFromCentroidInPlace ( const Vec3P p  )  [inline]

Assuming that the current Gyration G is a central gyration (that is, it is gyration about the body centroid CF), shift it in place to some other point p measured from the centroid.

This changes G to a modified gyration G' taken about the point p, with the parallel axis theorem for inertia giving G' = G + Gp where Gp is the gyration of a fictitious, unit-mass point located at p, taken about CF. Cost is 17 flops.

See also:
shiftFromCentroid() if you want to leave this object unmolested.
shitToCentroidInPlace()
Gyration_ shiftToCentroid ( const Vec3P CF  )  const [inline]

Assuming that this gyration matrix is currently taken about some (implicit) frame F's origin OF, produce a new gyration matrix which is the same as this one except measured about the body's centroid CF.

We are given the vector from OF to the centroid CF, expressed in F. This produces a new Gyration matrix G' whose (implicit) frame F' is aligned with F but has origin CF (a gyration matrix like that is called "central" or "centroidal"). From the parallel axis theorem for inertias, G' = G - Gcom where Gcom is the gyration matrix of a fictitious, unit-mass point located at CF (measured in F) taken about OF. (17 flops)

See also:
shiftToCentroidInPlace(), shiftFromCentroid()

References Inertia_< P >::Inertia_().

Gyration_& shiftToCentroidInPlace ( const Vec3P CF  )  [inline]

Assuming that this gyration matrix is currently taken about some (implicit) frame F's origin OF, modify it so that it is instead taken about the body's centroid CF.

We are given the vector from OF to the centroid CF, expressed in F. This produces a new Gyration matrix G' whose (implicit) frame F' is aligned with F but has origin CF (a gyration matrix like that is called "central" or "centroidal"). From the parallel axis theorem for inertias, G' = G - Gcom where Gcom is the gyration matrix of a fictitious, unit-mass point located at CF (measured in F) taken about OF. A reference to the modified object is returned so that you can chain this method in the manner of assignment operators. Cost is 17 flops.

See also:
shiftToCentroid() if you want to leave this object unmolested.
shiftFromCentroidInPlace()
static Gyration_ sphere ( const RealP &  r  )  [inline, static]

Create a Gyration matrix for a unit mass sphere of radius r centered at the origin.

Reimplemented from Inertia_< P >.


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

Generated on Thu Aug 12 16:38:17 2010 for SimTKcore by  doxygen 1.6.1