Documentation
    Preparing search index...

    Function radialField

    • §27's radial gravity / attractor / repulsor: an inverse-square field pointing along the line from center to the sample point.

      r = position − center
      d = |r|
      a = strength · (r / d) / max(d, minDistance)²
      

      — magnitude |strength| / max(d, minDistance)², direction radial, and nothing else: the returned vector has no tangential component at all, which is what makes it composable with vortexField.

      Sign convention: positive strength pushes outward (a repulsor), negative pulls inward (an attractor). §27's "radial gravity" is therefore radialField(center, -mu). The convention is "along +r̂", chosen because it is the one that can be read off the formula rather than remembered.

      Falloff: inverse-square, pinned (WP-9.2). Linear falloff was the alternative the plan allowed. Inverse-square wins because it is the physical law §27 names ("radial gravity"), because strength then reads as a standard gravitational parameter μ = G·M in units³/s², and because it is the law under which the emitter's semi-implicit integrator is symplectic and therefore does not pump energy into a closed orbit. A configurable falloff exponent is staged: one law with an exact closed form is worth more today than three approximate ones.

      Exactly at the centre (d === 0) the direction is undefined, so the field contributes (0, 0, 0). Not NaN, and not an arbitrary axis — a particle sitting exactly on an attractor stays there, which is the only answer that does not depend on which way the floating-point noise happened to fall.

      Parameters

      • center: Vector3

        World position of the singularity, copied.

      • strength: number

        Signed μ in units³/s²; positive is outward.

      • Optionaloptions: RadialFieldOptions

      Returns ParticleForceField

      RangeError if any component of center, or strength, or options.minDistance, is not finite, or if minDistance <= 0.