cs567.particles
Class ParticleSystem

java.lang.Object
  extended by cs567.particles.ParticleSystem

public class ParticleSystem
extends java.lang.Object

Maintains dynamic lists of Particle and Force objects, and provides access to their state for numerical integration of dynamics.


Constructor Summary
ParticleSystem()
          Basic constructor.
 
Method Summary
 void addForce(Force f)
          Adds a force object (until removed)
 void advanceTime(double dt)
          Incomplete/Debugging implementation of Forward-Euler step.
 Particle createParticle(javax.vecmath.Point2d p0)
          Creates particle and adds it to the particle system.
 void display(javax.media.opengl.GL gl)
          Displays Particle and Force objects.
 Particle getNearestParticle(javax.vecmath.Point2d x)
          Helper-function that computes nearest particle to the specified (deformed) position.
 void removeForce(Force f)
          Useful for removing temporary forces, such as user-interaction spring forces.
 void reset()
          Moves all particles to undeformed/materials positions, and sets all velocities to zero.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParticleSystem

public ParticleSystem()
Basic constructor.

Method Detail

addForce

public void addForce(Force f)
Adds a force object (until removed)


removeForce

public void removeForce(Force f)
Useful for removing temporary forces, such as user-interaction spring forces.


createParticle

public Particle createParticle(javax.vecmath.Point2d p0)
Creates particle and adds it to the particle system.

Parameters:
p0 - Undeformed/material position.
Returns:
Reference to new Particle.

getNearestParticle

public Particle getNearestParticle(javax.vecmath.Point2d x)
Helper-function that computes nearest particle to the specified (deformed) position.

Returns:
Nearest particle, or null if no particles.

reset

public void reset()
Moves all particles to undeformed/materials positions, and sets all velocities to zero. Synchronized to avoid problems with simultaneous calls to advanceTime().


advanceTime

public void advanceTime(double dt)
Incomplete/Debugging implementation of Forward-Euler step. WARNING: Contains buggy debugging forces.


display

public void display(javax.media.opengl.GL gl)
Displays Particle and Force objects.