BoundingPlaneConstraint
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] )
src/constraints/BoundingPlaneConstraint.js:15
-
originArray (Vec3)Plane origin
-
normalArray (Vec3)Plane normal / orientation
-
[distance]FloatMaximum positive distance to affect particles
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/BoundingPlaneConstraint.js:68
Create instance, accepts constructor arguments.
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
setNormal( x, y, z )
src/constraints/BoundingPlaneConstraint.js:97
Set normal (automatically normalizes vector)
-
xFloat -
yFloat -
zFloat
setOrigin( x, y, z )
src/constraints/BoundingPlaneConstraint.js:85
Set origin
-
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/BoundingPlaneConstraint.js:55
Vec3 buffer which stores plane origin and normal
distance Float
src/constraints/BoundingPlaneConstraint.js:33
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
src/constraints/BoundingPlaneConstraint.js:46
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