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 )
  • min Array (Vec3)

    Bounds minimum

  • max Array (Vec3)

    Bounds maximum

applyConstraint( index, p0, p1 ) protected
Defined in Constraint: src/constraints/Constraint.js:90 Apply constraint to one set of particles defining a constrint relation. Called _count times per relaxation loop.
  • index Int
    Constraint set index
  • p0 Float32Array (Vec3)
    Reference to ParticleSystem.positions
  • p1 Float32Array (Vec3)
    Reference to ParticleSystem.positionsPrev
create( ) static

Create instance, accepts constructor arguments.

setBounds( min, max )

Set bounds

  • min Array (Vec3)
  • max Array (Vec3)
setIndices( indices, [a] )
Defined in Constraint: src/constraints/Constraint.js:73 Set particle indices with Array or list of arguments.
  • indices Int | Array
    Single or many particle indices
  • [a] Int (*..n)
    Particle index
setMin( x, y, z )

Set bounds minimum; alias for Vec3.set.

  • x Float
  • y Float
  • z Float
setMin( x, y, z )

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
_isGlobal Bool private

Global constraint flag

_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

Vec3 buffer which stores bounds

friction Float

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