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.physics2d
Class VerletParticle2D

    java.lang.Object
      toxi.geom.Vec2D
          toxi.physics2d.VerletParticle2D

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

    public class VerletParticle2D

extends toxi.geom.Vec2D

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.Vec2D
`toxi.geom.Vec2D.Axis`

Field Summary
`java.util.List<ParticleBehavior2D>` | `behaviors`
`toxi.geom.Rect` | `bounds` Bounding box, by default set to null to disable
`java.util.List<ParticleConstraint2D>` | `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.Vec2D
`MAX_VALUE, MIN_VALUE, x, X_AXIS, y, Y_AXIS, ZERO`

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

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

Methods inherited from class toxi.geom.Vec2D
`abs, add, add, add, addSelf, addSelf, angleBetween, angleBetween, bisect, clear, compareTo, constrain, constrain, copy, cross, distanceTo, distanceToSquared, dot, equals, equalsWithTolerance, floor, frac, fromTheta, getAbs, getComponent, getComponent, getConstrained, getFloored, getFrac, getInverted, getLimited, getNormalized, getNormalizedTo, getPerpendicular, getReciprocal, getReflected, getRotated, getSignum, hashCode, heading, interpolateTo, interpolateTo, interpolateTo, interpolateTo, interpolateToSelf, interpolateToSelf, invert, isInCircle, isInRectangle, isInTriangle, isMajorAxis, isZeroVector, jitter, jitter, jitter, jitter, jitter, jitter, limit, magnitude, magSquared, max, max, maxSelf, min, min, minSelf, normalize, normalizeTo, perpendicular, randomVector, randomVector, reciprocal, reflect, rotate, roundToAxis, scale, scale, scale, scale, scaleSelf, scaleSelf, scaleSelf, set, set, set, setComponent, setComponent, signum, sub, sub, sub, subSelf, subSelf, tangentNormalOfEllipse, to3DXY, to3DXZ, to3DYZ, toArray, toCartesian, toPolar, toString, x, y`

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

Field Detail

### bounds

    public toxi.geom.Rect bounds

  Bounding box, by default set to null to disable

### constraints

    public java.util.List<ParticleConstraint2D> 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<ParticleBehavior2D> behaviors

Constructor Detail

### VerletParticle2D

    public VerletParticle2D(float x,
                            float y)

  Creates particle at position xyz

  Parameters:
    `x` -
    `y` -

### VerletParticle2D

    public VerletParticle2D(float x,
                            float y,
                            float w)

  Creates particle at position xyz with weight w

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

### VerletParticle2D

    public VerletParticle2D(toxi.geom.ReadonlyVec2D v)

  Creates particle at the position of the passed in vector

  Parameters:
    `v` - position

### VerletParticle2D

    public VerletParticle2D(toxi.geom.ReadonlyVec2D v,
                            float w)

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

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

### VerletParticle2D

    public VerletParticle2D(VerletParticle2D p)

  Creates a copy of the passed in particle

  Parameters:
    `p` -

Method Detail

### addBehavior

    public VerletParticle2D addBehavior(ParticleBehavior2D behavior)

### addBehavior

    public VerletParticle2D addBehavior(ParticleBehavior2D behavior,
                                        float timeStep)

### addConstraint

    public VerletParticle2D addConstraint(ParticleConstraint2D 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 VerletParticle2D addForce(toxi.geom.Vec2D f)

### addVelocity

    public VerletParticle2D addVelocity(toxi.geom.Vec2D v)

### applyBehaviors

    public void applyBehaviors()

### applyConstraints

    public void applyConstraints()

### clearForce

    public VerletParticle2D clearForce()

### clearVelocity

    public VerletParticle2D clearVelocity()

### getInvWeight

    public final float getInvWeight()

  Returns:
    the inverse weight (1/weight)

### getPreviousPosition

    public toxi.geom.Vec2D getPreviousPosition()

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

  Returns:
    previous position

### getVelocity

    public toxi.geom.Vec2D getVelocity()

### getWeight

    public final float getWeight()

  Returns:
    the weight

### isLocked

    public final boolean isLocked()

  Returns:
    true, if particle is locked

### lock

    public VerletParticle2D lock()

  Locks/immobilizes particle in space

  Returns:
    itself

### removeAllBehaviors

    public VerletParticle2D removeAllBehaviors()

### removeAllConstraints

    public VerletParticle2D removeAllConstraints()

  Removes any currently applied constraints from this particle.

  Returns:
    itself

### removeBehavior

    public boolean removeBehavior(ParticleBehavior2D c)

### removeConstraint

    public boolean removeConstraint(ParticleConstraint2D 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 VerletParticle2D scaleVelocity(float scl)

### setPreviousPosition

    public VerletParticle2D setPreviousPosition(toxi.geom.Vec2D p)

### setWeight

    public void setWeight(float w)

### unlock

    public VerletParticle2D 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