|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttoxi.physics2d.VerletSpring2D
public class VerletSpring2D
A spring class connecting two VerletParticles in space. Based on the configuration of the spring instance and that of the physics engine, the behaviour of the spring can vary between springy and stiff/stick like.
The simulation takes particle weights into account and can be configured to lock either particle in space in order to force the other one to move. This is sometimes handy for resolving collisions (currently outside the scope of this library).
VerletPhysics
Field Summary | |
---|---|
VerletParticle2D |
a
Spring end points / particles |
VerletParticle2D |
b
Spring end points / particles |
Constructor Summary | |
---|---|
VerletSpring2D(VerletParticle2D a,
VerletParticle2D b,
float len,
float str)
|
Method Summary | |
---|---|
float |
getRestLength()
|
float |
getStrength()
|
VerletSpring2D |
lockA(boolean s)
(Un)Locks the 1st end point of the spring. |
VerletSpring2D |
lockB(boolean s)
(Un)Locks the 2nd end point of the spring |
VerletSpring2D |
setRestLength(float len)
|
VerletSpring2D |
setStrength(float strength)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public VerletParticle2D a
public VerletParticle2D b
Constructor Detail |
---|
public VerletSpring2D(VerletParticle2D a, VerletParticle2D b, float len, float str)
a
- 1st particleb
- 2nd particlelen
- desired rest lengthstr
- spring strengthMethod Detail |
---|
public float getRestLength()
public float getStrength()
public VerletSpring2D lockA(boolean s)
VerletParticle2D.lock()
s
-
public VerletSpring2D lockB(boolean s)
s
-
public VerletSpring2D setRestLength(float len)
public VerletSpring2D setStrength(float strength)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |