|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttoxi.physics2d.ParticleString2D
public class ParticleString2D
Utility builder/grouping/management class to connect a set of particles into
a physical string/thread. Custom spring types can be used by subclassing this
class and overwriting the
createSpring(VerletParticle2D, VerletParticle2D, float, float)
method.
Field Summary | |
---|---|
java.util.List<VerletSpring2D> |
links
|
java.util.List<VerletParticle2D> |
particles
|
Constructor Summary | |
---|---|
ParticleString2D(VerletPhysics2D physics,
java.util.List<VerletParticle2D> plist,
float strength)
Takes a list of already created particles connects them into a continuous string using springs. |
|
ParticleString2D(VerletPhysics2D physics,
toxi.geom.Vec2D pos,
toxi.geom.Vec2D step,
int num,
float mass,
float strength)
Creates a number of particles along a line and connects them into a string using springs. |
Method Summary | |
---|---|
void |
clear()
Removes the entire string from the physics simulation, incl. |
VerletParticle2D |
getHead()
Returns the first particle of the string. |
int |
getNumParticles()
Returns number of particles of the string. |
VerletParticle2D |
getTail()
Returns last particle of the string. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public java.util.List<VerletParticle2D> particles
public java.util.List<VerletSpring2D> links
Constructor Detail |
---|
public ParticleString2D(VerletPhysics2D physics, java.util.List<VerletParticle2D> plist, float strength)
physics
- physics engine instanceplist
- particle liststrength
- spring strengthpublic ParticleString2D(VerletPhysics2D physics, toxi.geom.Vec2D pos, toxi.geom.Vec2D step, int num, float mass, float strength)
physics
- physics enginepos
- start positionstep
- step direction & distance between successive particlesnum
- number of particlesmass
- particle massstrength
- spring strengthMethod Detail |
---|
public void clear()
public VerletParticle2D getHead()
public int getNumParticles()
public VerletParticle2D getTail()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |