PlaneConstraint

Defines one or many relationships between an infinite plane and single particles.

Orientaiton of the plane is defined by 3 points: planeA, planeB, and planeC.

var planeA = 0, planeB = 1, planeC = 2
var a = 3, b = 4, c = 5
var single = PlaneConstraint.create(planeA, planeB, planeC, a)
var many = PlaneConstraint.create(planeA, planeB, planeC, [a, b, c])
PlaneConstraint( planeA, planeB, planeC, a )
src/constraints/PlaneConstraint.js:15
  • planeA Int

    Particle index defining point on plane

  • planeB Int

    Particle index defining point on plane

  • planeC Int

    Particle index defining point on plane

  • a Int | Array

    Particle index or list of many indices

_calculateNormal( index, p0 ) private
src/constraints/PlaneConstraint.js:77

Calculate and cache plane normal vector. Calculated once per relaxation loop iteration.

  • index Int

    Constraint set index

  • p0 Float32Array (Vec3)

    Reference to ParticleSystem.positions

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
src/constraints/PlaneConstraint.js:53

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

setPlane( a, b, c )
src/constraints/PlaneConstraint.js:61

Set particles defining constraint plane

  • a Int

    Particle index point on plane

  • b Int

    Particle index point on plane

  • c Int

    Particle index point on plane

_count Int private
src/constraints/Constraint.js:37

Number of constraint relations managed by this instance

_hasNormal Bool private
src/constraints/PlaneConstraint.js:129

State of constraint's plane normal resolution

_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/PlaneConstraint.js:40

Vec3 buffer which stores plane normal.

indices Uint16Array
src/constraints/Constraint.js:29

Particle indices defining constraint relations