hermes.physics
Class GravityInteractor

java.lang.Object
  extended by hermes.Interactor<MassedBeing,MassedBeing>
      extended by hermes.physics.InverseSquareInteractor
          extended by hermes.physics.GravityInteractor

public class GravityInteractor
extends InverseSquareInteractor

An interactor for gravitational attractions using the standard inverse-square force model. F = G * m1 * m2 / r ^ 2


Constructor Summary
GravityInteractor(float gravityConstant)
          Sets up a gravity interactor with no range limit.
GravityInteractor(float gravityConstant, float maxRange)
          Sets up the gravity interactor with a maximum interaction range.
 
Method Summary
protected  float beingFactor(MassedBeing being)
          The factor from each being used in the numerator of the Coloumb equation for example, charge for an electric force or mass for gravity.
 
Methods inherited from class hermes.physics.InverseSquareInteractor
detect, handle
 
Methods inherited from class hermes.Interactor
appliedImmediately, multisampled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GravityInteractor

public GravityInteractor(float gravityConstant,
                         float maxRange)
Sets up the gravity interactor with a maximum interaction range.

Parameters:
gravityConstant - the gravity constant G (should be positive)
maxRange - the maximum range of gravitational interactions

GravityInteractor

public GravityInteractor(float gravityConstant)
Sets up a gravity interactor with no range limit.

Parameters:
gravityConstant - the gravity constant G (should be positive)
Method Detail

beingFactor

protected float beingFactor(MassedBeing being)
Description copied from class: InverseSquareInteractor
The factor from each being used in the numerator of the Coloumb equation for example, charge for an electric force or mass for gravity.

Specified by:
beingFactor in class InverseSquareInteractor
Parameters:
being - a being
Returns:
the being's factor