Defines an infinite bounding plane which constrains all particles in the system.

var origin = [1.0, 2.0, 5.0]
var normal = [0.0, 1.0, 0.0]
var bounds = BoundingPlaneConstraint.create(origin, normal)
var plane = BoundingPlaneConstraint.create(origin, normal, Infinity)
BoundingPlaneConstraint( origin, normal, [distance] )
  • origin Array (Vec3)

    Plane origin

  • normal Array (Vec3)

    Plane normal / orientation

  • [distance] Float

    Maximum positive distance to affect particles

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.

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
setNormal( x, y, z )

Set normal (automatically normalizes vector)

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

Set origin

  • 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 plane origin and normal

distance Float

Positive distance from plane within which particles will be constrained.

A value of Infinity will constrain all particles to be inline with the plane, while the default of 0 constrains all particles to space in front of the plane relative to its origin and orientation normal.

Default: 0

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