Documentation
    Preparing search index...

    Function dragField

    • Linear drag — §27's drag volume without the volume (wrap it in volumeField to get one):

      a = −coefficient · v
      

      Linear (Stokes) drag, not quadratic. Real aerodynamic drag goes as −c|v|v above a very low Reynolds number; the linear law is chosen because it has an exact closed form under the emitter's semi-implicit Euler step, which is what makes it testable and predictable:

      vₙ = v₀ · (1 − coefficient · dt)ⁿ
      

      — geometric decay with ratio 1 − c·dt, the discrete image of v₀·e^(−ct). Two consequences worth knowing before authoring:

      • coefficient · dt < 1 or the sign flips each step; at coefficient · dt ≥ 2 the magnitude grows and the simulation diverges. At 60 Hz that is coefficient < 60. Nothing clamps this — the emitter's dt is not known here, and silently capping a coefficient would make the closed form false.
      • Terminal velocity under a constant g is g / coefficient, so coefficient reads as an inverse time constant in s⁻¹, not as a mass- or area-dependent physical drag coefficient.

      Quadratic drag is staged: it needs a documented low-speed regularisation to avoid a discontinuous derivative at v = 0, and §27 asks for a drag volume rather than for a particular law.

      Parameters

      • coefficient: number

        Inverse time constant in s⁻¹. 0 is a no-op field. Negative values add energy (v grows geometrically); that is not rejected, on the same footing as the emitter's restitution > 1.

      Returns ParticleForceField

      RangeError if coefficient is not finite.