physics::Body< d > Class Template Reference

#include <body.h>

List of all members.

Public Member Functions

 ~Body ()
MOI getMOI () const
 Return the Moment of Inertia.
bool isAwake () const
 Queries whether a body is sleeping or not.
void setAwake (const bool awake)
 Allows a body to be slept and woken.
void setCanSleep (const bool sleepable)
 Sets whether a body is allowed to sleep or not.
bool contains (const Vector &p) const
 Checks if a position is contained within the space the body occupies.
bool intersects (const AARect &rect) const
 Checks if the body intersects a given Bounding Box.
void add (Shape *area)
 Add a shape to the body.
void remove (Shape *area)
 Remove a shape from the body.
const shape_container & getShapes () const
 Gets all the shapes contained within this body.
void applyImpulse (const Vector &impulse, const Vector &point, bool wakeUp=true)
void applyImpulse (const Vector &impulse, bool wakeUp=true)
void applyBiasImpulse (const Vector &impulse, const Vector &point)
void applyForces (float timestep, const Vector &acceleration, float frameRWABias)
void move (float timestep)
void moveBias (float timestep)
Vector worldToLocal (const Vector &p) const
Vector localToWorld (const Vector &p) const
Vector worldToLocalDir (const Vector &v) const
Vector localToWorldDir (const Vector &v) const
Vector getVelocityAtPoint (const Vector &position) const
Vector getBiasVelocityAtPoint (const Vector &p) const
void setDensity (float density, bool updateMass=true)
void setRestitution (float f)
void setFriction (float f)

Static Public Member Functions

static Bodycreate ()
 Creates a new body and returns a pointer to it.
static Bodycreate (Shape *shape)
 Creates a body with a given shape and returns a pointer to it.
static BodycreateStatic (Shape *shape)
 Creates a body with a given shape, sets it to static, and returns a pointer to it.

Public Attributes

void * data


Detailed Description

template<typename d>
class physics::Body< d >

Class that specifies the representation of bodies ( a entity comprised of one or more shapes) within the simulation. Provides functions for creating, adding to, querying and deleting bodies.

Constructor & Destructor Documentation

template<typename d>
physics::Body< d >::~Body (  )  [inline]

This will delete all shapes owned by this body. If you want to keep references to a shape, you should remove it from the body before the destructor is called.


Member Function Documentation

template<typename d>
static Body* physics::Body< d >::create ( Shape *  shape  )  [inline, static]

Creates a body with a given shape and returns a pointer to it.

Parameters:
shape A pointer to a shape to be included in the body
Returns:
body A pointer to the new body created

template<typename d>
void physics::Body< d >::setAwake ( const bool  awake  )  [inline]

Allows a body to be slept and woken.

Parameters:
awake Boolean value. True sets body to be awake, false puts its to sleep

template<typename d>
bool physics::Body< d >::contains ( const Vector &  p  )  const [inline]

Checks if a position is contained within the space the body occupies.

Parameters:
Position Vector in world co-ordinates

template<typename d>
bool physics::Body< d >::intersects ( const AARect &  rect  )  const [inline]

Checks if the body intersects a given Bounding Box.

Parameters:
AARect Bounding box

template<typename d>
const shape_container& physics::Body< d >::getShapes (  )  const [inline]

Gets all the shapes contained within this body.

Returns:
m_shapes List of all shapes within the body

template<typename d>
void physics::Body< d >::applyImpulse ( const Vector &  impulse,
const Vector &  point,
bool  wakeUp = true 
) [inline]

Applies an impulse to the body.

Parameters:
impulse The impulse to apply.
point Position in world coordinates to apply impulse at.
wakeUp If true (the default), will wake the body up if it is asleep.

template<typename d>
void physics::Body< d >::applyImpulse ( const Vector &  impulse,
bool  wakeUp = true 
) [inline]

Applies an impulse to the body at the centre of mass. This will not cause any change in rotation.

Parameters:
impulse The impulse to apply.
wakeUp If true (the default), will wake the body up if it is asleep.

template<typename d>
void physics::Body< d >::applyBiasImpulse ( const Vector &  impulse,
const Vector &  point 
) [inline]

Only CattoContactResolver should use this method.

template<typename d>
void physics::Body< d >::applyForces ( float  timestep,
const Vector &  acceleration,
float  frameRWABias 
) [inline]

Only World should use this method.

template<typename d>
void physics::Body< d >::move ( float  timestep  )  [inline]

Only World should use this method.

template<typename d>
void physics::Body< d >::moveBias ( float  timestep  )  [inline]

Only World should use this method.

template<typename d>
d::Vector physics::Body< d >::worldToLocal ( const Vector &  p  )  const [inline]

Transform a position from world coordinates to local coordinates.

template<typename d>
d::Vector physics::Body< d >::localToWorld ( const Vector &  p  )  const [inline]

Transform a position from local coordinates to world coordinates.

template<typename d>
d::Vector physics::Body< d >::worldToLocalDir ( const Vector &  v  )  const [inline]

Transform a direction from world coordinates to local coordinates.

template<typename d>
d::Vector physics::Body< d >::localToWorldDir ( const Vector &  v  )  const [inline]

Transform a direction from local coordinates to world coordinates.

template<typename d>
d::Vector Body::getVelocityAtPoint ( const Vector &  position  )  const [inline]

Find the combined linear and angular velocity of a point on the body

Parameters:
position Point on the body in world coordinates

template<typename d>
d::Vector Body::getBiasVelocityAtPoint ( const Vector &  p  )  const [inline]

Only CattoContactResolver should use this method.

template<typename d>
void physics::Body< d >::setDensity ( float  density,
bool  updateMass = true 
) [inline]

This is a convenience method to set the density of every shape currently attached. It will not affect shapes that are added later.

Parameters:
density New density for all attached shapes.
updateMass If true, recalculate this body's mass and moment of inertia.

template<typename d>
void physics::Body< d >::setRestitution ( float  f  )  [inline]

This is a convenience method to set the coefficient of restitution of every shape currently attached. It will not affect shapes that are added later.

template<typename d>
void physics::Body< d >::setFriction ( float  f  )  [inline]

This is a convenience method to set the coefficient of friction of every shape currently attached. It will not affect shapes that are added later.


Member Data Documentation

template<typename d>
void* physics::Body< d >::data

Used for any data the application using the library wants to attach.


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

Generated on Thu Apr 23 22:51:40 2009 for Large Polygon Collider - Modular 2D/3D Physics Engine by  doxygen 1.5.6