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] )
src/constraints/AngleConstraint.js:15
-
angleFloat | ArrayAngle or angle range
[min, max]between particles -
aInt | ArrayParticle index or list of many constraint sets
-
[b]IntParticle index (only used if
ais not an array) -
[c]IntParticle index (only used if
ais not an array)
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/AngleConstraint.js:51
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
_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
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