j3d.examples.particles.influences
Class Attract

java.lang.Object
  extended by j3d.examples.particles.influences.Attract
All Implemented Interfaces:
IExternalInfluence

public class Attract
extends java.lang.Object
implements IExternalInfluence

Represents a point in space that attracts particles to that point based on the distance between the particle and the attracting point. Once inside the inner radius, the particle is killed. Care should be taken with the velocity of the particle relative to the inner radius. It is possible that the particle could accelerate through the inner radius during a time interval dt causing the particle to actually accelerate away from the point. This can be avoided by making the inner radius larger.


Constructor Summary
Attract()
           
Attract(float aRate, javax.vecmath.Point3d aLocation, float aRadius)
           
Attract(float aRate, javax.vecmath.Point3f aLocation)
           
Attract(float aRate, javax.vecmath.Point3f aLocation, float aRadius)
           
 
Method Summary
 void apply(Particle aParticle, float dt)
          Apply this (possibly time varying) influence to the particle for the time interval.
 void initializeParticle(Particle aParticle)
          Initialize a particle prior to the first emission.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Attract

public Attract()

Attract

public Attract(float aRate,
               javax.vecmath.Point3f aLocation)

Attract

public Attract(float aRate,
               javax.vecmath.Point3d aLocation,
               float aRadius)

Attract

public Attract(float aRate,
               javax.vecmath.Point3f aLocation,
               float aRadius)
Method Detail

initializeParticle

public void initializeParticle(Particle aParticle)
Description copied from interface: IExternalInfluence
Initialize a particle prior to the first emission.

Specified by:
initializeParticle in interface IExternalInfluence
Parameters:
aParticle - - the particle to initialize.

apply

public void apply(Particle aParticle,
                  float dt)
Description copied from interface: IExternalInfluence
Apply this (possibly time varying) influence to the particle for the time interval.

Specified by:
apply in interface IExternalInfluence
Parameters:
aParticle - - The particle to update
dt - - The time interval (in seconds) since the last apply