|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttoxi.geom.Vec2D
toxi.physics2d.VerletParticle2D
public class VerletParticle2D
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 |
---|
public toxi.geom.Rect bounds
public java.util.List<ParticleConstraint2D> constraints
public java.util.List<ParticleBehavior2D> behaviors
Constructor Detail |
---|
public VerletParticle2D(float x, float y)
x
- y
- public VerletParticle2D(float x, float y, float w)
x
- y
- w
- public VerletParticle2D(toxi.geom.ReadonlyVec2D v)
v
- positionpublic VerletParticle2D(toxi.geom.ReadonlyVec2D v, float w)
v
- positionw
- weightpublic VerletParticle2D(VerletParticle2D p)
p
- Method Detail |
---|
public VerletParticle2D addBehavior(ParticleBehavior2D behavior)
public VerletParticle2D addBehavior(ParticleBehavior2D behavior, float timeStep)
public VerletParticle2D addConstraint(ParticleConstraint2D c)
c
- constraint instance
public VerletParticle2D addForce(toxi.geom.Vec2D f)
public VerletParticle2D addVelocity(toxi.geom.Vec2D v)
public void applyBehaviors()
public void applyConstraints()
public VerletParticle2D clearForce()
public VerletParticle2D clearVelocity()
public final float getInvWeight()
public toxi.geom.Vec2D getPreviousPosition()
public toxi.geom.Vec2D getVelocity()
public final float getWeight()
public final boolean isLocked()
public VerletParticle2D lock()
public VerletParticle2D removeAllBehaviors()
public VerletParticle2D removeAllConstraints()
public boolean removeBehavior(ParticleBehavior2D c)
public boolean removeConstraint(ParticleConstraint2D c)
c
- constraint to remove
public VerletParticle2D scaleVelocity(float scl)
public VerletParticle2D setPreviousPosition(toxi.geom.Vec2D p)
public void setWeight(float w)
public VerletParticle2D unlock()
public void update()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |