@thi.ng/math 5.6.3 → 5.7.1
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 +7 -1
- package/README.md +4 -5
- package/interval.d.ts +8 -0
- package/interval.js +8 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2023-10-
|
|
3
|
+
- **Last updated**: 2023-10-30T14:31:56Z
|
|
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.
|
|
70
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 4.08 KB
|
|
71
71
|
|
|
72
72
|
## Dependencies
|
|
73
73
|
|
|
@@ -75,14 +75,13 @@ Package sizes (brotli'd, pre-treeshake): ESM: 4.06 KB
|
|
|
75
75
|
|
|
76
76
|
## Usage examples
|
|
77
77
|
|
|
78
|
-
Several
|
|
78
|
+
Several projects in this repo's
|
|
79
79
|
[/examples](https://github.com/thi-ng/umbrella/tree/develop/examples)
|
|
80
|
-
directory are using this package
|
|
81
|
-
|
|
82
|
-
A selection:
|
|
80
|
+
directory are using this package:
|
|
83
81
|
|
|
84
82
|
| Screenshot | Description | Live demo | Source |
|
|
85
83
|
|:-----------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------|:------------------------------------------------------------|:-----------------------------------------------------------------------------------------|
|
|
84
|
+
| <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
85
|
| <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
86
|
| <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
87
|
| <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.
|
|
3
|
+
"version": "5.7.1",
|
|
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": "
|
|
141
|
+
"gitHead": "bfa16829786146bd24df3cdbd44649a45a603e44\n"
|
|
142
142
|
}
|