Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## toxi.physics
Class ParticleString

    java.lang.Object
      toxi.physics.ParticleString

    public class ParticleString

extends java.lang.Object

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(VerletParticle, VerletParticle, float, float)` method.

Field Summary
`java.util.List<VerletSpring>` | `links`
`java.util.List<VerletParticle>` | `particles`

Constructor Summary
`ParticleString(VerletPhysics physics, java.util.List<VerletParticle> plist, float strength)` Takes a list of already created particles connects them into a continuous string using springs.
`ParticleString(VerletPhysics physics, toxi.geom.Vec3D pos, toxi.geom.Vec3D 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.
`VerletParticle` | `getHead()` Returns the first particle of the string.
`int` | `getNumParticles()` Returns number of particles of the string.
`VerletParticle` | `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

### particles

    public java.util.List<VerletParticle> particles

### links

    public java.util.List<VerletSpring> links

Constructor Detail

### ParticleString

    public ParticleString(VerletPhysics physics,
                          java.util.List<VerletParticle> plist,
                          float strength)

  Takes a list of already created particles connects them into a continuous string using springs.

  Parameters:
    `physics` - physics engine instance
    `plist` - particle list
    `strength` - spring strength

### ParticleString

    public ParticleString(VerletPhysics physics,
                          toxi.geom.Vec3D pos,
                          toxi.geom.Vec3D step,
                          int num,
                          float mass,
                          float strength)

  Creates a number of particles along a line and connects them into a string using springs.

  Parameters:
    `physics` - physics engine
    `pos` - start position
    `step` - step direction & distance between successive particles
    `num` - number of particles
    `mass` - particle mass
    `strength` - spring strength

Method Detail

### clear

    public void clear()

  Removes the entire string from the physics simulation, incl. all of its particles & springs.

### getHead

    public VerletParticle getHead()

  Returns the first particle of the string.

  Returns:
    first particle

### getNumParticles

    public int getNumParticles()

  Returns number of particles of the string.

  Returns:
    particle count

### getTail

    public VerletParticle getTail()

  Returns last particle of the string.

  Returns:
    last particle

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD