BoxConstraint
Defines an axis-aligned bounding box which constrains all particles in the system to its bounds.
var min = [-10.0, -10.0, -10.0]
var max = [10.0, 10.0, 10.0]
var box = BoxConstraint.create(min, max)
BoxConstraint( min, max )
src/constraints/BoxConstraint.js:16
-
minArray (Vec3)Bounds minimum
-
maxArray (Vec3)Bounds maximum
applyConstraint( index, p0, p1 )
protected
src/constraints/Constraint.js:90
Apply constraint to one set of particles defining a constrint relation.
Called _count times per relaxation loop.
-
indexIntConstraint set index -
p0Float32Array (Vec3)Reference toParticleSystem.positions -
p1Float32Array (Vec3)Reference toParticleSystem.positionsPrev
create( )
static
src/constraints/BoxConstraint.js:54
Create instance, accepts constructor arguments.
setBounds( min, max )
src/constraints/BoxConstraint.js:71
Set bounds
-
minArray (Vec3) -
maxArray (Vec3)
setIndices( indices, [a] )
src/constraints/Constraint.js:73
Set particle indices with Array or list of arguments.
-
indicesInt | ArraySingle or many particle indices -
[a]Int (*..n)Particle index
setMin( x, y, z )
src/constraints/BoxConstraint.js:83
Set bounds minimum; alias for Vec3.set.
-
xFloat -
yFloat -
zFloat
setMin( x, y, z )
src/constraints/BoxConstraint.js:95
Set bounds maximum; alias for Vec3.set.
-
xFloat -
yFloat -
zFloat
_count Int
private
src/constraints/Constraint.js:37
Number of constraint relations managed by this instance
_itemSize Int
private
src/constraints/Constraint.js:46
Number of particles per constraint relation
_offset Int
private
src/constraints/Constraint.js:55
Number of indices to save at beginning of index array
bufferVec3 Float32Array (Vec3)
private
src/constraints/BoxConstraint.js:42
Vec3 buffer which stores bounds
friction Float
src/constraints/BoxConstraint.js:33
Damping factor to apply to particles being constrained to bounds
Default: 0.05
indices Uint16Array
src/constraints/Constraint.js:29
Particle indices defining constraint relations