@thi.ng/matrices 2.1.76 → 2.2.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 +7 -1
- package/README.md +3 -1
- package/fit.d.ts +27 -0
- package/fit.js +30 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +13 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2023-
|
|
3
|
+
- **Last updated**: 2023-10-23T07:37:37Z
|
|
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
|
+
## [2.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/matrices@2.2.0) (2023-10-23)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- add fit23 & fit44() matrix ops ([e2040e1](https://github.com/thi-ng/umbrella/commit/e2040e1))
|
|
17
|
+
|
|
12
18
|
### [2.1.22](https://github.com/thi-ng/umbrella/tree/@thi.ng/matrices@2.1.22) (2022-08-16)
|
|
13
19
|
|
|
14
20
|
#### 🩹 Bug fixes
|
package/README.md
CHANGED
|
@@ -82,7 +82,7 @@ For Node.js REPL:
|
|
|
82
82
|
const matrices = await import("@thi.ng/matrices");
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 5.
|
|
85
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 5.08 KB
|
|
86
86
|
|
|
87
87
|
## Dependencies
|
|
88
88
|
|
|
@@ -107,6 +107,7 @@ A selection:
|
|
|
107
107
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/scenegraph.png" width="240"/> | 2D scenegraph & shape picking | [Demo](https://demo.thi.ng/umbrella/scenegraph/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/scenegraph) |
|
|
108
108
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/scenegraph-image.png" width="240"/> | 2D scenegraph & image map based geometry manipulation | [Demo](https://demo.thi.ng/umbrella/scenegraph-image/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/scenegraph-image) |
|
|
109
109
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/shader-graph.jpg" width="240"/> | Minimal shader graph developed during livestream #2 | [Demo](https://demo.thi.ng/umbrella/shader-graph/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-graph) |
|
|
110
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/simd-plot.png" width="240"/> | Fitting, transforming & plotting 10k data points per frame using SIMD | [Demo](https://demo.thi.ng/umbrella/simd-plot/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/simd-plot) |
|
|
110
111
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/soa-ecs-100k.png" width="240"/> | Entity Component System w/ 100k 3D particles | [Demo](https://demo.thi.ng/umbrella/soa-ecs/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/soa-ecs) |
|
|
111
112
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/text-canvas.png" width="240"/> | 3D wireframe textmode demo | [Demo](https://demo.thi.ng/umbrella/text-canvas/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/text-canvas) |
|
|
112
113
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/unbiased-normals.png" width="240"/> | Visual comparison of biased vs. unbiased normal vectors projected on the surface of a sphere | [Demo](https://demo.thi.ng/umbrella/unbiased-normals/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/unbiased-normals) |
|
|
@@ -125,6 +126,7 @@ A selection:
|
|
|
125
126
|
|
|
126
127
|
### Matrix creation
|
|
127
128
|
|
|
129
|
+
- `fit23` / `fit44`
|
|
128
130
|
- `rotation22` / `rotation23`
|
|
129
131
|
- `rotationAroundAxis33` / `rotationAroundAxis44`
|
|
130
132
|
- `rotationX33` / `rotationX44`
|
package/fit.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ReadonlyVec } from "@thi.ng/vectors";
|
|
2
|
+
import type { Mat } from "./api.js";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a 2x3 matrix which maps coordinates from a 2D source rect (defined by
|
|
5
|
+
* `srcPos` and `srcSize`) to a destination rect (`destPos` & `destSize`).
|
|
6
|
+
* Writes result matrix to `out` or creates new matrix if `out` is null.
|
|
7
|
+
*
|
|
8
|
+
* @param out
|
|
9
|
+
* @param srcPos
|
|
10
|
+
* @param srcSize
|
|
11
|
+
* @param destPos
|
|
12
|
+
* @param destSize
|
|
13
|
+
*/
|
|
14
|
+
export declare const fit23: (out: Mat | null, srcPos: ReadonlyVec, srcSize: ReadonlyVec, destPos: ReadonlyVec, destSize: ReadonlyVec) => import("@thi.ng/vectors").Vec;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a 4x4 matrix which maps coordinates from a 3D source AABB (defined by
|
|
17
|
+
* `srcPos` and `srcSize`) to a destination AABB (`destPos` & `destSize`).
|
|
18
|
+
* Writes result matrix to `out` or creates new matrix if `out` is null.
|
|
19
|
+
*
|
|
20
|
+
* @param out
|
|
21
|
+
* @param srcPos
|
|
22
|
+
* @param srcSize
|
|
23
|
+
* @param destPos
|
|
24
|
+
* @param destSize
|
|
25
|
+
*/
|
|
26
|
+
export declare const fit44: (out: Mat | null, srcPos: ReadonlyVec, srcSize: ReadonlyVec, destPos: ReadonlyVec, destSize: ReadonlyVec) => import("@thi.ng/vectors").Vec;
|
|
27
|
+
//# sourceMappingURL=fit.d.ts.map
|
package/fit.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { maddN2, maddN3 } from "@thi.ng/vectors/maddn";
|
|
2
|
+
import { mulN2 } from "@thi.ng/vectors/muln";
|
|
3
|
+
import { safeDiv2, safeDiv3 } from "@thi.ng/vectors/safe-div";
|
|
4
|
+
import { concat } from "./concat.js";
|
|
5
|
+
import { scale23, scale44 } from "./scale.js";
|
|
6
|
+
import { translation23, translation44 } from "./translation.js";
|
|
7
|
+
/**
|
|
8
|
+
* Creates a 2x3 matrix which maps coordinates from a 2D source rect (defined by
|
|
9
|
+
* `srcPos` and `srcSize`) to a destination rect (`destPos` & `destSize`).
|
|
10
|
+
* Writes result matrix to `out` or creates new matrix if `out` is null.
|
|
11
|
+
*
|
|
12
|
+
* @param out
|
|
13
|
+
* @param srcPos
|
|
14
|
+
* @param srcSize
|
|
15
|
+
* @param destPos
|
|
16
|
+
* @param destSize
|
|
17
|
+
*/
|
|
18
|
+
export const fit23 = (out, srcPos, srcSize, destPos, destSize) => concat(out, translation23(null, maddN2([], destSize, 0.5, destPos)), scale23(null, safeDiv2([], destSize, srcSize)), translation23(null, mulN2(null, maddN2([], srcSize, 0.5, srcPos), -1)));
|
|
19
|
+
/**
|
|
20
|
+
* Creates a 4x4 matrix which maps coordinates from a 3D source AABB (defined by
|
|
21
|
+
* `srcPos` and `srcSize`) to a destination AABB (`destPos` & `destSize`).
|
|
22
|
+
* Writes result matrix to `out` or creates new matrix if `out` is null.
|
|
23
|
+
*
|
|
24
|
+
* @param out
|
|
25
|
+
* @param srcPos
|
|
26
|
+
* @param srcSize
|
|
27
|
+
* @param destPos
|
|
28
|
+
* @param destSize
|
|
29
|
+
*/
|
|
30
|
+
export const fit44 = (out, srcPos, srcSize, destPos, destSize) => concat(out, translation44(null, maddN3([], destSize, 0.5, destPos)), scale44(null, safeDiv3([], destSize, srcSize)), translation44(null, mulN2(null, maddN3([], srcSize, 0.5, srcPos), -1)));
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/matrices",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Matrix & quaternion operations for 2D/3D geometry processing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -34,17 +34,17 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.9.
|
|
38
|
-
"@thi.ng/checks": "^3.4.
|
|
39
|
-
"@thi.ng/math": "^5.6.
|
|
40
|
-
"@thi.ng/vectors": "^7.7.
|
|
37
|
+
"@thi.ng/api": "^8.9.6",
|
|
38
|
+
"@thi.ng/checks": "^3.4.6",
|
|
39
|
+
"@thi.ng/math": "^5.6.3",
|
|
40
|
+
"@thi.ng/vectors": "^7.7.20"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@microsoft/api-extractor": "^7.
|
|
44
|
-
"@thi.ng/testament": "^0.3.
|
|
45
|
-
"rimraf": "^5.0.
|
|
43
|
+
"@microsoft/api-extractor": "^7.38.0",
|
|
44
|
+
"@thi.ng/testament": "^0.3.24",
|
|
45
|
+
"rimraf": "^5.0.5",
|
|
46
46
|
"tools": "^0.0.1",
|
|
47
|
-
"typedoc": "^0.25.
|
|
47
|
+
"typedoc": "^0.25.2",
|
|
48
48
|
"typescript": "^5.2.2"
|
|
49
49
|
},
|
|
50
50
|
"keywords": [
|
|
@@ -130,6 +130,9 @@
|
|
|
130
130
|
"./divn": {
|
|
131
131
|
"default": "./divn.js"
|
|
132
132
|
},
|
|
133
|
+
"./fit": {
|
|
134
|
+
"default": "./fit.js"
|
|
135
|
+
},
|
|
133
136
|
"./frustum": {
|
|
134
137
|
"default": "./frustum.js"
|
|
135
138
|
},
|
|
@@ -269,5 +272,5 @@
|
|
|
269
272
|
],
|
|
270
273
|
"year": 2018
|
|
271
274
|
},
|
|
272
|
-
"gitHead": "
|
|
275
|
+
"gitHead": "8d46d9326a9f9b81d65e7e274446f5964f9942ac\n"
|
|
273
276
|
}
|