|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectj3d.examples.particles.emitters.Particle
public class Particle
Represents the elementary particle of a particle system. Maintains position, velocity, acceleration and age of the particle. Assumes a cartesian coordinate representation of position, velocity, and acceleration. This implementation also includes rotational attributes normally associated with rigid bodies. Strictly speaking particles would not have rotational attributes and could be split out into a rigid body particle. I'll leave that as an exercise to the interested student. I would create a IParticle interface and factories for the primitive particle and rigid body particle so the emitter would not need to know which one was in use. Note: This implementation uses Euler's approach to numeric integration. This approach is simple but has the potential for significant error. Physical simulation implementations should use the Runge-Kutta order four method to significantly reduce the accumulated error. Implies a BY_REFERENCE implementation for Java3D by delegating some actions to the owning particle emitter.
Constructor Summary | |
---|---|
Particle(int indice,
ParticleEmitter emitter)
|
Method Summary | |
---|---|
void |
addLocalAcceleration(javax.vecmath.Vector3f anAcceleration)
|
void |
addWorldAcceleration(javax.vecmath.Vector3f anAcceleration)
|
void |
age(float dt)
|
void |
die()
Kill this particle before it's time. |
javax.vecmath.Quat4f |
getAngularVelocityDirection()
|
float |
getAngularVelocityMagnitude()
|
ParticleEmitter |
getEmitter()
|
javax.vecmath.Vector3f |
getEulerOrientation()
|
javax.vecmath.Vector3f |
getEulerRotationRate()
|
int |
getIndice()
|
float |
getLifeSpanPercentage()
|
javax.vecmath.Vector3f |
getLocalAcceleration()
|
float[] |
getLocalPosition()
|
javax.vecmath.Vector3f |
getLocalVelocity()
|
javax.vecmath.Quat4f |
getOrientation()
|
float |
getScale()
|
float[] |
getWorldPosition()
|
javax.vecmath.Vector3f |
getWorldVelocity()
|
boolean |
isAlive()
|
boolean |
isDead()
|
boolean |
isRotatable()
|
boolean |
isRotating()
|
void |
move(float dt)
Move this particle based on the current position, velocity, and acceleration. |
void |
rotate(float dt)
Rotate this particle based on the current rotational position and angular velocity. |
void |
setAngularVelocityDirection(javax.vecmath.Quat4f aQuat4f)
|
void |
setAngularVelocityMagnitude(float aMagnitude)
|
void |
setEulerOrientation(javax.vecmath.Vector3f anOrientation)
Set the rotational position of the particle by using Euler angles (in radians). |
void |
setEulerRotationRate(javax.vecmath.Vector3f aRate)
|
void |
setInitialLocalPosition(float x,
float y,
float z)
|
void |
setLocalPosition(float x,
float y,
float z)
|
void |
setLocalVelocity(javax.vecmath.Vector3f aVelocity)
|
void |
setOrientation(javax.vecmath.Quat4f aQuaternion)
|
void |
setRotatable(boolean aBoolean)
|
void |
setScale(float f)
|
void |
setWorldPosition(float x,
float y,
float z)
|
void |
setWorldVelocity(javax.vecmath.Vector3f worldVelocity)
|
void |
startRotating()
|
void |
stopRotating()
|
java.lang.String |
toString()
|
void |
update(float dt)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Particle(int indice, ParticleEmitter emitter)
Method Detail |
---|
public void addLocalAcceleration(javax.vecmath.Vector3f anAcceleration)
public void addWorldAcceleration(javax.vecmath.Vector3f anAcceleration)
public void age(float dt)
public void die()
public javax.vecmath.Quat4f getAngularVelocityDirection()
public float getAngularVelocityMagnitude()
public ParticleEmitter getEmitter()
public javax.vecmath.Vector3f getEulerOrientation()
public javax.vecmath.Vector3f getEulerRotationRate()
public int getIndice()
public float getLifeSpanPercentage()
public javax.vecmath.Vector3f getLocalAcceleration()
public float[] getLocalPosition()
public javax.vecmath.Vector3f getLocalVelocity()
public javax.vecmath.Quat4f getOrientation()
public float getScale()
public float[] getWorldPosition()
public javax.vecmath.Vector3f getWorldVelocity()
public boolean isAlive()
public boolean isDead()
public boolean isRotatable()
public boolean isRotating()
public void move(float dt)
dt
- - The time interval (in seconds) since the last move.public void rotate(float dt)
dt
- - The time interval (in seconds) since the last rotation.public void setAngularVelocityDirection(javax.vecmath.Quat4f aQuat4f)
public void setAngularVelocityMagnitude(float aMagnitude)
public void setEulerOrientation(javax.vecmath.Vector3f anOrientation)
anOrientation
- - a Vector3f containing the axis specific orientation.public void setEulerRotationRate(javax.vecmath.Vector3f aRate)
public void setInitialLocalPosition(float x, float y, float z)
public void setLocalPosition(float x, float y, float z)
public void setLocalVelocity(javax.vecmath.Vector3f aVelocity)
public void setRotatable(boolean aBoolean)
public void setOrientation(javax.vecmath.Quat4f aQuaternion)
public void setScale(float f)
public void setWorldPosition(float x, float y, float z)
public void setWorldVelocity(javax.vecmath.Vector3f worldVelocity)
public void startRotating()
public void stopRotating()
public java.lang.String toString()
toString
in class java.lang.Object
public void update(float dt)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |