## hermes.physics Class InverseSquareInteractor

```java.lang.Object hermes.Interactor<MassedBeing,MassedBeing> hermes.physics.InverseSquareInteractor
```
Direct Known Subclasses:
GravityInteractor

`public abstract class InverseSquareInteractorextends Interactor<MassedBeing,MassedBeing>`

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

### InverseSquareInteractor

```public InverseSquareInteractor(float factor,
float maxRange)```
Sets up a `ColoumbInteractor` with a range limit.

Parameters:
`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.

### InverseSquareInteractor

`public InverseSquareInteractor(float factor)`
Sets up a `ColoumbInteractor` with no range limit.

Parameters:
`factor` - the force constant factor (k in the Coloumb equation)
Method Detail

### detect

```public boolean detect(MassedBeing being1,
MassedBeing being2)```
Description copied from class: `Interactor`
Determines whether an interaction between two objects has occurred.

Specified by:
`detect` in class `Interactor<MassedBeing,MassedBeing>`
Parameters:
`being1` - the first interacting object
`being2` - the second interacting object
Returns:
Whether or not an interaction has occurred.

### handle

```public void handle(MassedBeing being1,
MassedBeing being2)```
Description copied from class: `Interactor`
Handles the result of an interaction that has been detected (by `detect` return true) for a pair of objects.

Specified by:
`handle` in class `Interactor<MassedBeing,MassedBeing>`
Parameters:
`being1` - the first object
`being2` - the second object

### beingFactor

`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.

Parameters:
`being` - a being
Returns:
the being's factor