|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpslib.GenericParticle
pslib.DynamicParticle
pslib.BufferedParticle
public class BufferedParticle
BufferedParticle Class
The BufferedParticle object extends the functionality of the DynamicParticle class by incorporating position, colour, decay and size buffers.
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 | |
---|---|
BufferedParticle(int b)
Create a new object instance with the specified buffer size |
|
BufferedParticle(int b,
int d)
Create a new object instance with the specified buffer size and decay |
Method Summary | |
---|---|
BufferedParticle |
copy()
Return a copy of this particle |
protected StaticParticle[] |
getBuffer()
Return an array containing all buffered particles |
int |
getBufferSize()
Return the current buffer size |
protected float |
getCumulativeLength()
Return the cumulative length of the buffer trail |
protected PSVector[] |
getCumulativePositions()
Return an array containing the positions of each buffered element relative to the preceding element |
protected PSVector[] |
getRelativePositions()
Return an array containing the positions of each buffered element relative to the current particle position |
protected float[] |
getTaperValues()
Return an array of buffer taper values |
void |
initialiseBuffer(StaticParticle p)
Initialise the buffer with the specified StaticParticle object |
boolean |
isInitialised()
Return true if the buffer is initialised |
void |
map(BufferedParticle p)
Map the properties of this particle to that specified preserving references |
void |
resizeBuffer(int s)
Resize the buffer |
void |
setPosition(PSVector p)
Set the current particle position and update the buffer |
void |
setSpacing(float s)
Set the minimum buffered element spacing |
Methods inherited from class pslib.DynamicParticle |
---|
clearBehaviour, debug, debug, getBehaviour, getDecay, getDecayTime, getInitialDecayTime, getMass, getRenderAlpha, getRenderSize, getSnapshot, isDead, isDynamic, map, render, render, setAlphaEnvelope, setBehaviour, setBehaviour, setDecayTime, setMass, setSizeEnvelope, update |
Methods inherited from class pslib.GenericParticle |
---|
getAlpha, getColour, getPosition, getSize, getVelocity, setAlpha, setColour, setColour, setSize, setVelocity |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BufferedParticle(int b)
b
- buffer sizepublic BufferedParticle(int b, int d)
b
- buffer sized
- decay (ms)Method Detail |
---|
public void setPosition(PSVector p)
setPosition
in class GenericParticle
p
- positionpublic void setSpacing(float s)
Default: 0
s
- spacingpublic final boolean isInitialised()
public final void initialiseBuffer(StaticParticle p)
p
- StaticParticleprotected final StaticParticle[] getBuffer()
public final int getBufferSize()
protected final PSVector[] getRelativePositions()
protected final PSVector[] getCumulativePositions()
protected final float getCumulativeLength()
The cumulative length is calculated by summing the distance between each buffer element and that preceding it.
protected final float[] getTaperValues()
The returned array contains a taper value for each element within the buffer. Taper values are based on the cumulative length of the buffer trail and the relative position of each element within the trail. Values range between 1 for the first buffer element and 0 for the last.
public final void resizeBuffer(int s)
s
- buffer sizepublic BufferedParticle copy()
The returned contain an empty buffer the same size as that of the source
particle and will adhere to the rules defined in DynamicParticle.map()
.
copy
in class DynamicParticle
DynamicParticle
public final void map(BufferedParticle p)
The returned object takes a copy of all BufferedParticle 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 |