@thi.ng/math 5.6.3 → 5.7.0

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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2023-10-23T07:37:37Z
3
+ - **Last updated**: 2023-10-27T16:56:24Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
9
9
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
10
  and/or version bumps of transitive dependencies.
11
11
 
12
+ ## [5.7.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/math@5.7.0) (2023-10-27)
13
+
14
+ #### 🚀 Features
15
+
16
+ - add foldback01() ([1272647](https://github.com/thi-ng/umbrella/commit/1272647))
17
+
12
18
  ## [5.6.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/math@5.6.0) (2023-08-24)
13
19
 
14
20
  #### 🚀 Features
package/README.md CHANGED
@@ -67,7 +67,7 @@ For Node.js REPL:
67
67
  const math = await import("@thi.ng/math");
68
68
  ```
69
69
 
70
- Package sizes (brotli'd, pre-treeshake): ESM: 4.06 KB
70
+ Package sizes (brotli'd, pre-treeshake): ESM: 4.08 KB
71
71
 
72
72
  ## Dependencies
73
73
 
@@ -83,6 +83,7 @@ A selection:
83
83
 
84
84
  | Screenshot | Description | Live demo | Source |
85
85
  |:-----------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------|:------------------------------------------------------------|:-----------------------------------------------------------------------------------------|
86
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/boid-basics.png" width="240"/> | Basic 2D boid simulation and spatial indexing neighbor lookups | [Demo](https://demo.thi.ng/umbrella/boid-basics/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/boid-basics) |
86
87
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/crypto-chart.png" width="240"/> | Basic crypto-currency candle chart with multiple moving averages plots | [Demo](https://demo.thi.ng/umbrella/crypto-chart/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/crypto-chart) |
87
88
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/hdom-canvas-particles.jpg" width="240"/> | 2D Bezier curve-guided particle system | [Demo](https://demo.thi.ng/umbrella/hdom-canvas-particles/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/hdom-canvas-particles) |
88
89
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/geom/geom-isoline.png" width="240"/> | Animated sine plasma effect visualized using contour lines | [Demo](https://demo.thi.ng/umbrella/iso-plasma/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/iso-plasma) |
package/interval.d.ts CHANGED
@@ -134,6 +134,14 @@ export declare const absMax: FnN2;
134
134
  * @param x - input value
135
135
  */
136
136
  export declare const foldback: FnN2;
137
+ /**
138
+ * Similar to {@link foldback}, but with fixed target range: Folds `x` into the
139
+ * closed [0..1] interval, using infinite internal reflection on either side of
140
+ * the interval.
141
+ *
142
+ * @param x
143
+ */
144
+ export declare const foldback01: FnN;
137
145
  /**
138
146
  * Returns true iff `x` is in closed interval `[min .. max]`
139
147
  *
package/interval.js CHANGED
@@ -181,6 +181,14 @@ export const absMax = (a, b) => (Math.abs(a) > Math.abs(b) ? a : b);
181
181
  * @param x - input value
182
182
  */
183
183
  export const foldback = (e, x) => x < -e || x > e ? Math.abs(Math.abs((x - e) % (4 * e)) - 2 * e) - e : x;
184
+ /**
185
+ * Similar to {@link foldback}, but with fixed target range: Folds `x` into the
186
+ * closed [0..1] interval, using infinite internal reflection on either side of
187
+ * the interval.
188
+ *
189
+ * @param x
190
+ */
191
+ export const foldback01 = (x) => ((x = Math.abs(x) % 2) > 1 ? 2 - x : x);
184
192
  /**
185
193
  * Returns true iff `x` is in closed interval `[min .. max]`
186
194
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/math",
3
- "version": "5.6.3",
3
+ "version": "5.7.0",
4
4
  "description": "Assorted common math functions & utilities",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -138,5 +138,5 @@
138
138
  "thi.ng": {
139
139
  "year": 2013
140
140
  },
141
- "gitHead": "8d46d9326a9f9b81d65e7e274446f5964f9942ac\n"
141
+ "gitHead": "502e8fa937677ff7bc4fbd0906d8c8b4b0b471e5\n"
142
142
  }