@thi.ng/matrices 2.4.40 → 3.0.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2025-04-01T21:42:04Z
3
+ - **Last updated**: 2025-04-16T11:11:14Z
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.
@@ -11,6 +11,24 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
11
11
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
12
12
  and/or version bumps of transitive dependencies.
13
13
 
14
+ # [3.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/matrices@3.0.0) (2025-04-16)
15
+
16
+ #### 🛑 Breaking changes
17
+
18
+ - update to remove dynamic codegen ([#497](https://github.com/thi-ng/umbrella/issues/497)) ([7c6835e](https://github.com/thi-ng/umbrella/commit/7c6835e))
19
+ - BREAKING CHANGE: Refactoring & restructuring related to [#497](https://github.com/thi-ng/umbrella/issues/497)
20
+ - replace former codegen approach with higher-order functions
21
+ - add new`defMath()` & `defMathN()` impls
22
+
23
+ #### 🩹 Bug fixes
24
+
25
+ - minor update `identity()` ([222aea1](https://github.com/thi-ng/umbrella/commit/222aea1))
26
+ - use correct dispatch arg (due to change in [@thi.ng/vectors](https://github.com/thi-ng/umbrella/tree/main/packages/vectors))
27
+
28
+ #### ♻️ Refactoring
29
+
30
+ - minor internal optimizations (vector ops) ([696578e](https://github.com/thi-ng/umbrella/commit/696578e))
31
+
14
32
  ## [2.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/matrices@2.4.0) (2024-06-21)
15
33
 
16
34
  #### 🚀 Features
package/README.md CHANGED
@@ -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.06 KB
95
+ Package sizes (brotli'd, pre-treeshake): ESM: 5.19 KB
96
96
 
97
97
  ## Dependencies
98
98
 
package/add.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { add as _add, add4 } from "@thi.ng/vectors/add";
2
- import { defMath } from "./compile/emit.js";
2
+ import { $add } from "@thi.ng/vectors/ops";
3
+ import { defMath } from "./defmath.js";
3
4
  const add = _add;
4
5
  const add22 = add4;
5
- const [add23, add33, add44] = defMath(add, "+");
6
+ const [add23, add33, add44] = defMath($add);
6
7
  export {
7
8
  add,
8
9
  add22,
package/addn.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { addN as _addN, addN4 } from "@thi.ng/vectors/addn";
2
- import { defMathN } from "./compile/emit.js";
2
+ import { $add } from "@thi.ng/vectors/ops";
3
+ import { defMathN } from "./defmath.js";
3
4
  const addN = _addN;
4
5
  const addN22 = addN4;
5
- const [addN23, addN33, addN44] = defMathN(addN, "+");
6
+ const [addN23, addN33, addN44] = defMathN($add);
6
7
  export {
7
8
  addN,
8
9
  addN22,
@@ -8,5 +8,5 @@ import type { ReadonlyVec } from "@thi.ng/vectors";
8
8
  * @param to -
9
9
  * @param normalize -
10
10
  */
11
- export declare const alignmentQuat: (from: ReadonlyVec, to: ReadonlyVec, normalize?: boolean) => import("@thi.ng/vectors").Vec;
11
+ export declare const alignmentQuat: (from: ReadonlyVec, to: ReadonlyVec, normalize?: boolean) => import("@thi.ng/vectors").Vec<number>;
12
12
  //# sourceMappingURL=alignment-quat.d.ts.map
package/alignment-quat.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { cross3 } from "@thi.ng/vectors/cross";
2
2
  import { dot3 } from "@thi.ng/vectors/dot";
3
- import { mag } from "@thi.ng/vectors/mag";
3
+ import { mag3 } from "@thi.ng/vectors/mag";
4
4
  import { normalize3 } from "@thi.ng/vectors/normalize";
5
5
  import { quatFromAxisAngle } from "./quat-axis-angle.js";
6
6
  const alignmentQuat = (from, to, normalize = true) => {
@@ -9,7 +9,7 @@ const alignmentQuat = (from, to, normalize = true) => {
9
9
  to = normalize3([], to);
10
10
  }
11
11
  const axis = cross3([], from, to);
12
- return quatFromAxisAngle(axis, Math.atan2(mag(axis), dot3(from, to)));
12
+ return quatFromAxisAngle(axis, Math.atan2(mag3(axis), dot3(from, to)));
13
13
  };
14
14
  export {
15
15
  alignmentQuat
package/conjugate.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import type { ReadonlyVec, Vec } from "@thi.ng/vectors";
2
- export declare const conjugateQ: (out: Vec | null, a: ReadonlyVec) => Vec;
2
+ export declare const conjugateQ: (out: Vec | null, a: ReadonlyVec) => Vec<number>;
3
3
  //# sourceMappingURL=conjugate.d.ts.map
package/defmath.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import type { FnN2 } from "@thi.ng/api";
2
+ import type { MatOpMM, MatOpMN } from "./api.js";
3
+ /** @internal */
4
+ export declare const defMath: (op: FnN2) => [MatOpMM, MatOpMM, MatOpMM];
5
+ /** @internal */
6
+ export declare const defMathN: (op: FnN2) => [MatOpMN, MatOpMN, MatOpMN];
7
+ //# sourceMappingURL=defmath.d.ts.map
package/defmath.js ADDED
@@ -0,0 +1,94 @@
1
+ const defMath = (op) => [
2
+ (o, a, b) => {
3
+ !o && (o = a);
4
+ o[0] = op(a[0], b[0]);
5
+ o[1] = op(a[1], b[1]);
6
+ o[2] = op(a[2], b[2]);
7
+ o[3] = op(a[3], b[3]);
8
+ o[4] = op(a[4], b[4]);
9
+ o[5] = op(a[5], b[5]);
10
+ return o;
11
+ },
12
+ (o, a, b) => {
13
+ !o && (o = a);
14
+ o[0] = op(a[0], b[0]);
15
+ o[1] = op(a[1], b[1]);
16
+ o[2] = op(a[2], b[2]);
17
+ o[3] = op(a[3], b[3]);
18
+ o[4] = op(a[4], b[4]);
19
+ o[5] = op(a[5], b[5]);
20
+ o[6] = op(a[6], b[6]);
21
+ o[7] = op(a[7], b[7]);
22
+ o[8] = op(a[8], b[8]);
23
+ return o;
24
+ },
25
+ (o, a, b) => {
26
+ !o && (o = a);
27
+ o[0] = op(a[0], b[0]);
28
+ o[1] = op(a[1], b[1]);
29
+ o[2] = op(a[2], b[2]);
30
+ o[3] = op(a[3], b[3]);
31
+ o[4] = op(a[4], b[4]);
32
+ o[5] = op(a[5], b[5]);
33
+ o[6] = op(a[6], b[6]);
34
+ o[7] = op(a[7], b[7]);
35
+ o[8] = op(a[8], b[8]);
36
+ o[9] = op(a[9], b[9]);
37
+ o[10] = op(a[10], b[10]);
38
+ o[11] = op(a[11], b[11]);
39
+ o[12] = op(a[12], b[12]);
40
+ o[13] = op(a[13], b[13]);
41
+ o[14] = op(a[14], b[14]);
42
+ o[15] = op(a[15], b[15]);
43
+ return o;
44
+ }
45
+ ];
46
+ const defMathN = (op) => [
47
+ (o, a, n) => {
48
+ !o && (o = a);
49
+ o[0] = op(a[0], n);
50
+ o[1] = op(a[1], n);
51
+ o[2] = op(a[2], n);
52
+ o[3] = op(a[3], n);
53
+ o[4] = op(a[4], n);
54
+ o[5] = op(a[5], n);
55
+ return o;
56
+ },
57
+ (o, a, n) => {
58
+ !o && (o = a);
59
+ o[0] = op(a[0], n);
60
+ o[1] = op(a[1], n);
61
+ o[2] = op(a[2], n);
62
+ o[3] = op(a[3], n);
63
+ o[4] = op(a[4], n);
64
+ o[5] = op(a[5], n);
65
+ o[6] = op(a[6], n);
66
+ o[7] = op(a[7], n);
67
+ o[8] = op(a[8], n);
68
+ return o;
69
+ },
70
+ (o, a, n) => {
71
+ !o && (o = a);
72
+ o[0] = op(a[0], n);
73
+ o[1] = op(a[1], n);
74
+ o[2] = op(a[2], n);
75
+ o[3] = op(a[3], n);
76
+ o[4] = op(a[4], n);
77
+ o[5] = op(a[5], n);
78
+ o[6] = op(a[6], n);
79
+ o[7] = op(a[7], n);
80
+ o[8] = op(a[8], n);
81
+ o[9] = op(a[9], n);
82
+ o[10] = op(a[10], n);
83
+ o[11] = op(a[11], n);
84
+ o[12] = op(a[12], n);
85
+ o[13] = op(a[13], n);
86
+ o[14] = op(a[14], n);
87
+ o[15] = op(a[15], n);
88
+ return o;
89
+ }
90
+ ];
91
+ export {
92
+ defMath,
93
+ defMathN
94
+ };
package/div.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { div as _div, div4 } from "@thi.ng/vectors/div";
2
- import { defMath } from "./compile/emit.js";
2
+ import { $div } from "@thi.ng/vectors/ops";
3
+ import { defMath } from "./defmath.js";
3
4
  const div = _div;
4
5
  const div22 = div4;
5
- const [div23, div33, div44] = defMath(div, "/");
6
+ const [div23, div33, div44] = defMath($div);
6
7
  export {
7
8
  div,
8
9
  div22,
package/divn.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { divN as _divN, divN4 } from "@thi.ng/vectors/divn";
2
- import { defMathN } from "./compile/emit.js";
2
+ import { $div } from "@thi.ng/vectors/ops";
3
+ import { defMathN } from "./defmath.js";
3
4
  const divN = _divN;
4
5
  const divN22 = divN4;
5
- const [divN23, divN33, divN44] = defMathN(divN, "/");
6
+ const [divN23, divN33, divN44] = defMathN($div);
6
7
  export {
7
8
  divN,
8
9
  divN22,
package/fit.d.ts CHANGED
@@ -11,7 +11,7 @@ import type { Mat } from "./api.js";
11
11
  * @param destPos
12
12
  * @param destSize
13
13
  */
14
- export declare const fit23: (out: Mat | null, srcPos: ReadonlyVec, srcSize: ReadonlyVec, destPos: ReadonlyVec, destSize: ReadonlyVec) => import("@thi.ng/vectors").Vec;
14
+ export declare const fit23: (out: Mat | null, srcPos: ReadonlyVec, srcSize: ReadonlyVec, destPos: ReadonlyVec, destSize: ReadonlyVec) => Mat;
15
15
  /**
16
16
  * Creates a 4x4 matrix which maps coordinates from a 3D source AABB (defined by
17
17
  * `srcPos` and `srcSize`) to a destination AABB (`destPos` & `destSize`).
@@ -23,5 +23,5 @@ export declare const fit23: (out: Mat | null, srcPos: ReadonlyVec, srcSize: Read
23
23
  * @param destPos
24
24
  * @param destSize
25
25
  */
26
- export declare const fit44: (out: Mat | null, srcPos: ReadonlyVec, srcSize: ReadonlyVec, destPos: ReadonlyVec, destSize: ReadonlyVec) => import("@thi.ng/vectors").Vec;
26
+ export declare const fit44: (out: Mat | null, srcPos: ReadonlyVec, srcSize: ReadonlyVec, destPos: ReadonlyVec, destSize: ReadonlyVec) => Mat;
27
27
  //# sourceMappingURL=fit.d.ts.map
package/identity.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { vop } from "@thi.ng/vectors/vop";
2
2
  import { IDENT22, IDENT23, IDENT33, IDENT44 } from "./constants.js";
3
3
  import { set } from "./set.js";
4
- const identity = vop();
4
+ const identity = vop(0);
5
5
  const identity22 = identity.add(4, (m) => set(m, IDENT22));
6
6
  const identity23 = identity.add(6, (m) => set(m, IDENT23));
7
7
  const identity33 = identity.add(9, (m) => set(m, IDENT33));
package/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export * from "./api.js";
2
2
  export * from "./constants.js";
3
- export * from "./compile/emit.js";
4
3
  export * from "./add.js";
5
4
  export * from "./addn.js";
6
5
  export * from "./alignment-quat.js";
package/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  export * from "./api.js";
2
2
  export * from "./constants.js";
3
- export * from "./compile/emit.js";
4
3
  export * from "./add.js";
5
4
  export * from "./addn.js";
6
5
  export * from "./alignment-quat.js";
package/invert.d.ts CHANGED
@@ -12,5 +12,5 @@ export declare const invert22: MatOpMU;
12
12
  export declare const invert23: MatOpMU;
13
13
  export declare const invert33: MatOpMU;
14
14
  export declare const invert44: MatOpMU;
15
- export declare const invertQ: (out: Vec | null, a: ReadonlyVec) => Vec;
15
+ export declare const invertQ: (out: Vec | null, a: ReadonlyVec) => Vec<number>;
16
16
  //# sourceMappingURL=invert.d.ts.map
package/matn.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Mat } from "./api.js";
2
- export declare const mat22n: (out: Mat | null, n: number) => import("@thi.ng/vectors").Vec;
3
- export declare const mat23n: (out: Mat | null, n: number) => import("@thi.ng/vectors").Vec;
4
- export declare const mat33n: (out: Mat | null, n: number) => import("@thi.ng/vectors").Vec;
5
- export declare const mat44n: (out: Mat | null, n: number) => import("@thi.ng/vectors").Vec;
2
+ export declare const mat22n: (out: Mat | null, n: number) => Mat;
3
+ export declare const mat23n: (out: Mat | null, n: number) => Mat;
4
+ export declare const mat33n: (out: Mat | null, n: number) => Mat;
5
+ export declare const mat44n: (out: Mat | null, n: number) => Mat;
6
6
  //# sourceMappingURL=matn.d.ts.map
package/matv.d.ts CHANGED
@@ -33,5 +33,5 @@ export declare const mat33v: import("@thi.ng/vectors").VecOpVVV;
33
33
  * @param z -
34
34
  * @param w -
35
35
  */
36
- export declare const mat44v: (out: import("@thi.ng/vectors").Vec | null, a: import("@thi.ng/vectors").ReadonlyVec, b: import("@thi.ng/vectors").ReadonlyVec, c: import("@thi.ng/vectors").ReadonlyVec, d: import("@thi.ng/vectors").ReadonlyVec) => import("@thi.ng/vectors").Vec;
36
+ export declare const mat44v: (out: import("@thi.ng/vectors").Vec | null, a: import("@thi.ng/vectors").ReadonlyVec, b: import("@thi.ng/vectors").ReadonlyVec, c: import("@thi.ng/vectors").ReadonlyVec, d: import("@thi.ng/vectors").ReadonlyVec) => import("@thi.ng/vectors").Vec<number>;
37
37
  //# sourceMappingURL=matv.d.ts.map
package/mixq.d.ts CHANGED
@@ -10,5 +10,5 @@ import type { ReadonlyVec, Vec } from "@thi.ng/vectors";
10
10
  * @param t -
11
11
  * @param eps -
12
12
  */
13
- export declare const mixQ: (out: Vec | null, a: ReadonlyVec, b: ReadonlyVec, t: number, eps?: number) => Vec;
13
+ export declare const mixQ: (out: Vec | null, a: ReadonlyVec, b: ReadonlyVec, t: number, eps?: number) => Vec<number>;
14
14
  //# sourceMappingURL=mixq.d.ts.map
package/mul.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { mul as _mul, mul4 } from "@thi.ng/vectors/mul";
2
- import { defMath } from "./compile/emit.js";
2
+ import { $mul } from "@thi.ng/vectors/ops";
3
+ import { defMath } from "./defmath.js";
3
4
  const mul = _mul;
4
5
  const mul22 = mul4;
5
- const [mul23, mul33, mul44] = defMath(mul, "*");
6
+ const [mul23, mul33, mul44] = defMath($mul);
6
7
  export {
7
8
  mul,
8
9
  mul22,
package/muln.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { mulN as _mulN, mulN4 } from "@thi.ng/vectors/muln";
2
- import { defMathN } from "./compile/emit.js";
2
+ import { $mul } from "@thi.ng/vectors/ops";
3
+ import { defMathN } from "./defmath.js";
3
4
  const mulN = _mulN;
4
5
  const mulN22 = mulN4;
5
- const [mulN23, mulN33, mulN44] = defMathN(mulN, "*");
6
+ const [mulN23, mulN33, mulN44] = defMathN($mul);
6
7
  export {
7
8
  mulN,
8
9
  mulN22,
package/mulv.d.ts CHANGED
@@ -56,7 +56,7 @@ export declare const mulV44: MatOpMV;
56
56
  * @param m -
57
57
  * @param v -
58
58
  */
59
- export declare const mulV344: (out: Vec | null, m: ReadonlyMat, v: ReadonlyVec) => Vec | undefined;
59
+ export declare const mulV344: (out: Vec | null, m: ReadonlyMat, v: ReadonlyVec) => Vec<number> | undefined;
60
60
  /**
61
61
  * Multiplies quaternion `q` with 3D vector `v`. Returns transformed
62
62
  * vector or modifies in-place if `out` is null or `v`.
package/mulvm.d.ts CHANGED
@@ -16,8 +16,8 @@ import type { ReadonlyMat } from "./api.js";
16
16
  * @param v -
17
17
  * @param m -
18
18
  */
19
- export declare const mulVM22: (out: Vec | null, v: ReadonlyVec, m: ReadonlyMat) => Vec;
20
- export declare const mulVM23: (out: Vec | null, v: ReadonlyVec, m: ReadonlyMat) => Vec;
19
+ export declare const mulVM22: (out: Vec | null, v: ReadonlyVec, m: ReadonlyMat) => Vec<number>;
20
+ export declare const mulVM23: (out: Vec | null, v: ReadonlyVec, m: ReadonlyMat) => Vec<number>;
21
21
  /**
22
22
  * Same as:
23
23
  *
@@ -35,7 +35,7 @@ export declare const mulVM23: (out: Vec | null, v: ReadonlyVec, m: ReadonlyMat)
35
35
  * @param v -
36
36
  * @param m -
37
37
  */
38
- export declare const mulVM33: (out: Vec | null, v: ReadonlyVec, m: ReadonlyMat) => Vec;
38
+ export declare const mulVM33: (out: Vec | null, v: ReadonlyVec, m: ReadonlyMat) => Vec<number>;
39
39
  /**
40
40
  * Same as:
41
41
  *
@@ -54,5 +54,5 @@ export declare const mulVM33: (out: Vec | null, v: ReadonlyVec, m: ReadonlyMat)
54
54
  * @param v -
55
55
  * @param m -
56
56
  */
57
- export declare const mulVM44: (out: Vec | null, v: ReadonlyVec, m: ReadonlyMat) => Vec;
57
+ export declare const mulVM44: (out: Vec | null, v: ReadonlyVec, m: ReadonlyMat) => Vec<number>;
58
58
  //# sourceMappingURL=mulvm.d.ts.map
@@ -6,7 +6,7 @@ import type { MultiVecOpVV } from "@thi.ng/vectors";
6
6
  * https://en.wikipedia.org/wiki/Outer_product
7
7
  */
8
8
  export declare const outerProduct: MultiVecOpVV;
9
- export declare const outerProduct2: import("@thi.ng/vectors").VecOpVV;
10
- export declare const outerProduct3: import("@thi.ng/vectors").VecOpVV;
11
- export declare const outerProduct4: import("@thi.ng/vectors").VecOpVV;
9
+ export declare const outerProduct2: import("@thi.ng/vectors").VecOpVV<number, number>;
10
+ export declare const outerProduct3: import("@thi.ng/vectors").VecOpVV<number, number>;
11
+ export declare const outerProduct4: import("@thi.ng/vectors").VecOpVV<number, number>;
12
12
  //# sourceMappingURL=outer-product.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/matrices",
3
- "version": "2.4.40",
3
+ "version": "3.0.1",
4
4
  "description": "Matrix & quaternion operations for 2D/3D geometry processing",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -39,15 +39,15 @@
39
39
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@thi.ng/api": "^8.11.25",
43
- "@thi.ng/checks": "^3.7.5",
44
- "@thi.ng/math": "^5.11.25",
45
- "@thi.ng/vectors": "^7.13.1"
42
+ "@thi.ng/api": "^8.11.26",
43
+ "@thi.ng/checks": "^3.7.6",
44
+ "@thi.ng/math": "^5.11.26",
45
+ "@thi.ng/vectors": "^8.0.1"
46
46
  },
47
47
  "devDependencies": {
48
48
  "esbuild": "^0.25.2",
49
- "typedoc": "^0.28.1",
50
- "typescript": "^5.8.2"
49
+ "typedoc": "^0.28.2",
50
+ "typescript": "^5.8.3"
51
51
  },
52
52
  "keywords": [
53
53
  "2d",
@@ -86,8 +86,7 @@
86
86
  },
87
87
  "files": [
88
88
  "./*.js",
89
- "./*.d.ts",
90
- "compile"
89
+ "./*.d.ts"
91
90
  ],
92
91
  "exports": {
93
92
  ".": {
@@ -108,9 +107,6 @@
108
107
  "./column": {
109
108
  "default": "./column.js"
110
109
  },
111
- "./compile/emit": {
112
- "default": "./compile/emit.js"
113
- },
114
110
  "./concat": {
115
111
  "default": "./concat.js"
116
112
  },
@@ -120,6 +116,9 @@
120
116
  "./constants": {
121
117
  "default": "./constants.js"
122
118
  },
119
+ "./defmath": {
120
+ "default": "./defmath.js"
121
+ },
123
122
  "./determinant": {
124
123
  "default": "./determinant.js"
125
124
  },
@@ -277,5 +276,5 @@
277
276
  ],
278
277
  "year": 2018
279
278
  },
280
- "gitHead": "c88a589f33207b02a43172313b38ea09571265f1\n"
279
+ "gitHead": "69080248c98f9555642384aed76a0431e9f44835\n"
281
280
  }
package/project.d.ts CHANGED
@@ -11,7 +11,7 @@ import type { ReadonlyMat } from "./api.js";
11
11
  * @param view - 2x3 matrix
12
12
  * @param p -
13
13
  */
14
- export declare const project: (out: Vec | null, mvp: ReadonlyMat, view: ReadonlyMat, p: ReadonlyVec) => Vec;
14
+ export declare const project: (out: Vec | null, mvp: ReadonlyMat, view: ReadonlyMat, p: ReadonlyVec) => Vec<number>;
15
15
  /**
16
16
  * Same as {@link project}, but slightly faster and more convenient for
17
17
  * the most common use case of projecting a 3D input point (assumes
@@ -24,7 +24,7 @@ export declare const project: (out: Vec | null, mvp: ReadonlyMat, view: Readonly
24
24
  * @param view - 2x3 matrix
25
25
  * @param p -
26
26
  */
27
- export declare const project3: (out: Vec | null, mvp: ReadonlyMat, view: ReadonlyMat, p: ReadonlyVec) => Vec | undefined;
27
+ export declare const project3: (out: Vec | null, mvp: ReadonlyMat, view: ReadonlyMat, p: ReadonlyVec) => Vec<number> | undefined;
28
28
  /**
29
29
  * Reverse operation of {@link project3}. If `invert` is true (default:
30
30
  * false), both `mvp` and `view` matrices will be inverted first
@@ -37,5 +37,5 @@ export declare const project3: (out: Vec | null, mvp: ReadonlyMat, view: Readonl
37
37
  * @param p -
38
38
  * @param invert -
39
39
  */
40
- export declare const unproject: (out: Vec, mvp: ReadonlyMat, view: ReadonlyMat, p: ReadonlyVec, doInvert?: boolean) => Vec | undefined;
40
+ export declare const unproject: (out: Vec, mvp: ReadonlyMat, view: ReadonlyMat, p: ReadonlyVec, doInvert?: boolean) => Vec<number> | undefined;
41
41
  //# sourceMappingURL=project.d.ts.map
@@ -6,7 +6,7 @@ import type { ReadonlyVec } from "@thi.ng/vectors";
6
6
  * @param axis -
7
7
  * @param theta -
8
8
  */
9
- export declare const quatFromAxisAngle: (axis: ReadonlyVec, theta: number) => import("@thi.ng/vectors").Vec;
9
+ export declare const quatFromAxisAngle: (axis: ReadonlyVec, theta: number) => import("@thi.ng/vectors").Vec<number>;
10
10
  /**
11
11
  * Decomposes quaternion into `[axis, theta]` tuple.
12
12
  *
package/quat-euler.d.ts CHANGED
@@ -8,5 +8,5 @@ export type AxisOrder = "xyz" | "yxz" | "xzy" | "zxy" | "yzx" | "zyx";
8
8
  * @param b -
9
9
  * @param c -
10
10
  */
11
- export declare const quatFromEuler: (order: AxisOrder, a: number, b: number, c: number) => import("@thi.ng/vectors").Vec;
11
+ export declare const quatFromEuler: (order: AxisOrder, a: number, b: number, c: number) => import("@thi.ng/vectors").Vec<number>;
12
12
  //# sourceMappingURL=quat-euler.d.ts.map
package/quat-m44.d.ts CHANGED
@@ -7,5 +7,5 @@ import type { Mat } from "./api.js";
7
7
  * @param out -
8
8
  * @param q -
9
9
  */
10
- export declare const quatToMat44: (out: Mat | null, a: ReadonlyVec, t?: ReadonlyVec) => import("@thi.ng/vectors").Vec;
10
+ export declare const quatToMat44: (out: Mat | null, a: ReadonlyVec, t?: ReadonlyVec) => import("@thi.ng/vectors").Vec<number>;
11
11
  //# sourceMappingURL=quat-m44.d.ts.map
@@ -21,5 +21,5 @@ export declare const rotationAroundAxis33: (out: Mat | null, axis: ReadonlyVec,
21
21
  * @param theta -
22
22
  * @param normalize -
23
23
  */
24
- export declare const rotationAroundAxis44: (out: Mat | null, axis: ReadonlyVec, theta: number, normalize?: boolean) => import("@thi.ng/vectors").Vec;
24
+ export declare const rotationAroundAxis44: (out: Mat | null, axis: ReadonlyVec, theta: number, normalize?: boolean) => Mat;
25
25
  //# sourceMappingURL=rotation-around-axis.d.ts.map
package/scale-center.d.ts CHANGED
@@ -7,7 +7,7 @@ import type { Mat } from "./api.js";
7
7
  * @param out -
8
8
  * @param m -
9
9
  */
10
- export declare const scaleWithCenter23: (m: Mat | null, p: ReadonlyVec, s: number | ReadonlyVec) => import("@thi.ng/vectors").Vec;
10
+ export declare const scaleWithCenter23: (m: Mat | null, p: ReadonlyVec, s: number | ReadonlyVec) => Mat;
11
11
  /**
12
12
  * Computes a 4x4 matrix representing a scale operation with origin `p`
13
13
  * and writes result to `out`.
@@ -15,5 +15,5 @@ export declare const scaleWithCenter23: (m: Mat | null, p: ReadonlyVec, s: numbe
15
15
  * @param out -
16
16
  * @param m -
17
17
  */
18
- export declare const scaleWithCenter44: (m: Mat | null, p: ReadonlyVec, s: number | ReadonlyVec) => import("@thi.ng/vectors").Vec;
18
+ export declare const scaleWithCenter44: (m: Mat | null, p: ReadonlyVec, s: number | ReadonlyVec) => Mat;
19
19
  //# sourceMappingURL=scale-center.d.ts.map
package/scale-center.js CHANGED
@@ -1,4 +1,4 @@
1
- import { neg } from "@thi.ng/vectors/neg";
1
+ import { neg2, neg3 } from "@thi.ng/vectors/neg";
2
2
  import { concat } from "./concat.js";
3
3
  import { scale23, scale44 } from "./scale.js";
4
4
  import { translation23, translation44 } from "./translation.js";
@@ -6,13 +6,13 @@ const scaleWithCenter23 = (m, p, s) => concat(
6
6
  m,
7
7
  translation23([], p),
8
8
  scale23([], s),
9
- translation23([], neg([], p))
9
+ translation23([], neg2([], p))
10
10
  );
11
11
  const scaleWithCenter44 = (m, p, s) => concat(
12
12
  m,
13
13
  translation44([], p),
14
14
  scale44([], s),
15
- translation44([], neg([], p))
15
+ translation44([], neg3([], p))
16
16
  );
17
17
  export {
18
18
  scaleWithCenter23,
package/set.js CHANGED
@@ -1,12 +1,49 @@
1
- import { compile } from "@thi.ng/vectors/compile/emit";
2
- import { SET } from "@thi.ng/vectors/compile/templates";
3
1
  import { set as _set, set4 } from "@thi.ng/vectors/set";
4
- const $ = (dim) => _set.add(dim, compile(dim, SET, "o,a", void 0, "o"));
5
2
  const set = _set;
6
3
  const set22 = set4;
7
- const set23 = $(6);
8
- const set33 = $(9);
9
- const set44 = $(16);
4
+ const set23 = _set.add(6, (o, a) => {
5
+ !o && (o = []);
6
+ o[0] = a[0];
7
+ o[1] = a[1];
8
+ o[2] = a[2];
9
+ o[3] = a[3];
10
+ o[4] = a[4];
11
+ o[5] = a[5];
12
+ return o;
13
+ });
14
+ const set33 = _set.add(9, (o, a) => {
15
+ !o && (o = []);
16
+ o[0] = a[0];
17
+ o[1] = a[1];
18
+ o[2] = a[2];
19
+ o[3] = a[3];
20
+ o[4] = a[4];
21
+ o[5] = a[5];
22
+ o[6] = a[6];
23
+ o[7] = a[7];
24
+ o[8] = a[8];
25
+ return o;
26
+ });
27
+ const set44 = _set.add(16, (o, a) => {
28
+ !o && (o = []);
29
+ o[0] = a[0];
30
+ o[1] = a[1];
31
+ o[2] = a[2];
32
+ o[3] = a[3];
33
+ o[4] = a[4];
34
+ o[5] = a[5];
35
+ o[6] = a[6];
36
+ o[7] = a[7];
37
+ o[8] = a[8];
38
+ o[9] = a[9];
39
+ o[10] = a[10];
40
+ o[11] = a[11];
41
+ o[12] = a[12];
42
+ o[13] = a[13];
43
+ o[14] = a[14];
44
+ o[15] = a[15];
45
+ return o;
46
+ });
10
47
  export {
11
48
  set,
12
49
  set22,
package/sub.js CHANGED
@@ -1,8 +1,9 @@
1
+ import { $sub } from "@thi.ng/vectors/ops";
1
2
  import { sub as _sub, sub4 } from "@thi.ng/vectors/sub";
2
- import { defMath } from "./compile/emit.js";
3
+ import { defMath } from "./defmath.js";
3
4
  const sub = _sub;
4
5
  const sub22 = sub4;
5
- const [sub23, sub33, sub44] = defMath(sub, "-");
6
+ const [sub23, sub33, sub44] = defMath($sub);
6
7
  export {
7
8
  sub,
8
9
  sub22,
package/subn.js CHANGED
@@ -1,8 +1,9 @@
1
+ import { $sub } from "@thi.ng/vectors/ops";
1
2
  import { subN as _subN, subN4 } from "@thi.ng/vectors/subn";
2
- import { defMathN } from "./compile/emit.js";
3
+ import { defMathN } from "./defmath.js";
3
4
  const subN = _subN;
4
5
  const subN22 = subN4;
5
- const [subN23, subN33, subN44] = defMathN(subN, "-");
6
+ const [subN23, subN33, subN44] = defMathN($sub);
6
7
  export {
7
8
  subN,
8
9
  subN22,
package/transform.d.ts CHANGED
@@ -9,7 +9,7 @@ import type { Mat } from "./api.js";
9
9
  * @param rotation -
10
10
  * @param scale -
11
11
  */
12
- export declare const transform23: (out: Mat | null, translate: ReadonlyVec, rotation: number, scale: number | ReadonlyVec) => import("@thi.ng/vectors").Vec;
12
+ export declare const transform23: (out: Mat | null, translate: ReadonlyVec, rotation: number, scale: number | ReadonlyVec) => Mat;
13
13
  /**
14
14
  * Creates 4x4 TRS transformation matrix from given translation vector,
15
15
  * rotation angles (given as 3D vector) and scale factor/vector.
@@ -22,5 +22,5 @@ export declare const transform23: (out: Mat | null, translate: ReadonlyVec, rota
22
22
  * @param rotation -
23
23
  * @param scale -
24
24
  */
25
- export declare const transform44: (out: Mat | null, translate: ReadonlyVec, rotation: ReadonlyVec, scale: number | ReadonlyVec) => import("@thi.ng/vectors").Vec;
25
+ export declare const transform44: (out: Mat | null, translate: ReadonlyVec, rotation: ReadonlyVec, scale: number | ReadonlyVec) => Mat;
26
26
  //# sourceMappingURL=transform.d.ts.map
package/compile/emit.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import type { MultiMatOpMM, MultiMatOpMN } from "../api.js";
2
- export declare const defMath: (fn: MultiMatOpMM, op: string, sizes?: number[]) => import("../api.js").MatOpMM[];
3
- export declare const defMathN: (fn: MultiMatOpMN, op: string, sizes?: number[]) => import("../api.js").MatOpMN[];
4
- //# sourceMappingURL=emit.d.ts.map
package/compile/emit.js DELETED
@@ -1,22 +0,0 @@
1
- import { compile } from "@thi.ng/vectors/compile/emit";
2
- import {
3
- ARGS_VN,
4
- ARGS_VV,
5
- DEFAULT_OUT,
6
- MATH,
7
- MATH_N
8
- } from "@thi.ng/vectors/compile/templates";
9
- const DEFAULT_SIZES = [6, 9, 16];
10
- const defMath = (fn, op, sizes = DEFAULT_SIZES) => sizes.map(
11
- (n) => fn.add(
12
- n,
13
- compile(n, MATH(op), ARGS_VV, void 0, "o", "", DEFAULT_OUT)
14
- )
15
- );
16
- const defMathN = (fn, op, sizes = DEFAULT_SIZES) => sizes.map(
17
- (n) => fn.add(n, compile(n, MATH_N(op), ARGS_VN, "o,a", "o", "", DEFAULT_OUT))
18
- );
19
- export {
20
- defMath,
21
- defMathN
22
- };