@flighthq/math 0.5.1-next.3302.76ece6b → 0.5.1-next.4304.322dc96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/README.md +2 -2
  2. package/dist/angle.d.ts +13 -6
  3. package/dist/angle.d.ts.map +1 -1
  4. package/dist/angle.js +21 -6
  5. package/dist/angle.js.map +1 -1
  6. package/dist/clamp.d.ts +11 -7
  7. package/dist/clamp.d.ts.map +1 -1
  8. package/dist/clamp.js +17 -10
  9. package/dist/clamp.js.map +1 -1
  10. package/dist/comparison.d.ts +13 -9
  11. package/dist/comparison.d.ts.map +1 -1
  12. package/dist/comparison.js +25 -14
  13. package/dist/comparison.js.map +1 -1
  14. package/dist/constants.d.ts +17 -17
  15. package/dist/constants.d.ts.map +1 -1
  16. package/dist/constants.js +22 -20
  17. package/dist/constants.js.map +1 -1
  18. package/dist/contract.d.ts +16 -15
  19. package/dist/contract.d.ts.map +1 -1
  20. package/dist/contract.js +17 -15
  21. package/dist/contract.js.map +1 -1
  22. package/dist/hash.d.ts +19 -21
  23. package/dist/hash.d.ts.map +1 -1
  24. package/dist/hash.js +31 -29
  25. package/dist/hash.js.map +1 -1
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +2 -0
  28. package/dist/index.js.map +1 -1
  29. package/dist/interpolation.d.ts +19 -13
  30. package/dist/interpolation.d.ts.map +1 -1
  31. package/dist/interpolation.js +27 -18
  32. package/dist/interpolation.js.map +1 -1
  33. package/dist/interpolationAdvanced.d.ts +25 -22
  34. package/dist/interpolationAdvanced.d.ts.map +1 -1
  35. package/dist/interpolationAdvanced.js +41 -41
  36. package/dist/interpolationAdvanced.js.map +1 -1
  37. package/dist/nextPowerOfTwo.d.ts +13 -9
  38. package/dist/nextPowerOfTwo.d.ts.map +1 -1
  39. package/dist/nextPowerOfTwo.js +38 -37
  40. package/dist/nextPowerOfTwo.js.map +1 -1
  41. package/dist/numberTheory.d.ts +23 -18
  42. package/dist/numberTheory.d.ts.map +1 -1
  43. package/dist/numberTheory.js +40 -30
  44. package/dist/numberTheory.js.map +1 -1
  45. package/dist/random.d.ts +9 -16
  46. package/dist/random.d.ts.map +1 -1
  47. package/dist/random.js +14 -21
  48. package/dist/random.js.map +1 -1
  49. package/dist/randomDistributions.d.ts +54 -75
  50. package/dist/randomDistributions.d.ts.map +1 -1
  51. package/dist/randomDistributions.js +143 -137
  52. package/dist/randomDistributions.js.map +1 -1
  53. package/dist/randomRange.d.ts +13 -8
  54. package/dist/randomRange.d.ts.map +1 -1
  55. package/dist/randomRange.js +20 -13
  56. package/dist/randomRange.js.map +1 -1
  57. package/dist/rounding.d.ts +18 -19
  58. package/dist/rounding.d.ts.map +1 -1
  59. package/dist/rounding.js +32 -26
  60. package/dist/rounding.js.map +1 -1
  61. package/dist/rustTestSupport.d.ts +5 -0
  62. package/dist/rustTestSupport.d.ts.map +1 -0
  63. package/dist/rustTestSupport.js +14 -0
  64. package/dist/rustTestSupport.js.map +1 -0
  65. package/dist/scalar.d.ts +15 -18
  66. package/dist/scalar.d.ts.map +1 -1
  67. package/dist/scalar.js +24 -23
  68. package/dist/scalar.js.map +1 -1
  69. package/dist/statistics.d.ts +18 -13
  70. package/dist/statistics.d.ts.map +1 -1
  71. package/dist/statistics.js +153 -105
  72. package/dist/statistics.js.map +1 -1
  73. package/package.json +3 -4
  74. package/src/angle.test.ts +57 -41
  75. package/src/clamp.test.ts +26 -21
  76. package/src/comparison.test.ts +23 -18
  77. package/src/constants.test.ts +63 -58
  78. package/src/hash.test.ts +41 -33
  79. package/src/interpolation.test.ts +43 -32
  80. package/src/interpolationAdvanced.test.ts +74 -68
  81. package/src/nextPowerOfTwo.test.ts +45 -46
  82. package/src/numberTheory.test.ts +44 -41
  83. package/src/random.test.ts +51 -21
  84. package/src/randomDistributions.test.ts +361 -280
  85. package/src/randomRange.test.ts +78 -62
  86. package/src/rounding.test.ts +45 -29
  87. package/src/scalar.test.ts +32 -21
  88. package/src/statistics.test.ts +83 -67
