pslib
Class PSForce

java.lang.Object
  extended by pslib.PSForce
All Implemented Interfaces:
PSBehaviour, PSConstants
Direct Known Subclasses:
AttractiveForce, BrownianForce, LateralForce, LinearForce, ResistiveForce

public abstract class PSForce
extends java.lang.Object
implements PSConstants, PSBehaviour

PSForce Class

The PSForce class is an abstract class for the creation of particle forces. Objects that extend this class can be used with the RadialEmitter object to modify the DynamicParticle trajectories.

The PSForce class implements the PSBehaviour interface, allowing sub-classes of PSForce to be used within the behavioural update loop of DynamicParticle objects.

This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library. If not, see http://www.gnu.org/licenses/.


Field Summary
 
Fields inherited from interface pslib.PSConstants
CAM2D_LOOK, CAM2D_RIGHT, CAM2D_UP, CORNER, INVERSE, INVERSE_TRIANGULAR, LEADING, LINEAR, MIDPOINT, NONE, STATIC, TRAILING, TRIANGULAR
 
Constructor Summary
PSForce(float m)
          Create a new object instance with the specified magnitude
PSForce(float mi, float ma, int m, float c)
          Create a new object instance with the specified values
 
Method Summary
 PSVector getDimensionScalars()
          Return the dimension scalar vector
protected  PSVector getMagnitude(DynamicParticle p)
          Return the force magnitude vector for the specified particle
 float getScale()
          Return the force scalar
 void setCurve(float e)
          Set the curve exponent
 void setDimensionScalars(PSVector d)
          Set the dimension scalar vector
 void setScale(float s)
          Set the force scalar
abstract  void update(DynamicParticle p)
          Update the specified particle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PSForce

public PSForce(float m)
Create a new object instance with the specified magnitude

Parameters:
m - magnitude

PSForce

public PSForce(float mi,
               float ma,
               int m,
               float c)
Create a new object instance with the specified values

Parameters:
mi - minimum magnitude
ma - maximum magnitude
m - envelope mode
c - curve exponent
Method Detail

setScale

public final void setScale(float s)
Set the force scalar

Parameters:
s - scalar

getScale

public final float getScale()
Return the force scalar

Returns:
the force scalar

setCurve

public final void setCurve(float e)
Set the curve exponent

Parameters:
e - exponent

setDimensionScalars

public final void setDimensionScalars(PSVector d)
Set the dimension scalar vector

Parameters:
d - dimension scalar vector

getDimensionScalars

public final PSVector getDimensionScalars()
Return the dimension scalar vector

Returns:
the dimension scalar vector

getMagnitude

protected final PSVector getMagnitude(DynamicParticle p)
Return the force magnitude vector for the specified particle

Parameters:
p - particle
Returns:
the force magnitude vector for the specified particle

update

public abstract void update(DynamicParticle p)
Update the specified particle

Specified by:
update in interface PSBehaviour
Parameters:
p - particle