@thi.ng/matrices 2.3.36 → 2.4.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 +12 -1
- package/README.md +21 -19
- package/concat.d.ts +4 -4
- package/concat.js +1 -1
- package/determinant.js +18 -20
- package/invert.js +35 -41
- package/package.json +11 -11
- package/project.js +1 -2
- package/quat-euler.d.ts +2 -10
- package/quat-euler.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-
|
|
3
|
+
- **Last updated**: 2024-06-21T19:34:38Z
|
|
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,17 @@ 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.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/matrices@2.4.0) (2024-06-21)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- add AxisOrder type for quadFromEuler() ([f9722dd](https://github.com/thi-ng/umbrella/commit/f9722dd))
|
|
17
|
+
|
|
18
|
+
#### ♻️ Refactoring
|
|
19
|
+
|
|
20
|
+
- rename various rest args to be more semantically meaningful ([8088a56](https://github.com/thi-ng/umbrella/commit/8088a56))
|
|
21
|
+
- enforce uniform naming convention of internal functions ([56992b2](https://github.com/thi-ng/umbrella/commit/56992b2))
|
|
22
|
+
|
|
12
23
|
### [2.3.34](https://github.com/thi-ng/umbrella/tree/@thi.ng/matrices@2.3.34) (2024-04-20)
|
|
13
24
|
|
|
14
25
|
#### ♻️ Refactoring
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 193 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
|
@@ -92,7 +92,7 @@ For Node.js REPL:
|
|
|
92
92
|
const mat = await import("@thi.ng/matrices");
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 5.
|
|
95
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 5.06 KB
|
|
96
96
|
|
|
97
97
|
## Dependencies
|
|
98
98
|
|
|
@@ -107,23 +107,25 @@ Several projects in this repo's
|
|
|
107
107
|
[/examples](https://github.com/thi-ng/umbrella/tree/develop/examples)
|
|
108
108
|
directory are using this package:
|
|
109
109
|
|
|
110
|
-
| Screenshot | Description | Live demo
|
|
111
|
-
|
|
112
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-sdf-logo.jpg" width="240"/> | (Re)Constructing the thi.ng logo using a 2D signed-distance field | [Demo](https://demo.thi.ng/umbrella/geom-sdf-logo/)
|
|
113
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/
|
|
114
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
115
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/
|
|
116
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
117
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
118
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
119
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
120
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
121
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
122
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
123
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
124
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
125
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-
|
|
126
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-
|
|
110
|
+
| Screenshot | Description | Live demo | Source |
|
|
111
|
+
|:-------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------|:-------------------------------------------------------------|:------------------------------------------------------------------------------------------|
|
|
112
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-sdf-logo.jpg" width="240"/> | (Re)Constructing the thi.ng logo using a 2D signed-distance field | [Demo](https://demo.thi.ng/umbrella/geom-sdf-logo/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/geom-sdf-logo) |
|
|
113
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-webgl-attrib-pool.jpg" width="240"/> | Augmenting thi.ng/geom shapes for WebGL, using instancing & attribute buffers | [Demo](https://demo.thi.ng/umbrella/geom-webgl-attrib-pool/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/geom-webgl-attrib-pool) |
|
|
114
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-webgl-basics.jpg" width="240"/> | Converting thi.ng/geom shape types for WebGL | [Demo](https://demo.thi.ng/umbrella/geom-webgl-basics/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/geom-webgl-basics) |
|
|
115
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/hdom-canvas/hdom-canvas-shapes-results.png" width="240"/> | Various hdom-canvas shape drawing examples & SVG conversion / export | [Demo](https://demo.thi.ng/umbrella/hdom-canvas-shapes/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/hdom-canvas-shapes) |
|
|
116
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/ifs-fractal.jpg" width="240"/> | Barnsley fern IFS fractal renderer | [Demo](https://demo.thi.ng/umbrella/ifs-fractal/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/ifs-fractal) |
|
|
117
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/pointfree-geom.jpg" width="240"/> | Live coding playground for 2D geometry generation using @thi.ng/pointfree-lang | [Demo](https://demo.thi.ng/umbrella/pointfree-geom/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/pointfree-geom) |
|
|
118
|
+
| <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) |
|
|
119
|
+
| <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) |
|
|
120
|
+
| <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) |
|
|
121
|
+
| <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) |
|
|
122
|
+
| <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) |
|
|
123
|
+
| <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) |
|
|
124
|
+
| <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
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-cube.png" width="240"/> | WebGL multi-colored cube mesh | [Demo](https://demo.thi.ng/umbrella/webgl-cube/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-cube) |
|
|
126
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-cubemap.jpg" width="240"/> | WebGL cube maps with async texture loading | [Demo](https://demo.thi.ng/umbrella/webgl-cubemap/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-cubemap) |
|
|
127
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-grid.jpg" width="240"/> | WebGL instancing, animated grid | [Demo](https://demo.thi.ng/umbrella/webgl-grid/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-grid) |
|
|
128
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-msdf.jpg" width="240"/> | WebGL MSDF text rendering & particle system | [Demo](https://demo.thi.ng/umbrella/webgl-msdf/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-msdf) |
|
|
127
129
|
|
|
128
130
|
## API
|
|
129
131
|
|
package/concat.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Mat, ReadonlyMat } from "./api.js";
|
|
2
2
|
/**
|
|
3
|
-
* Concatenates / multiplies given matrices in left-to-right
|
|
4
|
-
* minimum of 2 input matrices must be given. If `out` is null, writes
|
|
3
|
+
* Concatenates / multiplies given matrices (min. 2 required) in left-to-right
|
|
4
|
+
* order. A minimum of 2 input matrices must be given. If `out` is null, writes
|
|
5
5
|
* result into `a`.
|
|
6
6
|
*
|
|
7
7
|
* @param out -
|
|
8
8
|
* @param a -
|
|
9
9
|
* @param b -
|
|
10
|
-
* @param
|
|
10
|
+
* @param rest -
|
|
11
11
|
*/
|
|
12
|
-
export declare const concat: (out: Mat | null, a: ReadonlyMat, b: ReadonlyMat, ...
|
|
12
|
+
export declare const concat: (out: Mat | null, a: ReadonlyMat, b: ReadonlyMat, ...rest: ReadonlyMat[]) => Mat;
|
|
13
13
|
//# sourceMappingURL=concat.d.ts.map
|
package/concat.js
CHANGED
package/determinant.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { dotC4, dotC6 } from "@thi.ng/vectors/dotc";
|
|
2
|
-
const
|
|
3
|
-
const dp6 = dotC6;
|
|
4
|
-
const det22 = (m) => dp4(m[0], m[3], -m[1], m[2]);
|
|
2
|
+
const det22 = (m) => dotC4(m[0], m[3], -m[1], m[2]);
|
|
5
3
|
const det23 = det22;
|
|
6
4
|
const det33 = (m) => {
|
|
7
5
|
const [m00, m01, m02, m10, m11, m12, m20, m21, m22] = m;
|
|
8
|
-
const d01 =
|
|
9
|
-
const d11 =
|
|
10
|
-
const d21 =
|
|
11
|
-
return
|
|
6
|
+
const d01 = dotC4(m22, m11, -m12, m21);
|
|
7
|
+
const d11 = dotC4(m12, m20, -m22, m10);
|
|
8
|
+
const d21 = dotC4(m21, m10, -m11, m20);
|
|
9
|
+
return dotC6(m00, d01, m01, d11, m02, d21);
|
|
12
10
|
};
|
|
13
11
|
const detCoeffs44 = (m) => {
|
|
14
12
|
const [
|
|
@@ -30,21 +28,21 @@ const detCoeffs44 = (m) => {
|
|
|
30
28
|
m33
|
|
31
29
|
] = m;
|
|
32
30
|
return [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
31
|
+
dotC4(m00, m11, -m01, m10),
|
|
32
|
+
dotC4(m00, m12, -m02, m10),
|
|
33
|
+
dotC4(m00, m13, -m03, m10),
|
|
34
|
+
dotC4(m01, m12, -m02, m11),
|
|
35
|
+
dotC4(m01, m13, -m03, m11),
|
|
36
|
+
dotC4(m02, m13, -m03, m12),
|
|
37
|
+
dotC4(m20, m31, -m21, m30),
|
|
38
|
+
dotC4(m20, m32, -m22, m30),
|
|
39
|
+
dotC4(m20, m33, -m23, m30),
|
|
40
|
+
dotC4(m21, m32, -m22, m31),
|
|
41
|
+
dotC4(m21, m33, -m23, m31),
|
|
42
|
+
dotC4(m22, m33, -m23, m32)
|
|
45
43
|
];
|
|
46
44
|
};
|
|
47
|
-
const det44FromCoeffs = (d) =>
|
|
45
|
+
const det44FromCoeffs = (d) => dotC6(d[0], d[11], -d[1], d[10], d[2], d[9]) + dotC6(d[3], d[8], -d[4], d[7], d[5], d[6]);
|
|
48
46
|
const det44 = (m) => det44FromCoeffs(detCoeffs44(m));
|
|
49
47
|
export {
|
|
50
48
|
det22,
|
package/invert.js
CHANGED
|
@@ -3,22 +3,18 @@ import { magSq4 } from "@thi.ng/vectors/magsq";
|
|
|
3
3
|
import { setC, setC4, setC6 } from "@thi.ng/vectors/setc";
|
|
4
4
|
import { vop } from "@thi.ng/vectors/vop";
|
|
5
5
|
import { det44FromCoeffs, detCoeffs44 } from "./determinant.js";
|
|
6
|
-
const dp4 = dotC4;
|
|
7
|
-
const dp6 = dotC6;
|
|
8
6
|
const invert = vop(1);
|
|
9
7
|
const invert22 = invert.add(4, (out, m) => {
|
|
10
8
|
const [m00, m01, m10, m11] = m;
|
|
11
|
-
let det =
|
|
12
|
-
if (det === 0)
|
|
13
|
-
return;
|
|
9
|
+
let det = dotC4(m00, m11, -m01, m10);
|
|
10
|
+
if (det === 0) return;
|
|
14
11
|
det = 1 / det;
|
|
15
12
|
return setC4(out || m, m11 * det, -m01 * det, -m10 * det, m00 * det);
|
|
16
13
|
});
|
|
17
14
|
const invert23 = invert.add(6, (out, m) => {
|
|
18
15
|
const [m00, m01, m10, m11, m20, m21] = m;
|
|
19
|
-
let det =
|
|
20
|
-
if (det === 0)
|
|
21
|
-
return;
|
|
16
|
+
let det = dotC4(m00, m11, -m01, m10);
|
|
17
|
+
if (det === 0) return;
|
|
22
18
|
det = 1 / det;
|
|
23
19
|
return setC6(
|
|
24
20
|
out || m,
|
|
@@ -26,37 +22,35 @@ const invert23 = invert.add(6, (out, m) => {
|
|
|
26
22
|
-m01 * det,
|
|
27
23
|
-m10 * det,
|
|
28
24
|
m00 * det,
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
dotC4(m10, m21, -m11, m20) * det,
|
|
26
|
+
dotC4(m01, m20, -m00, m21) * det
|
|
31
27
|
);
|
|
32
28
|
});
|
|
33
29
|
const invert33 = invert.add(9, (out, m) => {
|
|
34
30
|
const [m00, m01, m02, m10, m11, m12, m20, m21, m22] = m;
|
|
35
|
-
const d01 =
|
|
36
|
-
const d11 =
|
|
37
|
-
const d21 =
|
|
38
|
-
let det =
|
|
39
|
-
if (det === 0)
|
|
40
|
-
return;
|
|
31
|
+
const d01 = dotC4(m22, m11, -m12, m21);
|
|
32
|
+
const d11 = dotC4(m12, m20, -m22, m10);
|
|
33
|
+
const d21 = dotC4(m21, m10, -m11, m20);
|
|
34
|
+
let det = dotC6(m00, d01, m01, d11, m02, d21);
|
|
35
|
+
if (det === 0) return;
|
|
41
36
|
det = 1 / det;
|
|
42
37
|
return setC(
|
|
43
38
|
out || m,
|
|
44
39
|
d01 * det,
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
dotC4(-m22, m01, m02, m21) * det,
|
|
41
|
+
dotC4(m12, m01, -m02, m11) * det,
|
|
47
42
|
d11 * det,
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
dotC4(m22, m00, -m02, m20) * det,
|
|
44
|
+
dotC4(-m12, m00, m02, m10) * det,
|
|
50
45
|
d21 * det,
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
dotC4(-m21, m00, m01, m20) * det,
|
|
47
|
+
dotC4(m11, m00, -m01, m10) * det
|
|
53
48
|
);
|
|
54
49
|
});
|
|
55
50
|
const invert44 = invert.add(16, (out, m) => {
|
|
56
51
|
const coeffs = detCoeffs44(m);
|
|
57
52
|
let det = det44FromCoeffs(coeffs);
|
|
58
|
-
if (det === 0)
|
|
59
|
-
return;
|
|
53
|
+
if (det === 0) return;
|
|
60
54
|
det = 1 / det;
|
|
61
55
|
const [
|
|
62
56
|
m00,
|
|
@@ -79,28 +73,28 @@ const invert44 = invert.add(16, (out, m) => {
|
|
|
79
73
|
const [d00, d01, d02, d03, d04, d05, d06, d07, d08, d09, d10, d11] = coeffs;
|
|
80
74
|
return setC(
|
|
81
75
|
out || m,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
76
|
+
dotC6(m11, d11, -m12, d10, m13, d09) * det,
|
|
77
|
+
dotC6(-m01, d11, m02, d10, -m03, d09) * det,
|
|
78
|
+
dotC6(m31, d05, -m32, d04, m33, d03) * det,
|
|
79
|
+
dotC6(-m21, d05, m22, d04, -m23, d03) * det,
|
|
80
|
+
dotC6(-m10, d11, m12, d08, -m13, d07) * det,
|
|
81
|
+
dotC6(m00, d11, -m02, d08, m03, d07) * det,
|
|
82
|
+
dotC6(-m30, d05, m32, d02, -m33, d01) * det,
|
|
83
|
+
dotC6(m20, d05, -m22, d02, m23, d01) * det,
|
|
84
|
+
dotC6(m10, d10, -m11, d08, m13, d06) * det,
|
|
85
|
+
dotC6(-m00, d10, m01, d08, -m03, d06) * det,
|
|
86
|
+
dotC6(m30, d04, -m31, d02, m33, d00) * det,
|
|
87
|
+
dotC6(-m20, d04, m21, d02, -m23, d00) * det,
|
|
88
|
+
dotC6(-m10, d09, m11, d07, -m12, d06) * det,
|
|
89
|
+
dotC6(m00, d09, -m01, d07, m02, d06) * det,
|
|
90
|
+
dotC6(-m30, d03, m31, d01, -m32, d00) * det,
|
|
91
|
+
dotC6(m20, d03, -m21, d01, m22, d00) * det
|
|
98
92
|
);
|
|
99
93
|
});
|
|
100
94
|
const invertQ = (out, a) => {
|
|
101
95
|
let d = magSq4(a);
|
|
102
96
|
d = d > 0 ? -1 / d : 0;
|
|
103
|
-
return setC4(out || a, a[0] * d, a[1] * d, a[2] * d, a[3] *
|
|
97
|
+
return setC4(out || a, a[0] * d, a[1] * d, a[2] * d, -a[3] * d);
|
|
104
98
|
};
|
|
105
99
|
export {
|
|
106
100
|
invert,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/matrices",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Matrix & quaternion operations for 2D/3D geometry processing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/thi-ng/umbrella.git"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://
|
|
13
|
+
"homepage": "https://thi.ng/matrices",
|
|
14
14
|
"funding": [
|
|
15
15
|
{
|
|
16
16
|
"type": "github",
|
|
@@ -36,16 +36,16 @@
|
|
|
36
36
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.11.
|
|
40
|
-
"@thi.ng/checks": "^3.6.
|
|
41
|
-
"@thi.ng/math": "^5.
|
|
42
|
-
"@thi.ng/vectors": "^7.
|
|
39
|
+
"@thi.ng/api": "^8.11.3",
|
|
40
|
+
"@thi.ng/checks": "^3.6.5",
|
|
41
|
+
"@thi.ng/math": "^5.11.0",
|
|
42
|
+
"@thi.ng/vectors": "^7.11.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@microsoft/api-extractor": "^7.
|
|
46
|
-
"esbuild": "^0.
|
|
47
|
-
"typedoc": "^0.25.
|
|
48
|
-
"typescript": "^5.
|
|
45
|
+
"@microsoft/api-extractor": "^7.47.0",
|
|
46
|
+
"esbuild": "^0.21.5",
|
|
47
|
+
"typedoc": "^0.25.13",
|
|
48
|
+
"typescript": "^5.5.2"
|
|
49
49
|
},
|
|
50
50
|
"keywords": [
|
|
51
51
|
"2d",
|
|
@@ -275,5 +275,5 @@
|
|
|
275
275
|
],
|
|
276
276
|
"year": 2018
|
|
277
277
|
},
|
|
278
|
-
"gitHead": "
|
|
278
|
+
"gitHead": "154c95cf9d6bab32174498ec3b5b5d87e42be7f9\n"
|
|
279
279
|
}
|
package/project.js
CHANGED
package/quat-euler.d.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
xyz: import("@thi.ng/vectors/api").ReadonlyVec[];
|
|
3
|
-
yxz: import("@thi.ng/vectors/api").ReadonlyVec[];
|
|
4
|
-
xzy: import("@thi.ng/vectors/api").ReadonlyVec[];
|
|
5
|
-
zxy: import("@thi.ng/vectors/api").ReadonlyVec[];
|
|
6
|
-
yzx: import("@thi.ng/vectors/api").ReadonlyVec[];
|
|
7
|
-
zyx: import("@thi.ng/vectors/api").ReadonlyVec[];
|
|
8
|
-
};
|
|
1
|
+
export type AxisOrder = "xyz" | "yxz" | "xzy" | "zxy" | "yzx" | "zyx";
|
|
9
2
|
/**
|
|
10
3
|
* Constructs a quaternion from given rotation angles in specified
|
|
11
4
|
* `order`.
|
|
@@ -15,6 +8,5 @@ declare const axisOrder: {
|
|
|
15
8
|
* @param b -
|
|
16
9
|
* @param c -
|
|
17
10
|
*/
|
|
18
|
-
export declare const quatFromEuler: (order:
|
|
19
|
-
export {};
|
|
11
|
+
export declare const quatFromEuler: (order: AxisOrder, a: number, b: number, c: number) => import("@thi.ng/vectors/api").Vec;
|
|
20
12
|
//# sourceMappingURL=quat-euler.d.ts.map
|
package/quat-euler.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { X3, Y3, Z3 } from "@thi.ng/vectors/api";
|
|
2
2
|
import { mulQ } from "./mulq.js";
|
|
3
3
|
import { quatFromAxisAngle } from "./quat-axis-angle.js";
|
|
4
|
-
const
|
|
4
|
+
const AXIS_ORDER = {
|
|
5
5
|
xyz: [X3, Y3, Z3],
|
|
6
6
|
yxz: [Y3, X3, Z3],
|
|
7
7
|
xzy: [X3, Z3, Y3],
|
|
@@ -10,7 +10,7 @@ const axisOrder = {
|
|
|
10
10
|
zyx: [Z3, Y3, X3]
|
|
11
11
|
};
|
|
12
12
|
const quatFromEuler = (order, a, b, c) => {
|
|
13
|
-
const [aa, ab, ac] =
|
|
13
|
+
const [aa, ab, ac] = AXIS_ORDER[order];
|
|
14
14
|
return mulQ(
|
|
15
15
|
null,
|
|
16
16
|
mulQ([], quatFromAxisAngle(aa, a), quatFromAxisAngle(ab, b)),
|