public class Attraction extends TwoBodyForce
TwoBodyForce.ForcePair
Constructor and Description |
---|
Attraction(Particle oneEnd,
Particle theOtherEnd,
float k,
float distanceMin)
Creates an Attraction between oneEnd and theOtherEnd, with scale k and minimum distance distanceMin.
|
Modifier and Type | Method and Description |
---|---|
protected TwoBodyForce.ForcePair |
forcePair()
Implements the Attraction force calculation.
|
float |
getMinimumDistance()
Reports the minimum separation distance above which the attraction is applied.
|
float |
getStrength()
Reports the strength of this Attraction.
|
Attraction |
setMinimumDistance(float d)
Sets the minimum separation distance above which the attraction is applied.
|
Attraction |
setStrength(float k)
Sets the strength of this Attraction.
|
apply, equalAndOpposite, getOneEnd, getTheOtherEnd, setOneEnd, setTheOtherEnd, specifyBoth, turnOff, turnOn, turnOn
apply
isOff, isOn
public Attraction(Particle oneEnd, Particle theOtherEnd, float k, float distanceMin) throws java.lang.NullPointerException, java.lang.IllegalArgumentException
oneEnd
- The particle at one end.theOtherEnd
- The particle at the other end.k
- the force scale between the two particles.distanceMin
- the minimum distance between particles above which the force acts.java.lang.NullPointerException
- if either particle is null.java.lang.IllegalArgumentException
- if distanceMin is <=0.public final float getMinimumDistance()
public final Attraction setMinimumDistance(float d) throws java.lang.IllegalArgumentException
d
- the new minimum distancejava.lang.IllegalArgumentException
- if d<=0public final Attraction setStrength(float k)
k
- the strength of the Attraction.public final float getStrength()
protected TwoBodyForce.ForcePair forcePair()
forcePair
in class TwoBodyForce