|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpslib.GenericParticle
pslib.DynamicParticle
pslib.ParentParticle
pslib.BoidParticle
public class BoidParticle
BoidParticle Class
The BoidParticle object extends the functionality of the ParentParticle object by incorporating flocking simulation. Boid position is calculated based on the rules of separation, cohesion and alignment of flock members as defined by Reynolds.
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 | |
---|---|
BoidParticle()
Create a new static object instance with the default buffer size of 1 |
|
BoidParticle(int b)
Create a new static object instance with the specified buffer size |
|
BoidParticle(int b,
int d)
Create a new dynamic object instance with the specified buffer size and decay time |
Method Summary | |
---|---|
BoidParticle |
copy()
Return a copy of this particle |
void |
map(BoidParticle p)
Map the properties of this particle to that specified preserving references |
void |
setBoundToPlace(PSVector c,
float r)
Set the bound-to-place location and radius |
void |
setCheckDistance(float d)
Set the boid check distance |
void |
setDamping(float d)
Set the boid velocity damping amount |
void |
setForceScalars(float s,
float a,
float c,
float b)
Set the boid force |
void |
setMaxForce(float f)
Set the maximum acceleration force for the boid |
void |
setMaxVelocity(float v)
Set the maximum velocity for the boid |
void |
setSeparationDistance(float d)
Set the boid separation distance |
void |
update(GenericParticle[] pa)
Update the boid |
Methods inherited from class pslib.ParentParticle |
---|
activeParticles, attach, attach, attachedParticles, clear, debug, debug, getBufferSize, isDead, map, remove, render, render, setAlpha, setBufferSize, setColour, setColour, setColour, setColour, setPosition, setVelocity, toArray, update |
Methods inherited from class pslib.DynamicParticle |
---|
clearBehaviour, getBehaviour, getDecay, getDecayTime, getInitialDecayTime, getMass, getRenderAlpha, getRenderSize, getSnapshot, isDynamic, map, setAlphaEnvelope, setBehaviour, setBehaviour, setDecayTime, setMass, setSizeEnvelope |
Methods inherited from class pslib.GenericParticle |
---|
getAlpha, getColour, getPosition, getSize, getVelocity, setSize |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BoidParticle()
public BoidParticle(int b)
b
- buffer sizepublic BoidParticle(int b, int d)
b
- buffer sized
- decay (ms)Method Detail |
---|
public void setForceScalars(float s, float a, float c, float b)
s
- separationa
- alignmentc
- cohesionb
- bound-to-placepublic void setSeparationDistance(float d)
The separation distance is the distance which the boid will attempt to maintain between itself and its neighbours.
Default: 60.0
d
- separation distancepublic void setCheckDistance(float d)
Boid velocity is calculated based on all surrounding boids within the specified radius.
Default: 60.0
d
- check distancepublic void setBoundToPlace(PSVector c, float r)
Boids will attempt to stay within the spherical area specifed. If the central point is specified as null, the boid will not adhere to the bound-to-place rule.
Default: null, 0.0
c
- central pointr
- radiuspublic void setDamping(float d)
Default: 0.01
d
- dampingpublic void setMaxVelocity(float v)
Default: 5.0
v
- maximum velocitypublic void setMaxForce(float f)
Default: 0.1
f
- maximum forcepublic void update(GenericParticle[] pa)
Boid velocity and position is calculated based on the position and velocity data for each GenericParticle within the specified array
pa
- GenericParticle arraypublic BoidParticle copy()
The returned particle will copy of all of this objects variables and will
adhere to the rules defined in DynamicParticle.map()
.
copy
in class ParentParticle
DynamicParticle
public final void map(BoidParticle p)
The returned object takes a copy of all orbiter particle variables.
DynamicParticle variables are mapped based on the rules defined in
DynamicParticle.map()
.
p
- particleDynamicParticle
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |