|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpslib.PSForce
pslib.AttractiveForce
public class AttractiveForce
AttractorForce Class
The AttractorForce object extends the PSForce class allowing an attractive force to be applied to a DynamicParticle object.
If no radius is specified the force magnitude increases, the further a particle gets from the force position. If a radius is specified, then force magnitude is calculated based on the position of the particle within the force radius, with the centre creating the largest magnitude.
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 | |
---|---|
AttractiveForce(PSVector p,
float m)
Create a static object instance with the specified values |
|
AttractiveForce(PSVector p,
float r,
float m)
Create a static object instance with the specified values |
|
AttractiveForce(PSVector p,
float r,
float mi,
float ma,
int m,
float c)
Create a dynamic object instance with the specified values |
|
AttractiveForce(PSVector p,
float mi,
float ma,
int m,
float c)
Create a dynamic object instance with the specified values |
Method Summary | |
---|---|
PSVector |
getPosition()
Return the force position |
void |
setDamping(float d)
Set force damping for non-radial behaviour |
void |
setDistanceCurve(float c)
Set the distance curve exponent |
void |
setPosition(PSVector p)
Set the force position |
void |
update(DynamicParticle p)
Update the specified particle |
Methods inherited from class pslib.PSForce |
---|
getDimensionScalars, getMagnitude, getScale, setCurve, setDimensionScalars, setScale |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AttractiveForce(PSVector p, float m)
p
- positionm
- magnitudepublic AttractiveForce(PSVector p, float r, float m)
p
- positionr
- radiusm
- magnitudepublic AttractiveForce(PSVector p, float r, float mi, float ma, int m, float c)
p
- positionr
- radiusmi
- minimum magnitudema
- maximum magnitudem
- modec
- decay curve exponentpublic AttractiveForce(PSVector p, float mi, float ma, int m, float c)
p
- positionmi
- minimum magnitudema
- maximum magnitudem
- modec
- decay curve exponentMethod Detail |
---|
public void setPosition(PSVector p)
p
- positionpublic PSVector getPosition()
public void setDamping(float d)
Default: 0.01
d
- dampingpublic void setDistanceCurve(float c)
c
- curve exponentpublic void update(DynamicParticle p)
update
in interface PSBehaviour
update
in class PSForce
p
- particle
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |