toxi.physics2d
Class ParticlePath2D

java.lang.Object
  extended by toxi.geom.Spline2D
      extended by toxi.physics2d.ParticlePath2D

public class ParticlePath2D
extends toxi.geom.Spline2D

This class is used as a builder to dynamically construct a ParticleString2D following a given spline path, sampled at a fixed frequency/step distance. This functionality is needed especially when working with various obstacles/mechanic constraints which the string should flow/wrap around.


Field Summary
 
Fields inherited from class toxi.geom.Spline2D
bernstein, bi, coeffA, DEFAULT_RES, DEFAULT_TIGHTNESS, delta, pointList, vertices
 
Constructor Summary
ParticlePath2D()
           
ParticlePath2D(java.util.List<toxi.geom.Vec2D> points)
           
 
Method Summary
 java.util.List<VerletParticle2D> createParticles(VerletPhysics2D physics, int subDiv, float step, float mass)
          Creates particles along the spline at the fixed interval given.
 
Methods inherited from class toxi.geom.Spline2D
add, add, computeVertices, getDecimatedVertices, getDecimatedVertices, getEstimatedArcLength, getNumPoints, getPointList, getTightness, setPointList, setTightness, updateCoefficients
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParticlePath2D

public ParticlePath2D()

ParticlePath2D

public ParticlePath2D(java.util.List<toxi.geom.Vec2D> points)
Method Detail

createParticles

public java.util.List<VerletParticle2D> createParticles(VerletPhysics2D physics,
                                                        int subDiv,
                                                        float step,
                                                        float mass)
Creates particles along the spline at the fixed interval given. The precision of this interval will largely depend on the number of subdivision vertices created, but can be adjusted via the related parameter.

Parameters:
physics - physics instance
subDiv - number spline segment subdivisions
step - desired rest length between particles
mass - desired particle mass
Returns:
list of particles