Defines one or many relationships between a fixed point and single particles.

var point = [0.5, 10.0, 3.0]
var a = 0, b = 1
var single = PointConstraint.create(point, a)
var many = PointConstraint.create(point, [a, b])
PointConstraint( position, a )
  • position Array (Vec3)

    Point position

  • a Int | Array

    Particle index or list of many indices

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

setPosition( x, y, z )

Set point position.

  • x Float
  • y Float
  • z Float
_count Int private

Number of constraint relations managed by this instance

_itemSize Int private

Number of particles per constraint relation

_offset Int private

Number of indices to save at beginning of index array

bufferVec3 Float32Array (Vec3) private

Vec3 buffer which stores point position.

indices Uint16Array

Particle indices defining constraint relations