|
||||||||||
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 | |
---|---|
toxi.geom.Rect |
bounds
Bounding box, by default set to null to disable |
java.util.ArrayList<Particle2DConstraint> |
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.Vec2D v)
Creates particle at the position of the passed in vector |
|
VerletParticle2D(toxi.geom.Vec2D 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 |
addConstraint(Particle2DConstraint c)
Adds the given constraint implementation to the list of constraints applied to this particle at each time step. |
VerletParticle2D |
addVelocity(toxi.geom.Vec2D v)
|
void |
applyConstraints()
|
VerletParticle2D |
clearVelocity()
|
toxi.geom.Vec2D |
getPreviousPosition()
Returns the particle's position at the most recent time step. |
float |
getWeight()
|
boolean |
isLocked()
|
VerletParticle2D |
lock()
Locks/immobilizes particle in space |
VerletParticle2D |
removeAllConstraints()
Removes any currently applied constraints from this particle. |
boolean |
removeConstraint(Particle2DConstraint c)
Attempts to remove the given constraint instance from the list of active constraints. |
VerletParticle2D |
scaleVelocity(float scl)
|
void |
setWeight(float w)
|
VerletParticle2D |
unlock()
Unlocks particle again |
Methods inherited from class toxi.geom.Vec2D |
---|
abs, add, add, addSelf, addSelf, angleBetween, angleBetween, clear, closestPointOnLine, closestPointOnTriangle, compareTo, constrain, constrain, copy, cross, distanceTo, distanceToSquared, dot, equals, equalsWithTolerance, floor, frac, fromTheta, getAbs, getComponent, getConstrained, getFloored, getFrac, getInverted, getLimited, getNormalized, getNormalizedTo, getPerpendicular, getReciprocal, getRotated, getSignum, hashCode, heading, interpolateTo, interpolateTo, interpolateToSelf, interpolateToSelf, intersectRayCircle, invert, isInCircle, isInRectangle, isInTriangle, isZeroVector, jitter, jitter, jitter, limit, magnitude, magSquared, max, max, maxSelf, min, min, minSelf, normalize, normalizeTo, perpendicular, pointInPolygon, randomVector, randomVector, reciprocal, rotate, scale, scale, scale, scaleSelf, scaleSelf, scaleSelf, set, set, setComponent, signum, sub, sub, subSelf, subSelf, tangentNormalOfEllipse, to3DXY, to3DXZ, to3DYZ, toArray, toCartesian, toPolar, toString |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public toxi.geom.Rect bounds
public java.util.ArrayList<Particle2DConstraint> constraints
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.Vec2D v)
v
- positionpublic VerletParticle2D(toxi.geom.Vec2D v, float w)
v
- positionw
- weightpublic VerletParticle2D(VerletParticle2D p)
p
- Method Detail |
---|
public VerletParticle2D addConstraint(Particle2DConstraint c)
c
- constraint instance
public VerletParticle2D addVelocity(toxi.geom.Vec2D v)
public void applyConstraints()
public VerletParticle2D clearVelocity()
public toxi.geom.Vec2D getPreviousPosition()
public float getWeight()
public boolean isLocked()
public VerletParticle2D lock()
public VerletParticle2D removeAllConstraints()
public boolean removeConstraint(Particle2DConstraint c)
c
- constraint to remove
public VerletParticle2D scaleVelocity(float scl)
public void setWeight(float w)
public VerletParticle2D unlock()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |