Simbody  3.7
SimTK::Body Class Reference

The Body class represents a reference frame that can be used to describe mass properties and geometry. More...

+ Inheritance diagram for SimTK::Body:

Classes

class  Ground
 This is a Body representing something immobile, of effectively infinite mass and inertia, that cannot be modified to be anything else. More...
 
class  Linear
 This is a rigid body in the shape of a line, which is inherently inertialess about its axis. More...
 
class  Massless
 This is a Body that is constitutively massless (and inertialess); meaning that no amount of fiddling with it will ever give it any mass or inertia. More...
 
class  Rigid
 A general rigid body. More...
 

Public Member Functions

 Body ()
 Default constructor creates an empty Body handle. More...
 
 ~Body ()
 Destroy the handle and the body if this is the owner. More...
 
 Body (const Body &source)
 Copy constructor is a deep copy; the new Body is separate from the source Body. More...
 
Bodyoperator= (const Body &source)
 Copy assignment is a deep copy; the original object is deleted if this is the owner, then replaced with a copy of the source. More...
 
 Body (const MassProperties &massProps)
 This is a default conversion from MassProperties to Body. More...
 
BodysetDefaultRigidBodyMassProperties (const MassProperties &)
 Every type of Body should provide an initial set of rigid body mass properties defined at Topology stage (i.e., in the System rather than the State). More...
 
const MassPropertiesgetDefaultRigidBodyMassProperties () const
 Get the default (that is, Topology stage) mass properties for this Body. More...
 
int addDecoration (const Transform &X_BD, const DecorativeGeometry &geometry)
 Add a piece of decorative geometry fixed at some pose on this Body. More...
 
int addDecoration (const DecorativeGeometry &geometry)
 Convenience method for when the decorative geometry is to be placed at the body frame. More...
 
int getNumDecorations () const
 Obtain a count nd of how many pieces of DecorativeGeometry have been attached to this Body. More...
 
const DecorativeGeometrygetDecoration (int i) const
 Get a read-only reference to the i'th piece of DecorativeGeometry that was added to this Body, with 0 <= i < getNumDecorations(). More...
 
DecorativeGeometryupdDecoration (int i) const
 Get a writable reference to the i'th piece of DecorativeGeometry that was added to this Body, with 0 <= i < getNumDecorations(). More...
 
int addContactSurface (const Transform &X_BS, const ContactSurface &shape)
 Create a new ContactSurface on a body and place it using the indicated Transform. More...
 
int addContactSurface (const ContactSurface &shape)
 Convenience method for when the contact surface is to be placed at the body frame. More...
 
int getNumContactSurfaces () const
 Obtain the number of contact surfaces ns attached to this Body. More...
 
const ContactSurfacegetContactSurface (int i) const
 Get a reference to the i'th contact surface on this body; be sure to get the Transform also. More...
 
const TransformgetContactSurfaceTransform (int i) const
 Get the Transform specifying the placement of the i'th contact surface on this Body. More...
 
ContactSurfaceupdContactSurface (int i)
 Get write access to the i'th unique contact surface owned by this Body. More...
 
TransformupdContactSurfaceTransform (int i)
 Get a writable reference to the Transform specifying the placement of the i'th contact surface on this Body. More...
 
bool isOwnerHandle () const
 
bool isEmptyHandle () const
 
 Body (class BodyRep *r)
 
bool hasRep () const
 
const BodyRep & getRep () const
 
BodyRep & updRep () const
 
void setRep (BodyRep &r)
 

Protected Attributes

class BodyRep * rep
 

Detailed Description

The Body class represents a reference frame that can be used to describe mass properties and geometry.

These are in turn used to build MobilizedBodies which combine a body and a specified mobilizer that defines how the reference frame can move with respect to other MobilizedBodies. Attached geometric objects can serve as the basis for a variety of force-generating elements or other algorithms that act on bodies.

Body is an abstract base class handle, with concrete classes defined for each kind of body. There are a set of built-in body types, with Body::Rigid the most common.

Constructor & Destructor Documentation

◆ Body() [1/4]

SimTK::Body::Body ( )
inline

Default constructor creates an empty Body handle.

◆ ~Body()

SimTK::Body::~Body ( )

Destroy the handle and the body if this is the owner.

◆ Body() [2/4]

SimTK::Body::Body ( const Body source)

Copy constructor is a deep copy; the new Body is separate from the source Body.

◆ Body() [3/4]

SimTK::Body::Body ( const MassProperties massProps)

This is a default conversion from MassProperties to Body.

It will result in a rigid body (concrete class Body::Rigid) being created using these as its default MassProperties. This is what allows you to provide MassProperties instead of a Body in the MobilizedBody constructors.

◆ Body() [4/4]

SimTK::Body::Body ( class BodyRep *  r)
inlineexplicit

Member Function Documentation

◆ operator=()

Body& SimTK::Body::operator= ( const Body source)

