UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

15 lines (14 loc) 662 B
/** * Kaiser Bessel Function of third kind (BesselJ(3,x)) * NOTE: this is an approximation, if input value is sufficiently large - results will be way off * This is a Tylor series approximation * @see https://www.shadertoy.com/view/wlf3RH * @returns {number} * @param {number} x */ export function bessel_3(x) { const y = 0.5 * x; const y2 = (y * y); // return (y2 * y * (1.0 / 6.0 + y2 * (1.0 / 24.0 + y2 * (1.0 / 240.0 + y2 * (1.0 / 4320.0 + y2 / 120960.0))))); return (y2 * y * (0.16666666666666666 + y2 * (0.041666666666666664 + y2 * (0.004166666666666667 + y2 * (2.314814814814815E-4 + y2 * 8.267195767195768E-6))))); }