Package toxi.physics3d
Class VerletSpring3D
java.lang.Object
toxi.physics3d.VerletSpring3D
- Direct Known Subclasses:
VerletConstrainedSpring3D
,VerletMinDistanceSpring3D
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).
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionSpring end points / particlesSpring end points / particles -
Constructor Summary
ConstructorDescriptionVerletSpring3D
(VerletParticle3D a, VerletParticle3D b, float len, float str) -
Method Summary
Modifier and TypeMethodDescriptionfinal float
final float
lockA
(boolean s) (Un)Locks the 1st end point of the spring.lockB
(boolean s) (Un)Locks the 2nd end point of the springsetRestLength
(float len) setStrength
(float strength)
-
Field Details
-
a
Spring end points / particles -
b
Spring end points / particles
-
-
Constructor Details
-
VerletSpring3D
- Parameters:
a
- 1st particleb
- 2nd particlelen
- desired rest lengthstr
- spring strength
-
-
Method Details
-
getRestLength
public final float getRestLength() -
getStrength
public final float getStrength() -
lockA
(Un)Locks the 1st end point of the spring. NOTE: this acts purely within the scope of this spring instance and does NOT callVerletParticle3D.lock()
- Parameters:
s
-- Returns:
- itself
-
lockB
(Un)Locks the 2nd end point of the spring- Parameters:
s
-- Returns:
- itself
-
setRestLength
-
setStrength
-