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
-
min
Array (Vec3)Bounds minimum
-
max
Array (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.
-
index
IntConstraint set index -
p0
Float32Array (Vec3)Reference toParticleSystem.positions
-
p1
Float32Array (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
-
min
Array (Vec3) -
max
Array (Vec3)
setIndices
( indices, [a]
)
src/constraints/Constraint.js:73
Set particle indices with Array
or list of arguments
.
-
indices
Int | 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
.
-
x
Float -
y
Float -
z
Float
setMin
( x, y, z
)
src/constraints/BoxConstraint.js:95
Set bounds maximum; alias for Vec3.set
.
-
x
Float -
y
Float -
z
Float
_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