VirtualPhysics the realtime dynamics simulation library

vpWorld Class Reference

world More...

#include <vpWorld.h>

List of all members.

Public Member Functions

void AddBody (vpBody *)
void AddWorld (vpWorld *)
void SetGlobalFrame (const SE3 &)
const SE3GetGlobalFrame (void) const
void Initialize (void)
virtual void StepAhead (void)
void SetTimeStep (scalar)
scalar GetTimeStep (void) const
void SetIntegrator (VP::INTEGRATOR_TYPE type)
scalar GetBoundingSphere (Vec3 &center) const
void SetGravity (const Vec3 &)
const Vec3GetGravity (void) const
void EnableCollision (bool=true)
void IgnoreCollision (vpBody *B0, vpBody *B1)
scalar GetSimulationTime (void) const
scalar GetKineticEnergy (void) const
scalar GetPotentialEnergy (void) const
scalar GetTotalEnergy (void) const
int GetNumBody (void) const
int GetNumGeometry (void) const
const vpBodyGetBody (int) const
const vpBodyGetBodyByName (const string &name) const
void BackupState (void)
void RollbackState (void)
void UpdateFrame (void)
int GetNumMaterial (void) const
const vpMaterialGetMaterial (int) const
const vpMaterialGetMaterialByName (const string &name) const
int GetNumJoint (void) const
const vpJointGetJoint (int) const
const vpJointGetJointByName (const string &name) const
void Clear (void)

Friends

ostream & operator<< (ostream &, const vpWorld &)
istream & operator>> (istream &, vpWorld &)


Detailed Description

vpWorld is a class to model your virtual world goverened by physics law.
Examples:

pendulum.cpp.


Member Function Documentation

void vpWorld::AddBody ( vpBody  ) 

add a body to the world

Examples:
pendulum.cpp.

void vpWorld::AddWorld ( vpWorld  ) 

add a world

World's parameters such as a time step and the gravity will not be updated with newly added world'parameters. Only the body and joints will be added.

VP_INLINE void vpWorld::SetGlobalFrame ( const SE3 T  ) 

set a global frame

All the coordinate frame is represented by this global frame. Should be followed by vpWorld::Initialize.

VP_INLINE const SE3 & vpWorld::GetGlobalFrame ( void   )  const

set a global frame

void vpWorld::Initialize ( void   ) 

initialize the world. Before simulation, the world should be initialized.

Examples:
pendulum.cpp.

virtual void vpWorld::StepAhead ( void   )  [virtual]

simulate the world during a specified time step.

See also:
SetTimeStep()
Examples:
pendulum.cpp.

VP_INLINE void vpWorld::SetTimeStep ( scalar  t  ) 

set simulation time step used in integrating dynamics equations. Default time step is 0.001. For stable simulation, smaller time step is preferred. However how small the time step can depend on your model.

VP_INLINE scalar vpWorld::GetTimeStep ( void   )  const

get a current time step.

void vpWorld::SetIntegrator ( VP::INTEGRATOR_TYPE  type  ) 

choose an integration algorithm used in simulation.

Parameters:
type VP::EULER is faster but less accurate than VP::RK4.

scalar vpWorld::GetBoundingSphere ( Vec3 center  )  const

get a bounding sphere including whole world.

VP_INLINE void vpWorld::SetGravity ( const Vec3 g  ) 

set a gravity. Default is zero gravity.

Examples:
pendulum.cpp.

VP_INLINE const Vec3 & vpWorld::GetGravity ( void   )  const

get a gravity.

VP_INLINE void vpWorld::EnableCollision ( bool  flag = true  ) 

enable or disable collision between bodies.

See also:
vpWorld::IgnoreCollision()

void vpWorld::IgnoreCollision ( vpBody B0,
vpBody B1 
)

declare that collision of B0 and B1 will be ignored.

VP_INLINE scalar vpWorld::GetSimulationTime ( void   )  const

get a simulation time.

scalar vpWorld::GetKineticEnergy ( void   )  const

get a kinetic energy.

scalar vpWorld::GetPotentialEnergy ( void   )  const

get a potential energy.

VP_INLINE scalar vpWorld::GetTotalEnergy ( void   )  const

get a total energy(= kinetic energy + potential energy).

VP_INLINE int vpWorld::GetNumBody ( void   )  const

get a number of bodies in the world.

int vpWorld::GetNumGeometry ( void   )  const

get a number of geometries in the world.

VP_INLINE const vpBody * vpWorld::GetBody ( int  idx  )  const

get a pointer to the ith body.

See also:
vpBody::GetID

const vpBody* vpWorld::GetBodyByName ( const string &  name  )  const

get a pointer to the body with the name

void vpWorld::BackupState ( void   ) 

keep current states which are transformation matrices, velocities, joint angles, joint velocities.

See also:
vpWorld::RestoreState

void vpWorld::RollbackState ( void   ) 

restore states to the values kept by BackupState()

See also:
vpWorld::KeepCurrentState

void vpWorld::UpdateFrame ( void   ) 

update transformation matrices from joint angles.

It is useful when you change joint angles and want to compute corresponding transformation matrices of articulated bodies. Basically, VP does not compute transformation matrices of bodies even if you change the joint angles. The transformation matrices or relevant values will be updated after the simulation which is typically done by calling vpWorld::StepAhead().

VP_INLINE int vpWorld::GetNumMaterial ( void   )  const

get a number of materials defined in the world

VP_INLINE const vpMaterial * vpWorld::GetMaterial ( int  idx  )  const

get a pointer to the ith material

const vpMaterial* vpWorld::GetMaterialByName ( const string &  name  )  const

get a pointer to the material with the name

VP_INLINE int vpWorld::GetNumJoint ( void   )  const

get a number of joints in the world

VP_INLINE const vpJoint * vpWorld::GetJoint ( int  idx  )  const

get a pointer to the ith joint

const vpJoint* vpWorld::GetJointByName ( const string &  name  )  const

get a pointer to the joint with the name

void vpWorld::Clear ( void   ) 

clear all the instances managed by the world


Friends And Related Function Documentation

ostream& operator<< ( ostream &  ,
const vpWorld  
) [friend]

print out current configuration of the wolrd in XML format.

istream& operator>> ( istream &  ,
vpWorld  
) [friend]

read the configuration generated from output stream


Generated on Wed Jun 11 23:11:49 2008 for VirtualPhysics by  doxygen 1.5.5