Particulate.js0.3.3

AngleConstraint

Defines one or many relationships between sets of three particles.

var a = 0, b = 1, c = 2
var single = AngleConstraint.create(Math.PI, a, b, c)
var many = AngleConstraint.create(Math.PI, [a, b, c, b, c, a])

Particles are constrained by a fixed angle or an angle range. The angle is defined by segments ab and bc.

var min = Math.PI * 0.25, max = Math.PI * 0.5
var fixed = AngleConstraint.create(max, 0, 1, 2)
var range = AngleConstraint.create([min, max], 0, 1, 2)
AngleConstraint( angle, a, [b], [c] )
• angle Float | Array

Angle or angle range [min, max] between particles

• a Int | Array

Particle index or list of many constraint sets

• [b] Int

Particle index (only used if a is not an array)

• [c] Int

Particle index (only used if a is not an array)

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.

setAngle( min, [max] )

Set angle

• min Float
• [max] Float
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
setMax( max )

Set maximum angle

• max Float
setMin( min )

Set minimum angle

• min Float
_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
_max Float private
src/constraints/AngleConstraint.js:101

Maximum angle

_min Float private
src/constraints/AngleConstraint.js:82

Minimum angle

_offset Int private
src/constraints/Constraint.js:55 Number of indices to save at beginning of index array
ANGLE_OBTUSE Float static final
src/constraints/AngleConstraint.js:115

Angle used to classify obtuse angles in constraint solver. For accute angles, only particles a and c are repositioned to satisfy the particle set's target angle. For obtuse angles, particle b is also repositioned.

Default: 3/4 Π

indices Uint16Array
src/constraints/Constraint.js:29 Particle indices defining constraint relations