Simbody
Classes | Public Member Functions | Protected Attributes

SimTK::Body Class Reference

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

#include <Body.h>

Inheritance diagram for SimTK::Body:

List of all members.

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  Particle
 This kind of body can only represent an inertialess point mass, with mass center at (0,0,0) in the local frame. More...
class  Rigid
 A general rigid body. More...

Public Member Functions

 Body ()
 Default constructor creates an empty Body handle.
 ~Body ()
 Destroy the handle and the body if this is the owner.
 Body (const Body &source)
 Copy constructor is a deep copy; the new Body is separate from the source Body.
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.
 Body (const MassProperties &massProps)
 This is a default conversion from MassProperties to Body.
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).
const MassPropertiesgetDefaultRigidBodyMassProperties () const
 Get the default (that is, Topology stage) mass properties for this Body.
BodyaddDecoration (const Transform &X_BD, const DecorativeGeometry &)
 Add a piece of decorative geometry fixed at some location on this Body.
int getNumDecorations () const
 Obtain a count of how many pieces of DecorativeGeometry have been attached to this Body.
const DecorativeGeometrygetDecoration (int n) const
 Get a read-only reference to the n'th piece of DecorativeGeometry that was added to this Body, with 0 <= n < getNumDecorations().
DecorativeGeometryupdDecoration (int n)
 Get a writable reference to the n'th piece of DecorativeGeometry that was added to this Body, with 0 <= n < getNumDecorations().
BodyaddContactSurface (const Transform &X_BS, const ContactSurface &shape)
 Create a new contact surface on a body and place it using the indicated Transform.
int getNumContactSurfaces () const
 Obtain the number of contact surfaces n attached to this Body.
const ContactSurfacegetContactSurface (int n) const
 Get a reference to the n'th contact surface on this body; be sure to get the Transform also.
const TransformgetContactSurfaceTransform (int n) const
 Get the transform specifying the placement of the n'th contact surface on this Body.
ContactSurfaceupdContactSurface (int n)
 Get write access to the unique contact surface owned by this Body.
TransformupdContactSurfaceTransform (int n)
 Get a writable reference to the transform specifying the placement of the n'th contact surface on this Body.
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) [inline, explicit]

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.

Reimplemented in SimTK::Body::Rigid, SimTK::Body::Linear, and SimTK::Body::Particle.

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.

Body& SimTK::Body::addDecoration ( const Transform X_BD,
const DecorativeGeometry  
)

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

This can be used for visualization of the Body's motion. Returns a reference to the Body so these can be chained like assignment operators.

Reimplemented in SimTK::Body::Rigid, SimTK::Body::Linear, SimTK::Body::Particle, SimTK::Body::Massless, and SimTK::Body::Ground.

int SimTK::Body::getNumDecorations ( ) const

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

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

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

DecorativeGeometry& SimTK::Body::updDecoration ( int  n)

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

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

int SimTK::Body::getNumContactSurfaces ( ) const

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

The valid body-local BodyContactSurfaceIndex values will be from 0 to n-1.

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

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

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

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

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

Get write access to the 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  n)

Get a writable reference to the transform specifying the placement of the n'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:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines