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 VerletParticle

    java.lang.Object
      toxi.geom.Vec3D
          toxi.physics.VerletParticle

All Implemented Interfaces:
  java.lang.Comparable<toxi.geom.ReadonlyVec3D>, toxi.geom.ReadonlyVec3D

    public class VerletParticle

extends toxi.geom.Vec3D

An individual 3D particle for use by the VerletPhysics and VerletSpring classes. A particle has weight, can be locked in space and its position constrained inside an (optional) axis-aligned bounding box.

Nested Class Summary

Nested classes/interfaces inherited from class toxi.geom.Vec3D
`toxi.geom.Vec3D.Axis`

Field Summary
`java.util.List<ParticleBehavior>` | `behaviors`
`toxi.geom.AABB` | `bounds` Bounding box, by default set to null to disable
`java.util.List<ParticleConstraint>` | `constraints` An optional particle constraints, called immediately after a particle is updated (and only used if particle is unlocked (default)

Fields inherited from class toxi.geom.Vec3D
`MAX_VALUE, MIN_VALUE, x, X_AXIS, y, Y_AXIS, z, Z_AXIS, ZERO`

Constructor Summary
`VerletParticle(float x, float y, float z)` Creates particle at position xyz
`VerletParticle(float x, float y, float z, float w)` Creates particle at position xyz with weight w
`VerletParticle(toxi.geom.ReadonlyVec3D v)` Creates particle at the position of the passed in vector
`VerletParticle(toxi.geom.ReadonlyVec3D v, float w)` Creates particle with weight w at the position of the passed in vector
`VerletParticle(VerletParticle p)` Creates a copy of the passed in particle

Method Summary
`VerletParticle` | `addBehavior(ParticleBehavior behavior)`
`VerletParticle` | `addBehavior(ParticleBehavior behavior, float timeStep)`
`VerletParticle` | `addConstraint(ParticleConstraint c)` Adds the given constraint implementation to the list of constraints applied to this particle at each time step.
`VerletParticle` | `addForce(toxi.geom.Vec3D f)`
`VerletParticle` | `addVelocity(toxi.geom.Vec3D v)`
`void` | `applyBehaviors()`
`void` | `applyConstraints()`
`VerletParticle` | `clearConstraints()` Removes any currently applied constraints from this particle.
`VerletParticle` | `clearForce()`
`VerletParticle` | `clearVelocity()`
`float` | `getInvWeight()`
`toxi.geom.Vec3D` | `getPreviousPosition()` Returns the particle's position at the most recent time step.
`toxi.geom.Vec3D` | `getVelocity()`
`float` | `getWeight()`
`boolean` | `isLocked()`
`VerletParticle` | `lock()` Locks/immobilizes particle in space
`boolean` | `removeBehavior(ParticleBehavior b)`
`boolean` | `removeConstraint(ParticleConstraint c)` Attempts to remove the given constraint instance from the list of active constraints.
`VerletParticle` | `scaleVelocity(float scl)`
`VerletParticle` | `setPreviousPosition(toxi.geom.Vec3D p)`
`void` | `setWeight(float w)`
`VerletParticle` | `unlock()` Unlocks particle again
`void` | `update()`

Methods inherited from class toxi.geom.Vec3D
`abs, add, add, add, addSelf, addSelf, angleBetween, angleBetween, clear, compareTo, constrain, constrain, copy, cross, cross, crossInto, crossSelf, distanceTo, distanceToSquared, dot, dot, equals, equalsWithTolerance, floor, frac, fromXYTheta, fromXZTheta, fromYZTheta, getAbs, getComponent, getComponent, getConstrained, getFloored, getFrac, getInverted, getLimited, getNormalized, getNormalizedTo, getReciprocal, getReflected, getRotatedAroundAxis, getRotatedX, getRotatedY, getRotatedZ, getSignum, hashCode, headingXY, headingXZ, headingYZ, immutable, interpolateTo, interpolateTo, interpolateTo, interpolateTo, interpolateToSelf, interpolateToSelf, invert, isInAABB, isInAABB, isMajorAxis, isZeroVector, jitter, jitter, jitter, jitter, jitter, jitter, limit, magnitude, magSquared, max, maxSelf, min, minSelf, modSelf, modSelf, normalize, normalizeTo, randomVector, randomVector, reciprocal, reflect, rotateAroundAxis, rotateX, rotateY, rotateZ, roundToAxis, scale, scale, scale, scale, scaleSelf, scaleSelf, scaleSelf, set, set, set, setComponent, setComponent, setXY, shuffle, signum, sub, sub, sub, subSelf, subSelf, to2DXY, to2DXZ, to2DYZ, toArray, toArray4, toCartesian, toSpherical, toString, x, y, z`

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### bounds

    public toxi.geom.AABB bounds

  Bounding box, by default set to null to disable

### constraints

    public java.util.List<ParticleConstraint> constraints

  An optional particle constraints, called immediately after a particle is updated (and only used if particle is unlocked (default)

### behaviors

    public java.util.List<ParticleBehavior> behaviors

Constructor Detail

### VerletParticle

    public VerletParticle(float x,
                          float y,
                          float z)

  Creates particle at position xyz

  Parameters:
    `x` -
    `y` -
    `z` -

### VerletParticle

    public VerletParticle(float x,
                          float y,
                          float z,
                          float w)

  Creates particle at position xyz with weight w

  Parameters:
    `x` -
    `y` -
    `z` -
    `w` -

### VerletParticle

    public VerletParticle(toxi.geom.ReadonlyVec3D v)

  Creates particle at the position of the passed in vector

  Parameters:
    `v` - position

### VerletParticle

    public VerletParticle(toxi.geom.ReadonlyVec3D v,
                          float w)

  Creates particle with weight w at the position of the passed in vector

  Parameters:
    `v` - position
    `w` - weight

### VerletParticle

    public VerletParticle(VerletParticle p)

  Creates a copy of the passed in particle

  Parameters:
    `p` -

Method Detail

### addBehavior

    public VerletParticle addBehavior(ParticleBehavior behavior)

### addBehavior

    public VerletParticle addBehavior(ParticleBehavior behavior,
                                      float timeStep)

### addConstraint

    public VerletParticle addConstraint(ParticleConstraint c)

  Adds the given constraint implementation to the list of constraints applied to this particle at each time step.

  Parameters:
    `c` - constraint instance
  Returns:
    itself

### addForce

    public VerletParticle addForce(toxi.geom.Vec3D f)

### addVelocity

    public VerletParticle addVelocity(toxi.geom.Vec3D v)

### applyBehaviors

    public void applyBehaviors()

### applyConstraints

    public void applyConstraints()

### clearConstraints

    public VerletParticle clearConstraints()

  Removes any currently applied constraints from this particle.

  Returns:
    itself

### clearForce

    public VerletParticle clearForce()

### clearVelocity

    public VerletParticle clearVelocity()

### getInvWeight

    public final float getInvWeight()

  Returns:
    the inverse weight (1/weight)

### getPreviousPosition

    public toxi.geom.Vec3D getPreviousPosition()

  Returns the particle's position at the most recent time step.

  Returns:
    previous position

### getVelocity

    public toxi.geom.Vec3D getVelocity()

### getWeight

    public final float getWeight()

  Returns:
    the weight

### isLocked

    public final boolean isLocked()

  Returns:
    true, if particle is locked

### lock

    public VerletParticle lock()

  Locks/immobilizes particle in space

  Returns:
    itself

### removeBehavior

    public boolean removeBehavior(ParticleBehavior b)

### removeConstraint

    public boolean removeConstraint(ParticleConstraint c)

  Attempts to remove the given constraint instance from the list of active constraints.

  Parameters:
    `c` - constraint to remove
  Returns:
    true, if successfully removed

### scaleVelocity

    public VerletParticle scaleVelocity(float scl)

### setPreviousPosition

    public VerletParticle setPreviousPosition(toxi.geom.Vec3D p)

### setWeight

    public void setWeight(float w)

### unlock

    public VerletParticle unlock()

  Unlocks particle again

  Returns:
    itself

### update

    public void update()

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