Simbody  3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 contact surface 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

SimTK::Body::Body ( )
inline

Default constructor creates an empty Body handle.

SimTK::Body::~Body ( )

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

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

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

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.

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

Member Function Documentation

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.

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.

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.

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

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).

int SimTK::Body::getNumDecorations ( ) const

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

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

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 index i is the small integer that was returned by addDecoration().

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 index 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.

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

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

Returns a small integer that can be used to identify this contact surface in any copy of this Body. Unlike decorations, the transform is kept separately rather than used to transform the copied surface. You can obtain it later with getContactSurfaceTransform().

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).

int SimTK::Body::getNumContactSurfaces ( ) const

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

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

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.

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

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

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.

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.

bool SimTK::Body::isOwnerHandle ( ) const
bool SimTK::Body::isEmptyHandle ( ) const
bool SimTK::Body::hasRep ( ) const
inline
const BodyRep& SimTK::Body::getRep ( ) const
inline
BodyRep& SimTK::Body::updRep ( ) const
inline
void SimTK::Body::setRep ( BodyRep &  r)
inline

Member Data Documentation

class BodyRep* SimTK::Body::rep
protected

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