GravitationForce Class Reference
[Physical forces]

Newton gravitational force. More...

#include <gravitation.h>

Inheritance diagram for GravitationForce:

Item Force Object List of all members.

Public Member Functions

 GravitationForce (double gravitationConst=Constants::Gravitational)
void calcForce ()
double gravitationConst () const
void setGravitationConst (double gravitationConst)
virtual void worldItemRemoved (Item *item)
virtual void setWorld (World *world)
Worldworld () const
const QString & name () const
void setName (const QString &name)

Detailed Description

Newton gravitational force.

The force acts between pairs of massive bodies (currently only Particle) and equals:

\[ \overrightarrow{f} = G \frac{m_1 m_2 \overrightarrow{r}} {|\overrightarrow{r}|^3} \]

where:
$G$ is GravitationForce::gravitationConst
$m_1$ and $m_2$ is Particle::mass of first and second body
$\overrightarrow{r}$ is difference of Particle::position of the first and second body

Todo:
Add interface for massive bodies, support bodies with distributed mass


Constructor & Destructor Documentation

GravitationForce ( double  gravitationConst = Constants::Gravitational  ) 

Constructs GravitationForce


Member Function Documentation

void calcForce (  )  [virtual]

Calculate force. Bodies can be accessed through this->world()->bodies()

Implements Force.

double gravitationConst (  )  const [inline]

Get gravitational constant

void setGravitationConst ( double  gravitationConst  )  [inline]

Set gravitational constant

virtual void worldItemRemoved ( Item item  )  [inline, virtual, inherited]

Called by the World when any item is removed from the world

Parameters:
item Pointer to removed item
Todo:
XXX rename

Reimplemented in Spring.

virtual void setWorld ( World world  )  [inline, virtual, inherited]

Set/change pointer to World in which this object lives

Reimplemented in Spring.

World* world (  )  const [inline, inherited]

Get pointer to World in which this object lives

Returns:
Pointer to the World or NULL

const QString& name (  )  const [inline, inherited]

Returns name of the object

void setName ( const QString &  name  )  [inline, inherited]

Set name of the object


The documentation for this class was generated from the following files:
Generated on Thu Mar 15 14:23:37 2007 for StepCore by  doxygen 1.5.1