Copy assignment is a deep copy; the original object is deleted if this is the owner, then replaced with a copy of the source.

◆ setDefaultRigidBodyMassProperties()

Body& SimTK::Body::setDefaultRigidBodyMassProperties ( const MassProperties )

Every type of Body should provide an initial set of rigid body mass properties defined at Topology stage (i.e., in the System rather than the State).

This is thus a Topology-stage change which will require a new realizeTopology() before use.

◆ getDefaultRigidBodyMassProperties()

const MassProperties& SimTK::Body::getDefaultRigidBodyMassProperties ( ) const

Get the default (that is, Topology stage) mass properties for this Body.

This may be overridden in a State if this Body has variable mass properties.

◆ addDecoration() [1/2]

int SimTK::Body::addDecoration ( const Transform X_BD,
const DecorativeGeometry geometry 
)

Add a piece of decorative geometry fixed at some pose on this Body.

This can be used for visualization of the Body's motion. Returns a small integer ordinal that can be used to identify this decoration in any copy of this Body. The supplied DecorativeGeometry object is copied and transformed by the given Transform so that the actual geometry is always stored relative to the body's frame. The copy's "index on body" is set to the same value as returned by this method.

See also
DecorativeGeometry::setIndexOnBody()

◆ addDecoration() [2/2]

int SimTK::Body::addDecoration ( const DecorativeGeometry geometry)
inline

Convenience method for when the decorative geometry is to be placed at the body frame.

This is the same as addDecoration(Transform(),geometry).

◆ getNumDecorations()

int SimTK::Body::getNumDecorations ( ) const

Obtain a count nd of how many pieces of DecorativeGeometry have been attached to this Body.

The ordinals i for individual decorations will be numbered 0 <= i < nd.

◆ getDecoration()

const DecorativeGeometry& SimTK::Body::getDecoration ( int  i) const

Get a read-only reference to the i'th piece of DecorativeGeometry that was added to this Body, with 0 <= i < getNumDecorations().

The ordinal i is the small integer that was returned by addDecoration().

◆ updDecoration()

DecorativeGeometry& SimTK::Body::updDecoration ( int  i) const

Get a writable reference to the i'th piece of DecorativeGeometry that was added to this Body, with 0 <= i < getNumDecorations().

The ordinal i is the small integer that was returned by addDecoration(). Note that we allow writable access to decorations even on a const Body – these are after all just decorations.

◆ addContactSurface() [1/2]

int SimTK::Body::addContactSurface ( const Transform X_BS,
const ContactSurface shape 
)

Create a new ContactSurface on a body and place it using the indicated Transform.

Unlike decorations, the Transform is kept separately rather than used to transform the copied surface in place. You can obtain it later with getContactSurfaceTransform(). A small integer ordinal is returned that can be used to identify this ContactSurface in any copy of this Body. That integer saved in the new ContactSurface object, using its setIndexOnBody() method.

See also
ContactSurface::setIndexOnBody()

◆ addContactSurface() [2/2]

int SimTK::Body::addContactSurface ( const ContactSurface shape)
inline

Convenience method for when the contact surface is to be placed at the body frame.

This is the same as addContactSurface(Transform(),shape).

◆ getNumContactSurfaces()

int SimTK::Body::getNumContactSurfaces ( ) const

Obtain the number of contact surfaces ns attached to this Body.

The valid body-local ordinals i will be 0 <= i < ns.

◆ getContactSurface()

const ContactSurface& SimTK::Body::getContactSurface ( int  i) const

Get a reference to the i'th contact surface on this body; be sure to get the Transform also.

See also
getContactSurfaceTransform()

◆ getContactSurfaceTransform()

const Transform& SimTK::Body::getContactSurfaceTransform ( int  i) const

Get the Transform specifying the placement of the i'th contact surface on this Body.

◆ updContactSurface()

ContactSurface& SimTK::Body::updContactSurface ( int  i)

Get write access to the i'th unique contact surface owned by this Body.

This is a Topology-stage change that will require a new realizeTopology() call if this Body is part of a System.

◆ updContactSurfaceTransform()

Transform& SimTK::Body::updContactSurfaceTransform ( int  i)

Get a writable reference to the Transform specifying the placement of the i'th contact surface on this Body.

This is a Topology-stage change that will require a new realizeTopology() call if this Body is part of a System.

◆ isOwnerHandle()

bool SimTK::Body::isOwnerHandle ( ) const

◆ isEmptyHandle()

bool SimTK::Body::isEmptyHandle ( ) const

◆ hasRep()

bool SimTK::Body::hasRep ( ) const
inline

◆ getRep()

const BodyRep& SimTK::Body::getRep ( ) const
inline

◆ updRep()

BodyRep& SimTK::Body::updRep ( ) const
inline

◆ setRep()

void SimTK::Body::setRep ( BodyRep &  r)
inline

Member Data Documentation

◆ rep

class BodyRep* SimTK::Body::rep
protected

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