ChargeInteraction

ChargeInteraction is a NearBehavior that calculates the charge repulsion/attraction forces between "nearby" particles. It follows Coulomb's law with k=2, which is arbitrarily chosen. Although charge interactions have infinite range, the default effective radius for this behavior is set to 100000 pixels. Many charge interactions can lead to instability.

Constructor

new ChargeInteraction(radius)

Instantiates new ChargeInteraction

Parameters:
NameTypeDefaultDescription
radiusNumber100000

effective interaction radius

Extends

Methods

applyBehavior(particle, timeStep, particles)

Apply behavior on particle and/or particles

Parameters:
NameTypeDescription
particleParticle
timeStepNumber
particlesArray.<Particle>

applyCorrection(particle, particles)

This class does not require final position corrections

Parameters:
NameTypeDescription
particleParticle
particlesArray.<Particle>

range() → {Array.<Number>}

Returns the effective range / defines the size of the nearby range

Returns:
Type: 
Array.<Number>