package/dist/hash.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"hash.js","sourceRoot":"","sources":["../src/hash.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD;;;;;;;;;GASG;AACH,MAAM,UAAU,0BAA0B,CAAC,CAAS,EAAE,CAAS;IAC7D,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,CAAS,EAAE,CAAS;IACzC,OAAO,WAAW,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,MAAM,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS;IACpD,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,KAAa;IACrD,OAAO,UAAU,CAAC,IAAI,GAAG,CAAC,KAAK,GAAG,UAAU,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;IAClB,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACd,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACd,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,E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B,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,UAAU,EACV,cAAc,EACd,KAAK,EACL,MAAM,EACN,OAAO,EACP,QAAQ,EACR,OAAO,EACP,cAAc,EACd,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,IAAI,EACJ,QAAQ,EACR,eAAe,GAChB,MAAM,eAAe,CAAC;AAKvB,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,EACZ,UAAU,EACV,OAAO,EACP,OAAO,EACP,UAAU,EACV,GAAG,EACH,WAAW,EACX,mBAAmB,EACnB,UAAU,EACV,cAAc,EACd,MAAM,EACN,KAAK,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,SAAS,EACT,eAAe,EACf,OAAO,EACP,KAAK,EACL,GAAG,EACH,MAAM,EACN,MAAM,EACN,WAAW,EACX,UAAU,EACV,MAAM,EACN,OAAO,EACP,WAAW,EACX,MAAM,EACN,KAAK,EACL,YAAY,EACZ,GAAG,EACH,IAAI,EACJ,SAAS,EACT,IAAI,EACJ,MAAM,EACN,WAAW,EACX,cAAc,EACd,cAAc,EACd,cAAc,EACd,IAAI,EACJ,QAAQ,EACR,kBAAkB,EAClB,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,UAAU,EACV,cAAc,EACd,KAAK,EACL,MAAM,EACN,OAAO,EACP,QAAQ,EACR,OAAO,EACP,cAAc,EACd,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,IAAI,EACJ,QAAQ,EACR,eAAe,GAChB,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,4 @@
1
+ // Generated from crates/flight-math/src/lib.rs by flight-compiler.
2
+ // Rust is authoritative; run `npm run generate` after changing it.
1
3
  export { CIRCLE_KAPPA, DEG_TO_RAD, EPSILON, HALF_PI, RAD_TO_DEG, TAU, approxEqual, approxEqualRelative, approxZero, ceilPowerOfTwo, ceilTo, clamp, createRandomSource, createRandomSourceFromHash, damp, degToRad, deltaAngle, euclideanMod, factorial, floorPowerOfTwo, floorTo, fract, gcd, hash2D, hash3D, hashCombine, hashUint32, hypot2, inRange, inverseLerp, isEven, isOdd, isPowerOfTwo, lcm, lerp, lerpAngle, mean, median, moveTowards, nextMultipleOf, nextPowerOfTwo, normalizeAngle, pick, pingPong, previousPowerOfTwo, quantize, radToDeg, randomBool, randomExponential, randomGaussian, randomGaussianPair, randomInsideUnitDisc, randomInsideUnitSphere, randomInt, randomOnUnitCircle, randomOnUnitSphere, randomPoisson, randomRange, randomSign, randomWeighted, remap, repeat, roundTo, saturate, shuffle, shuffleInPlace, sign, smoothStep, smootherStep, standardDeviation, step, variance, weightedAverage, } from "./contract.js";
2
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,UAAU,EACV,OAAO,EACP,OAAO,EACP,UAAU,EACV,GAAG,EACH,WAAW,EACX,mBAAmB,EACnB,UAAU,EACV,cAAc,EACd,MAAM,EACN,KAAK,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,SAAS,EACT,eAAe,EACf,OAAO,EACP,KAAK,EACL,GAAG,EACH,MAAM,EACN,MAAM,EACN,WAAW,EACX,UAAU,EACV,MAAM,EACN,OAAO,EACP,WAAW,EACX,MAAM,EACN,KAAK,EACL,YAAY,EACZ,GAAG,EACH,IAAI,EACJ,SAAS,EACT,IAAI,EACJ,MAAM,EACN,WAAW,EACX,cAAc,EACd,cAAc,EACd,cAAc,EACd,IAAI,EACJ,QAAQ,EACR,kBAAkB,EAClB,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,UAAU,EACV,cAAc,EACd,KAAK,EACL,MAAM,EACN,OAAO,EACP,QAAQ,EACR,OAAO,EACP,cAAc,EACd,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,IAAI,EACJ,QAAQ,EACR,eAAe,GAChB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,mEAAmE;AAEnE,OAAO,EACL,YAAY,EACZ,UAAU,EACV,OAAO,EACP,OAAO,EACP,UAAU,EACV,GAAG,EACH,WAAW,EACX,mBAAmB,EACnB,UAAU,EACV,cAAc,EACd,MAAM,EACN,KAAK,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,SAAS,EACT,eAAe,EACf,OAAO,EACP,KAAK,EACL,GAAG,EACH,MAAM,EACN,MAAM,EACN,WAAW,EACX,UAAU,EACV,MAAM,EACN,OAAO,EACP,WAAW,EACX,MAAM,EACN,KAAK,EACL,YAAY,EACZ,GAAG,EACH,IAAI,EACJ,SAAS,EACT,IAAI,EACJ,MAAM,EACN,WAAW,EACX,cAAc,EACd,cAAc,EACd,cAAc,EACd,IAAI,EACJ,QAAQ,EACR,kBAAkB,EAClB,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,UAAU,EACV,cAAc,EACd,KAAK,EACL,MAAM,EACN,OAAO,EACP,QAAQ,EACR,OAAO,EACP,cAAc,EACd,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,IAAI,EACJ,QAAQ,EACR,eAAe,GAChB,MAAM,eAAe,CAAC"}
@@ -1,27 +1,33 @@
1
- /** Return the `t` value that maps to `value` in the range `[a, b]`.
1
+ /**
2
+ * Return the `t` value that maps to `value` in the range `[a, b]`.
2
3
  *
3
- * The inverse of `lerp`: `inverseLerp(lerp(a, b, t), a, b) === t` when
4
- * `a !== b`. Returns `0` when `a === b` to avoid division by zero.
4
+ * The inverse of `lerp`: `inverseLerp(a, b, lerp(a, b, t)) == t` when
5
+ * `a != b`. Returns `0` when `a == b` to avoid division by zero.
5
6
  */
6
7
  export declare function inverseLerp(a: number, b: number, value: number): number;
7
- /** Linearly interpolate between `a` and `b` by factor `t`.
8
+ /**
9
+ * Linearly interpolate between `a` and `b` by factor `t`.
8
10
  *
9
- * `t = 0` returns `a`; `t = 1` returns `b`. `t` is not clamped — pass a
10
- * saturated `t` for clamped behaviour. Safe in hot loops, no allocation.
11
+ * `t = 0` returns `a`; `t = 1` returns `b`. `t` is not clamped — pass a
12
+ * saturated `t` for clamped behaviour. Safe in hot loops, no allocation.
11
13
  */
12
14
  export declare function lerp(a: number, b: number, t: number): number;
13
- /** Linearly interpolate `value` from `[inMin, inMax]` into `[outMin, outMax]`.
15
+ /**
16
+ * Linearly interpolate `value` from `[inMin, inMax]` into `[outMin, outMax]`.
14
17
  *
15
- * Equivalent to `lerp(outMin, outMax, inverseLerp(inMin, inMax, value))`.
16
- * Input range is not clamped. Returns `outMin` when `inMin === inMax`.
18
+ * Equivalent to `lerp(outMin, outMax, inverseLerp(inMin, inMax, value))`.
19
+ * Input range is not clamped. Returns `outMin` when `inMin == inMax`.
17
20
  */
18
21
  export declare function remap(value: number, inMin: number, inMax: number, outMin: number, outMax: number): number;
19
- /** Hermite interpolation between `edge0` and `edge1` with a smooth ease curve.
22
+ /**
23
+ * Hermite interpolation between `edge0` and `edge1` with a smooth ease curve.
20
24
  *
21
- * Returns 0 for `x <= edge0`, 1 for `x >= edge1`, and smoothly interpolates
22
- * in between using `3t² - 2t³`. This is the same `smoothstep` found in GLSL.
25
+ * Returns 0 for `x <= edge0`, 1 for `x >= edge1`, and smoothly interpolates
26
+ * in between using `3t^2 - 2t^3`. This is the same `smoothstep` found in GLSL.
23
27
  */
24
28
  export declare function smoothStep(edge0: number, edge1: number, x: number): number;
25
- /** Returns 0 if `x < edge`, otherwise 1. The scalar step function from GLSL. */
29
+ /**
30
+ * Returns 0 if `x < edge`, otherwise 1. The scalar step function from GLSL.
31
+ */
26
32
  export declare function step(edge: number, x: number): number;
27
33
  //# sourceMappingURL=interpolation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interpolation.d.ts","sourceRoot":"","sources":["../src/interpolation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAGvE;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAIzG;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAI1E;AAED,gFAAgF;AAChF,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAEpD"}
1
+ {"version":3,"file":"interpolation.d.ts","sourceRoot":"","sources":["../src/interpolation.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAGvE;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAMzG;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAI1E;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAEpD"}
@@ -1,43 +1,52 @@
1
- /** Return the `t` value that maps to `value` in the range `[a, b]`.
1
+ // Generated from crates/flight-math/src/interpolation.rs by flight-compiler.
2
+ // Rust is authoritative; run `npm run generate` after changing it.
3
+ /**
4
+ * Return the `t` value that maps to `value` in the range `[a, b]`.
2
5
  *
3
- * The inverse of `lerp`: `inverseLerp(lerp(a, b, t), a, b) === t` when
4
- * `a !== b`. Returns `0` when `a === b` to avoid division by zero.
6
+ * The inverse of `lerp`: `inverseLerp(a, b, lerp(a, b, t)) == t` when
7
+ * `a != b`. Returns `0` when `a == b` to avoid division by zero.
5
8
  */
6
9
  export function inverseLerp(a, b, value) {
7
10
  const range = b - a;
8
- return range === 0 ? 0 : (value - a) / range;
11
+ return range === 0.0 ? 0.0 : (value - a) / range;
9
12
  }
10
- /** Linearly interpolate between `a` and `b` by factor `t`.
13
+ /**
14
+ * Linearly interpolate between `a` and `b` by factor `t`.
11
15
  *
12
- * `t = 0` returns `a`; `t = 1` returns `b`. `t` is not clamped — pass a
13
- * saturated `t` for clamped behaviour. Safe in hot loops, no allocation.
16
+ * `t = 0` returns `a`; `t = 1` returns `b`. `t` is not clamped — pass a
17
+ * saturated `t` for clamped behaviour. Safe in hot loops, no allocation.
14
18
  */
15
19
  export function lerp(a, b, t) {
16
20
  return a + (b - a) * t;
17
21
  }
18
- /** Linearly interpolate `value` from `[inMin, inMax]` into `[outMin, outMax]`.
22
+ /**
23
+ * Linearly interpolate `value` from `[inMin, inMax]` into `[outMin, outMax]`.
19
24
  *
20
- * Equivalent to `lerp(outMin, outMax, inverseLerp(inMin, inMax, value))`.
21
- * Input range is not clamped. Returns `outMin` when `inMin === inMax`.
25
+ * Equivalent to `lerp(outMin, outMax, inverseLerp(inMin, inMax, value))`.
26
+ * Input range is not clamped. Returns `outMin` when `inMin == inMax`.
22
27
  */
23
28
  export function remap(value, inMin, inMax, outMin, outMax) {
24
29
  const inRange = inMax - inMin;
25
- if (inRange === 0)
30
+ if (inRange === 0.0) {
26
31
  return outMin;
32
+ }
27
33
  return outMin + ((value - inMin) / inRange) * (outMax - outMin);
28
34
  }
29
- /** Hermite interpolation between `edge0` and `edge1` with a smooth ease curve.
35
+ /**
36
+ * Hermite interpolation between `edge0` and `edge1` with a smooth ease curve.
30
37
  *
31
- * Returns 0 for `x <= edge0`, 1 for `x >= edge1`, and smoothly interpolates
32
- * in between using `3t² - 2t³`. This is the same `smoothstep` found in GLSL.
38
+ * Returns 0 for `x <= edge0`, 1 for `x >= edge1`, and smoothly interpolates
39
+ * in between using `3t^2 - 2t^3`. This is the same `smoothstep` found in GLSL.
33
40
  */
34
41
  export function smoothStep(edge0, edge1, x) {
35
42
  const t = (x - edge0) / (edge1 - edge0);
36
- const s = t < 0 ? 0 : t > 1 ? 1 : t;
37
- return s * s * (3 - 2 * s);
43
+ const s = t < 0.0 ? 0.0 : t > 1.0 ? 1.0 : t;
44
+ return s * s * (3.0 - 2.0 * s);
38
45
  }
39
- /** Returns 0 if `x < edge`, otherwise 1. The scalar step function from GLSL. */
46
+ /**
47
+ * Returns 0 if `x < edge`, otherwise 1. The scalar step function from GLSL.
48
+ */
40
49
  export function step(edge, x) {
41
- return x < edge ? 0 : 1;
50
+ return x < edge ? 0.0 : 1.0;
42
51
  }
43
52
  //# sourceMappingURL=interpolation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"interpolation.js","sourceRoot":"","sources":["../src/interpolation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,CAAS,EAAE,CAAS,EAAE,KAAa;IAC7D,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC;IACpB,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;AAC/C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS;IAClD,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,KAAa,EAAE,KAAa,EAAE,MAAc,EAAE,MAAc;IAC/F,MAAM,OAAO,GAAG,KAAK,GAAG,KAAK,CAAC;IAC9B,IAAI,OAAO,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC;IACjC,OAAO,MAAM,GAA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,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,KAAa,EAAE,KAAa,EAAE,MAAc,EAAE,MAAc;IAC/F,MAAM,OAAO,GAAG,KAAK,GAAG,KAAK,CAAC;IAC9B,IAAI,OAAO,KAAK,GAAG,EAAE,CAAC;QACpB,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,OAAO,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;AAClE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,KAAa,EAAE,CAAS;IAChE,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;IACxC,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,IAAI,CAAC,IAAY,EAAE,CAAS;IAC1C,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AAC9B,CAAC"}
@@ -1,42 +1,45 @@
1
- /** Frame-rate-independent exponential decay toward `target`.
1
+ /**
2
+ * Frame-rate-independent exponential decay toward `target`.
2
3
  *
3
- * Equivalent to `lerp(current, target, 1 - exp(-lambda * deltaTime))`.
4
- * Higher `lambda` = faster convergence. This is the classic "damp" function
5
- * from Freya Holmér / Game Math — it does not overshoot and is independent of
6
- * frame rate. `deltaTime` should be in seconds.
4
+ * Equivalent to `lerp(current, target, 1 - exp(-lambda * deltaTime))`.
5
+ * Higher `lambda` = faster convergence. `deltaTime` should be in seconds.
7
6
  *
8
- * Returns `current` when `deltaTime <= 0` or `lambda <= 0`.
7
+ * Returns `current` when `deltaTime <= 0` or `lambda <= 0`.
9
8
  */
10
9
  export declare function damp(current: number, target: number, lambda: number, deltaTime: number): number;
11
- /** Linearly interpolate between two angles `a` and `b` (radians) by factor `t`,
12
- * taking the shortest arc.
10
+ /**
11
+ * Linearly interpolate between two angles `a` and `b` (radians) by factor `t`,
12
+ * taking the shortest arc.
13
13
  *
14
- * `t` is not clamped. The result wraps naturally; there is no explicit
15
- * `normalizeAngle` call on the output — callers that need the result in a
16
- * specific range should normalize it themselves.
14
+ * `t` is not clamped. The result wraps naturally; there is no explicit
15
+ * normalize call on the output.
17
16
  */
18
17
  export declare function lerpAngle(a: number, b: number, t: number): number;
19
- /** Move `current` toward `target` by at most `maxDelta`, without overshooting.
18
+ /**
19
+ * Move `current` toward `target` by at most `maxDelta`, without overshooting.
20
20
  *
21
- * `maxDelta` should be positive; passing a negative `maxDelta` moves away
22
- * from `target` instead.
21
+ * `maxDelta` should be positive; passing a negative `maxDelta` moves away
22
+ * from `target` instead.
23
23
  */
24
24
  export declare function moveTowards(current: number, target: number, maxDelta: number): number;
25
- /** Bounce `t` back and forth over `[0, length]` like a ping-pong ball.
25
+ /**
26
+ * Bounce `t` back and forth over `[0, length]` like a ping-pong ball.
26
27
  *
27
- * `pingPong(t, 1)` cycles: 0 → 1 → 0 → 1 → …
28
+ * `pingPong(t, 1)` cycles: 0 -> 1 -> 0 -> 1 -> ...
28
29
  */
29
30
  export declare function pingPong(t: number, length: number): number;
30
- /** Wrap `t` over `[0, length)`.
31
+ /**
32
+ * Wrap `t` over `[0, length)`.
31
33
  *
32
- * `repeat(1.6, 1)` → `0.6`. Analogous to Unity's `Mathf.Repeat`.
34
+ * `repeat(1.6, 1)` -> `0.6`. Analogous to Unity's `Mathf.Repeat`.
33
35
  */
34
36
  export declare function repeat(t: number, length: number): number;
35
- /** Hermite interpolation with a smoother quintic ease curve (Ken Perlin).
37
+ /**
38
+ * Hermite interpolation with a smoother quintic ease curve (Ken Perlin).
36
39
  *
37
- * Uses `6t⁵ - 15t⁴ + 10t³` — has zero first- _and_ second-derivative at the
38
- * edges, making it smoother than the cubic `smoothStep`. Commonly called
39
- * `smootherstep`. Returns 0 for `x <= edge0`, 1 for `x >= edge1`.
40
+ * Uses `6t^5 - 15t^4 + 10t^3` — has zero first- and second-derivative at the
41
+ * edges, making it smoother than the cubic `smoothStep`. Returns 0 for
42
+ * `x <= edge0`, 1 for `x >= edge1`.
40
43
  */
41
44
  export declare function smootherStep(edge0: number, edge1: number, x: number): number;
42
45
  //# sourceMappingURL=interpolationAdvanced.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interpolationAdvanced.d.ts","sourceRoot":"","sources":["../src/interpolationAdvanced.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAG/F;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAKjE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIrF;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAQ1D;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAMxD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAI5E"}
1
+ {"version":3,"file":"interpolationAdvanced.d.ts","sourceRoot":"","sources":["../src/interpolationAdvanced.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAK/F;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAOjE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMrF;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAI1D;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAI5E"}
@@ -1,75 +1,75 @@
1
- /** Frame-rate-independent exponential decay toward `target`.
1
+ // Generated from crates/flight-math/src/interpolation_advanced.rs by flight-compiler.
2
+ // Rust is authoritative; run `npm run generate` after changing it.
3
+ /**
4
+ * Frame-rate-independent exponential decay toward `target`.
2
5
  *
3
- * Equivalent to `lerp(current, target, 1 - exp(-lambda * deltaTime))`.
4
- * Higher `lambda` = faster convergence. This is the classic "damp" function
5
- * from Freya Holmér / Game Math — it does not overshoot and is independent of
6
- * frame rate. `deltaTime` should be in seconds.
6
+ * Equivalent to `lerp(current, target, 1 - exp(-lambda * deltaTime))`.
7
+ * Higher `lambda` = faster convergence. `deltaTime` should be in seconds.
7
8
  *
8
- * Returns `current` when `deltaTime <= 0` or `lambda <= 0`.
9
+ * Returns `current` when `deltaTime <= 0` or `lambda <= 0`.
9
10
  */
10
11
  export function damp(current, target, lambda, deltaTime) {
11
- if (deltaTime <= 0 || lambda <= 0)
12
+ if (deltaTime <= 0.0 || lambda <= 0.0) {
12
13
  return current;
14
+ }
13
15
  return target + (current - target) * Math.exp(-lambda * deltaTime);
14
16
  }
15
- /** Linearly interpolate between two angles `a` and `b` (radians) by factor `t`,
16
- * taking the shortest arc.
17
+ /**
18
+ * Linearly interpolate between two angles `a` and `b` (radians) by factor `t`,
19
+ * taking the shortest arc.
17
20
  *
18
- * `t` is not clamped. The result wraps naturally; there is no explicit
19
- * `normalizeAngle` call on the output — callers that need the result in a
20
- * specific range should normalize it themselves.
21
+ * `t` is not clamped. The result wraps naturally; there is no explicit
22
+ * normalize call on the output.
21
23
  */
22
24
  export function lerpAngle(a, b, t) {
23
- const TAU = Math.PI * 2;
24
- let diff = (((b - a) % TAU) + TAU) % TAU;
25
- if (diff > Math.PI)
26
- diff -= TAU;
25
+ const tau = Math.PI * 2.0;
26
+ let diff = (((b - a) % tau) + tau) % tau;
27
+ if (diff > Math.PI) {
28
+ diff -= tau;
29
+ }
27
30
  return a + diff * t;
28
31
  }
29
- /** Move `current` toward `target` by at most `maxDelta`, without overshooting.
32
+ /**
33
+ * Move `current` toward `target` by at most `maxDelta`, without overshooting.
30
34
  *
31
- * `maxDelta` should be positive; passing a negative `maxDelta` moves away
32
- * from `target` instead.
35
+ * `maxDelta` should be positive; passing a negative `maxDelta` moves away
36
+ * from `target` instead.
33
37
  */
34
38
  export function moveTowards(current, target, maxDelta) {
35
39
  const delta = target - current;
36
- if (Math.abs(delta) <= maxDelta)
40
+ if (Math.abs(delta) <= maxDelta) {
37
41
  return target;
42
+ }
38
43
  return current + Math.sign(delta) * maxDelta;
39
44
  }
40
- /** Bounce `t` back and forth over `[0, length]` like a ping-pong ball.
45
+ /**
46
+ * Bounce `t` back and forth over `[0, length]` like a ping-pong ball.
41
47
  *
42
- * `pingPong(t, 1)` cycles: 0 → 1 → 0 → 1 → …
48
+ * `pingPong(t, 1)` cycles: 0 -> 1 -> 0 -> 1 -> ...
43
49
  */
44
50
  export function pingPong(t, length) {
45
- // No guard on a non-positive length: the arithmetic yields NaN and NaN PROPAGATES. These functions do not
46
- // invent values — a silent 0 turns a loud upstream failure into a plausible number, and IEEE propagation
47
- // lowers for free where an explicit branch does not. Callers who want a warning get one from a guard
48
- // layer, not from silent coercion here.
49
- const cycle = 2 * length;
50
- const mod = ((t % cycle) + cycle) % cycle;
51
- return mod <= length ? mod : cycle - mod;
51
+ const cycle = 2.0 * length;
52
+ const modulo = ((t % cycle) + cycle) % cycle;
53
+ return modulo <= length ? modulo : cycle - modulo;
52
54
  }
53
- /** Wrap `t` over `[0, length)`.
55
+ /**
56
+ * Wrap `t` over `[0, length)`.
54
57
  *
55
- * `repeat(1.6, 1)` → `0.6`. Analogous to Unity's `Mathf.Repeat`.
58
+ * `repeat(1.6, 1)` -> `0.6`. Analogous to Unity's `Mathf.Repeat`.
56
59
  */
57
60
  export function repeat(t, length) {
58
- // No guard on a non-positive length: the arithmetic yields NaN and NaN PROPAGATES. These functions do not
59
- // invent values — a silent 0 turns a loud upstream failure into a plausible number, and IEEE propagation
60
- // lowers for free where an explicit branch does not. Callers who want a warning get one from a guard
61
- // layer, not from silent coercion here.
62
61
  return ((t % length) + length) % length;
63
62
  }
64
- /** Hermite interpolation with a smoother quintic ease curve (Ken Perlin).
63
+ /**
64
+ * Hermite interpolation with a smoother quintic ease curve (Ken Perlin).
65
65
  *
66
- * Uses `6t⁵ - 15t⁴ + 10t³` — has zero first- _and_ second-derivative at the
67
- * edges, making it smoother than the cubic `smoothStep`. Commonly called
68
- * `smootherstep`. Returns 0 for `x <= edge0`, 1 for `x >= edge1`.
66
+ * Uses `6t^5 - 15t^4 + 10t^3` — has zero first- and second-derivative at the
67
+ * edges, making it smoother than the cubic `smoothStep`. Returns 0 for
68
+ * `x <= edge0`, 1 for `x >= edge1`.
69
69
  */
70
70
  export function smootherStep(edge0, edge1, x) {
71
71
  const t = (x - edge0) / (edge1 - edge0);
72
- const s = t < 0 ? 0 : t > 1 ? 1 : t;
73
- return s * s * s * (s * (s * 6 - 15) + 10);
72
+ const s = t < 0.0 ? 0.0 : t > 1.0 ? 1.0 : t;
73
+ return s * s * s * (s * (s * 6.0 - 15.0) + 10.0);
74
74
  }
75
75
  //# sourceMappingURL=interpolationAdvanced.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"interpolationAdvanced.js","sourceRoot":"","sources":["../src/interpolationAdvanced.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,UAAU,IAAI,CAAC,OAAe,EAAE,MAAc,EAAE,MAAc,EAAE,SAAiB;IACrF,IAAI,SAAS,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;QAAE,OAAO,OAAO,CAAC;IAClD,OAAO,MAAM,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AACrE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS;IACvD,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;IACxB,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;IACzC,IAAI,IAAI,GAAG,IAAI,CAAC,EAAE;QAAE,IAAI,IAAI,GAAG,CAAC;IAChC,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC;AACtB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe,EAAE,MAAc,EAAE,Q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;AAC/C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,CAAS,EAAE,MAAc;IAChD,MAAM,KAAK,GAAG,GAAG,GAAG,MAAM,CAAC;IAC3B,MAAM,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;IAC7C,OAAO,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,MAAM,CAAC;AACpD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,CAAS,EAAE,MAAc;IAC9C,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;AAC1C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa,EAAE,KAAa,EAAE,CAAS;IAClE,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;IACxC,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AACnD,CAAC"}
@@ -1,22 +1,26 @@
1
- /** Return `true` if `n` is an integer power of two (i.e. 1, 2, 4, 8, …).
1
+ /**
2
+ * Return `true` if `n` is an integer power of two (i.e. 1, 2, 4, 8, ...).
2
3
  *
3
- * Returns `false` for `n <= 0`.
4
+ * Returns `false` for `n <= 0`.
4
5
  */
5
6
  export declare function isPowerOfTwo(n: number): boolean;
6
- /** Round `value` up to the nearest multiple of `multiple`.
7
+ /**
8
+ * Round `value` up to the nearest multiple of `multiple`.
7
9
  *
8
- * `nextMultipleOf(7, 4)` → `8`. When `multiple <= 0` the result is `value`.
10
+ * `nextMultipleOf(7.0, 4.0)` -> `8.0`. When `multiple <= 0` the result is `value`.
9
11
  */
10
12
  export declare function nextMultipleOf(value: number, multiple: number): number;
11
- /** Round `n` up to the next power of two.
13
+ /**
14
+ * Round `n` up to the next power of two.
12
15
  *
13
- * Uses integer bit-twiddling for stability on large values. Returns `1` for
14
- * `n <= 1`.
16
+ * Uses integer bit-twiddling for stability on large values. Returns `1` for
17
+ * `n <= 1`.
15
18
  */
16
19
  export declare function nextPowerOfTwo(n: number): number;
17
- /** Round `n` down to the largest power of two that is `<= n`.
20
+ /**
21
+ * Round `n` down to the largest power of two that is `<= n`.
18
22
  *
19
- * `previousPowerOfTwo(6)` → `4`. Returns `1` for `n <= 1`.
23
+ * `previousPowerOfTwo(6)` -> `4`. Returns `1` for `n <= 1`.
20
24
  */
21
25
  export declare function previousPowerOfTwo(n: number): number;
22
26
  //# sourceMappingURL=nextPowerOfTwo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nextPowerOfTwo.d.ts","sourceRoot":"","sources":["../src/nextPowerOfTwo.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAItE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAWhD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAepD"}
1
+ {"version":3,"file":"nextPowerOfTwo.d.ts","sourceRoot":"","sources":["../src/nextPowerOfTwo.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMtE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAWhD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAWpD"}
@@ -1,57 +1,58 @@
1
- /** Return `true` if `n` is an integer power of two (i.e. 1, 2, 4, 8, …).
1
+ // Generated from crates/flight-math/src/next_power_of_two.rs by flight-compiler.
2
+ // Rust is authoritative; run `npm run generate` after changing it.
3
+ /**
4
+ * Return `true` if `n` is an integer power of two (i.e. 1, 2, 4, 8, ...).
2
5
  *
3
- * Returns `false` for `n <= 0`.
6
+ * Returns `false` for `n <= 0`.
4
7
  */
5
8
  export function isPowerOfTwo(n) {
6
9
  return n > 0 && (n & (n - 1)) === 0;
7
10
  }
8
- /** Round `value` up to the nearest multiple of `multiple`.
11
+ /**
12
+ * Round `value` up to the nearest multiple of `multiple`.
9
13
  *
10
- * `nextMultipleOf(7, 4)` → `8`. When `multiple <= 0` the result is `value`.
14
+ * `nextMultipleOf(7.0, 4.0)` -> `8.0`. When `multiple <= 0` the result is `value`.
11
15
  */
12
16
  export function nextMultipleOf(value, multiple) {
13
- if (multiple <= 0)
17
+ if (multiple <= 0.0) {
14
18
  return value;
19
+ }
15
20
  const remainder = value % multiple;
16
- return remainder === 0 ? value : value + multiple - remainder;
21
+ return remainder === 0.0 ? value : value + multiple - remainder;
17
22
  }
18
- /** Round `n` up to the next power of two.
23
+ /**
24
+ * Round `n` up to the next power of two.
19
25
  *
20
- * Uses integer bit-twiddling for stability on large values. Returns `1` for
21
- * `n <= 1`.
26
+ * Uses integer bit-twiddling for stability on large values. Returns `1` for
27
+ * `n <= 1`.
22
28
  */
23
29
  export function nextPowerOfTwo(n) {
24
- if (n <= 1)
25
- return 1;
26
- // Decrement so exact powers of two are unchanged, then propagate the
27
- // highest set bit downward and add 1 to get the next power.
28
- n = (n - 1) | 0;
29
- n |= n >> 1;
30
- n |= n >> 2;
31
- n |= n >> 4;
32
- n |= n >> 8;
33
- n |= n >> 16;
34
- return (n + 1) >>> 0;
30
+ if (n <= 1) {
31
+ return 1 >>> 0;
32
+ }
33
+ let v = (n - 1) >>> 0;
34
+ v |= v >>> 1;
35
+ v |= v >>> 2;
36
+ v |= v >>> 4;
37
+ v |= v >>> 8;
38
+ v |= v >>> 16;
39
+ return ((v + 1) >>> 0) >>> 0;
35
40
  }
36
- /** Round `n` down to the largest power of two that is `<= n`.
41
+ /**
42
+ * Round `n` down to the largest power of two that is `<= n`.
37
43
  *
38
- * `previousPowerOfTwo(6)` → `4`. Returns `1` for `n <= 1`.
44
+ * `previousPowerOfTwo(6)` -> `4`. Returns `1` for `n <= 1`.
39
45
  */
40
46
  export function previousPowerOfTwo(n) {
41
- if (n <= 1)
42
- return 1;
43
- // Fill all bits below the highest set bit, then shift right by 1.
44
- //
45
- // The shift is UNSIGNED, matching nextPowerOfTwo's `>>> 0`. With a signed `>>` the fill leaves bit 31 set
46
- // for any input at or above 2^30, and sign extension then returned a NEGATIVE power of two — -1073741824
47
- // for both 2^30 and 2^31-1. The two functions are mirror images and the operator is the only place they
48
- // were allowed to differ.
49
- n = n | 0;
50
- n |= n >> 1;
51
- n |= n >> 2;
52
- n |= n >> 4;
53
- n |= n >> 8;
54
- n |= n >> 16;
55
- return (n + 1) >>> 1;
47
+ if (n <= 1) {
48
+ return 1 >>> 0;
49
+ }
50
+ let v = n;
51
+ v |= v >> 1;
52
+ v |= v >> 2;
53
+ v |= v >> 4;
54
+ v |= v >> 8;
55
+ v |= v >> 16;
56
+ return ((((v >>> 0) + 1) >>> 0) >>> 1) >>> 0;
56
57
  }
57
58
  //# sourceMappingURL=nextPowerOfTwo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"n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AI,CAAC,KAAK,CAAC,CAAC;IACb,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACd,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,CAAS;IAC1C,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACZ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACZ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACZ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACZ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACb,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;AAC/C,CAAC"}
@@ -1,33 +1,38 @@
1
- /** Return the factorial of non-negative integer `n`.
1
+ /**
2
+ * Return the factorial of non-negative integer `n`.
2
3
  *
3
- * `factorial(0)` → `1` by convention. Throws for negative inputs or
4
- * non-integer inputs (programmer error). Returns `Infinity` for `n > 170`
5
- * (above IEEE 754 double precision range).
4
+ * `factorial(0)` -> `1` by convention. Throws for negative inputs.
5
+ * Returns positive infinity for `n > 170` (above the IEEE 754 double-precision range).
6
6
  */
7
7
  export declare function factorial(n: number): number;
8
- /** Return the greatest common divisor of `a` and `b` (Euclidean algorithm).
8
+ /**
9
+ * Return the greatest common divisor of `a` and `b` (Euclidean algorithm).
9
10
  *
10
- * Operates on the absolute values of the inputs, so negative arguments are
11
- * accepted. Throws for non-finite inputs or when both `a` and `b` are `0`
12
- * (programmer errors — the GCD of zero and zero is undefined).
11
+ * Operates on the absolute values of the inputs, so negative arguments are
12
+ * accepted. Throws when both `a` and `b` are `0` (the GCD of zero and zero
13
+ * is undefined).
13
14
  */
14
15
  export declare function gcd(a: number, b: number): number;
15
- /** Return the squared distance `x² + y²`.
16
+ /**
17
+ * Return the squared distance `x^2 + y^2`.
16
18
  *
17
- * Allocation-free substitute for `Math.hypot(x, y) ** 2` when you only need
18
- * to compare distances. Prefer `hypot2` over `Math.hypot` in hot loops where
19
- * the actual distance value is not needed.
19
+ * Allocation-free substitute for squaring `hypot(x, y)` when you only need
20
+ * to compare distances.
20
21
  */
21
22
  export declare function hypot2(x: number, y: number): number;
22
- /** Return `true` if `n` is even. */
23
+ /**
24
+ * Return `true` if `n` is even.
25
+ */
23
26
  export declare function isEven(n: number): boolean;
24
- /** Return `true` if `n` is odd. */
27
+ /**
28
+ * Return `true` if `n` is odd.
29
+ */
25
30
  export declare function isOdd(n: number): boolean;
26
- /** Return the least common multiple of `a` and `b`.
31
+ /**
32
+ * Return the least common multiple of `a` and `b`.
27
33
  *
28
- * Operates on the absolute values of the inputs. Throws when both `a` and
29
- * `b` are `0` (see `gcd`). For very large inputs, the result may exceed
30
- * `Number.MAX_SAFE_INTEGER` and lose precision.
34
+ * Operates on the absolute values of the inputs. Throws when both `a` and
35
+ * `b` are `0` (see `gcd`).
31
36
  */
32
37
  export declare function lcm(a: number, b: number): number;
33
38
  //# sourceMappingURL=numberTheory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"numberTheory.d.ts","sourceRoot":"","sources":["../src/numberTheory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAM3C;AAED;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAahD;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,oCAAoC;AACpC,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAEzC;AAED,mCAAmC;AACnC,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAExC;AAED;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAGhD"}
1
+ {"version":3,"file":"numberTheory.d.ts","sourceRoot":"","sources":["../src/numberTheory.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAc3C;AAED;;;;;;GAMG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAYhD;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAEzC;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAExC;AAED;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAGhD"}