new SpringConstraint(A, B, restLength, stiffness)
Creates an instance of pin constraint. This constraint will be used as rule
for modifying two particles (projection). The spring constraint defines the
distance that should exist between to particles through the rest length. The
stiffness determines how hard the constraint will act on the particles to try
to match the rest length.
Parameters:
Name | Type | Description |
---|---|---|
A |
number | Index of the first particle to constrain. |
B |
number | Index of the xecond particle to constrain. |
restLength |
number | Rest length between the particles. |
stiffness |
number | How hard the constraint will act. |
Methods
project(curPositions) → {boolean}
Adjusts the positions of the particles associated with the constraint in
order to satisfy it. This method will get called in the
ParticleSystem#satisfyConstraints.
Parameters:
Name | Type | Description |
---|---|---|
curPositions |
list | The current list of particles so it can be modified. |
Returns:
If the constraint is still alive, in oder words if it does
not have to be deleted.
- Type
- boolean