Package toxi.physics3d
Class ParticleString3D
java.lang.Object
toxi.physics3d.ParticleString3D
Utility builder/grouping/management class to connect a set of particles into
a physical string/thread. Custom spring types can be used by subclassing this
class and overwriting the
createSpring(VerletParticle3D, VerletParticle3D, float, float)
method.-
Field Summary
-
Constructor Summary
ConstructorDescriptionParticleString3D
(VerletPhysics3D physics, List<VerletParticle3D> plist, float strength) Takes a list of already created particles connects them into a continuous string using springs.ParticleString3D
(VerletPhysics3D physics, Vec3D pos, Vec3D step, int num, float mass, float strength) Creates a number of particles along a line and connects them into a string using springs. -
Method Summary
-
Field Details
-
particles
-
links
-
-
Constructor Details
-
ParticleString3D
Takes a list of already created particles connects them into a continuous string using springs.- Parameters:
physics
- physics engine instanceplist
- particle liststrength
- spring strength
-
ParticleString3D
public ParticleString3D(VerletPhysics3D physics, Vec3D pos, Vec3D step, int num, float mass, float strength) Creates a number of particles along a line and connects them into a string using springs.- Parameters:
physics
- physics enginepos
- start positionstep
- step direction & distance between successive particlesnum
- number of particlesmass
- particle massstrength
- spring strength
-
-
Method Details
-
clear
public void clear()Removes the entire string from the physics simulation, incl. all of its particles & springs. -
getHead
Returns the first particle of the string.- Returns:
- first particle
-
getNumParticles
public int getNumParticles()Returns number of particles of the string.- Returns:
- particle count
-
getTail
Returns last particle of the string.- Returns:
- last particle
-