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
IntParticle index defining point on plane
-
planeB
IntParticle index defining point on plane
-
planeC
IntParticle index defining point on plane
-
a
Int | ArrayParticle 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
IntConstraint set index
-
p0
Float32Array (Vec3)Reference to
ParticleSystem.positions
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.
-
index
IntConstraint 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]
)
src/constraints/Constraint.js:73
Set particle indices with Array
or list of arguments
.
-
indices
Int | ArraySingle or many particle indices
-
[a]
Int (*..n)Particle index
setPlane
( a, b, c
)
src/constraints/PlaneConstraint.js:61
Set particles defining constraint plane
-
a
IntParticle index point on plane
-
b
IntParticle index point on plane
-
c
IntParticle 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
_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.