The Body class represents a reference frame that can be used to describe mass properties and geometry. More...
#include <Body.h>
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. | |
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 (const MassProperties &massProps) | |
This is a default conversion from MassProperties to Body. | |
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). | |
const MassProperties & | getDefaultRigidBodyMassProperties () const |
Get the default (that is, Topology stage) mass properties for this Body. | |
Body & | addDecoration (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 DecorativeGeometry & | 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 & | 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 & | addContactSurface (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 ContactSurface & | 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 & | getContactSurfaceTransform (int n) const |
Get the transform specifying the placement of the n'th contact surface on this Body. | |
ContactSurface & | updContactSurface (int n) |
Get write access to the unique contact surface owned by this Body. | |
Transform & | updContactSurfaceTransform (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 |
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.
~Body | ( | ) |
Destroy the handle and the body if this is the owner.
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 | ( | class BodyRep * | r | ) | [inline, explicit] |
Body& addContactSurface | ( | const Transform & | X_BS, | |
const ContactSurface & | shape | |||
) |
Create a new contact surface on a body and place it using the indicated Transform.
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 Rigid, Linear, Particle, Massless, and Ground.
Referenced by Linear::addDecoration(), Massless::addDecoration(), Rigid::addDecoration(), Ground::addDecoration(), and Particle::addDecoration().
const ContactSurface& 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& getContactSurfaceTransform | ( | int | n | ) | const |
Get the transform specifying the placement of the n'th contact surface on this Body.
const DecorativeGeometry& 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().
const MassProperties& getDefaultRigidBodyMassProperties | ( | ) | const |
int 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.
int getNumDecorations | ( | ) | const |
Obtain a count of how many pieces of DecorativeGeometry have been attached to this Body.
const BodyRep& getRep | ( | ) | const [inline] |
bool hasRep | ( | ) | const [inline] |
bool isEmptyHandle | ( | ) | const |
bool isOwnerHandle | ( | ) | const |
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& 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 Rigid, Linear, and Particle.
Referenced by Linear::setDefaultRigidBodyMassProperties(), Rigid::setDefaultRigidBodyMassProperties(), and Particle::setDefaultRigidBodyMassProperties().
void setRep | ( | BodyRep & | r | ) | [inline] |
ContactSurface& updContactSurface | ( | int | n | ) |
Transform& updContactSurfaceTransform | ( | int | n | ) |
DecorativeGeometry& updDecoration | ( | int | n | ) |
Get a writable reference to the n'th piece of DecorativeGeometry that was added to this Body, with 0 <= n < getNumDecorations().
BodyRep& updRep | ( | ) | const [inline] |
class BodyRep* rep [protected] |