|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object hermes.Interactor<MassedBeing,MassedBeing> hermes.physics.InverseSquareInteractor
public abstract class InverseSquareInteractor
A general inverse square-law force interactor.
Each being in the interaction will receive an equal and opposite force F = k * q1 * q2 / r^2
where k is a factor set in the constructor, q1 and q2 are determined by beingFactor
for the first and second beings respectively, and r is the distance between the beings. It can also be given a maximum range.
Constructor Summary | |
---|---|
InverseSquareInteractor(float factor)
Sets up a ColoumbInteractor with no range limit. |
|
InverseSquareInteractor(float factor,
float maxRange)
Sets up a ColoumbInteractor with a range limit. |
Method Summary | |
---|---|
protected abstract 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. |
boolean |
detect(MassedBeing being1,
MassedBeing being2)
Determines whether an interaction between two objects has occurred. |
void |
handle(MassedBeing being1,
MassedBeing being2)
Handles the result of an interaction that has been detected (by detect return true)
for a pair of objects. |
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 |
---|
public InverseSquareInteractor(float factor, float maxRange)
ColoumbInteractor
with a range limit.
factor
- the force constant factor (k in the Coloumb equation)maxRange
- the maximum range of the interaction. Beings separated by a distance greater than this range will not interact.public InverseSquareInteractor(float factor)
ColoumbInteractor
with no range limit.
factor
- the force constant factor (k in the Coloumb equation)Method Detail |
---|
public boolean detect(MassedBeing being1, MassedBeing being2)
Interactor
detect
in class Interactor<MassedBeing,MassedBeing>
being1
- the first interacting objectbeing2
- the second interacting object
public void handle(MassedBeing being1, MassedBeing being2)
Interactor
detect
return true)
for a pair of objects.
handle
in class Interactor<MassedBeing,MassedBeing>
being1
- the first objectbeing2
- the second objectprotected abstract float beingFactor(MassedBeing being)
being
- a being
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |