@thi.ng/matrices 2.1.16 → 2.1.19

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**: 2022-07-19T15:36:12Z
3
+ - **Last updated**: 2022-08-06T15:22:27Z
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.1.19](https://github.com/thi-ng/umbrella/tree/@thi.ng/matrices@2.1.19) (2022-08-06)
13
+
14
+ #### ⏱ Performance improvements
15
+
16
+ - update vector fns ([39565cb](https://github.com/thi-ng/umbrella/commit/39565cb))
17
+
12
18
  ## [2.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/matrices@2.1.0) (2021-11-17)
13
19
 
14
20
  #### 🚀 Features
package/alignment-quat.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { cross3 } from "@thi.ng/vectors/cross";
2
2
  import { dot3 } from "@thi.ng/vectors/dot";
3
3
  import { mag } from "@thi.ng/vectors/mag";
4
- import { normalize as _normalize } from "@thi.ng/vectors/normalize";
4
+ import { normalize3 } from "@thi.ng/vectors/normalize";
5
5
  import { quatFromAxisAngle } from "./quat-axis-angle.js";
6
6
  /**
7
7
  * Returns quaternion describing the rotation from direction vector
@@ -14,8 +14,8 @@ import { quatFromAxisAngle } from "./quat-axis-angle.js";
14
14
  */
15
15
  export const alignmentQuat = (from, to, normalize = true) => {
16
16
  if (normalize) {
17
- from = _normalize([], from);
18
- to = _normalize([], to);
17
+ from = normalize3([], from);
18
+ to = normalize3([], to);
19
19
  }
20
20
  const axis = cross3([], from, to);
21
21
  return quatFromAxisAngle(axis, Math.atan2(mag(axis), dot3(from, to)));
package/lookat.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 { normalize } from "@thi.ng/vectors/normalize";
3
+ import { normalize3 } from "@thi.ng/vectors/normalize";
4
4
  import { setC } from "@thi.ng/vectors/setc";
5
5
  import { sub3 } from "@thi.ng/vectors/sub";
6
6
  /**
@@ -14,8 +14,8 @@ import { sub3 } from "@thi.ng/vectors/sub";
14
14
  * @param up -
15
15
  */
16
16
  export const lookAt = (out, eye, target, up) => {
17
- const z = normalize(null, sub3([], eye, target));
18
- const x = normalize(null, cross3([], up, z));
19
- const y = normalize(null, cross3([], z, x));
17
+ const z = normalize3(null, sub3([], eye, target));
18
+ const x = normalize3(null, cross3([], up, z));
19
+ const y = normalize3(null, cross3([], z, x));
20
20
  return setC(out || [], x[0], y[0], z[0], 0, x[1], y[1], z[1], 0, x[2], y[2], z[2], 0, -dot3(eye, x), -dot3(eye, y), -dot3(eye, z), 1);
21
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/matrices",
3
- "version": "2.1.16",
3
+ "version": "2.1.19",
4
4
  "description": "Matrix & quaternion operations for 2D/3D geometry processing",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -34,14 +34,14 @@
34
34
  "test": "testament test"
35
35
  },
36
36
  "dependencies": {
37
- "@thi.ng/api": "^8.3.8",
38
- "@thi.ng/checks": "^3.2.2",
39
- "@thi.ng/math": "^5.3.4",
40
- "@thi.ng/vectors": "^7.5.8"
37
+ "@thi.ng/api": "^8.3.9",
38
+ "@thi.ng/checks": "^3.2.4",
39
+ "@thi.ng/math": "^5.3.5",
40
+ "@thi.ng/vectors": "^7.5.11"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@microsoft/api-extractor": "^7.25.0",
44
- "@thi.ng/testament": "^0.2.9",
44
+ "@thi.ng/testament": "^0.2.11",
45
45
  "rimraf": "^3.0.2",
46
46
  "tools": "^0.0.1",
47
47
  "typedoc": "^0.22.17",
@@ -269,5 +269,5 @@
269
269
  ],
270
270
  "year": 2018
271
271
  },
272
- "gitHead": "108a6357b77d457912d30681d7cc5603ae995209\n"
272
+ "gitHead": "01b7a47077d88c2aefe77650ce3340040bae00ee\n"
273
273
  }
@@ -1,5 +1,5 @@
1
1
  import { EPS } from "@thi.ng/math/api";
2
- import { normalize } from "@thi.ng/vectors/normalize";
2
+ import { normalize3, normalize4 } from "@thi.ng/vectors/normalize";
3
3
  /**
4
4
  * Computes a quaternion representing the rotation `theta` around
5
5
  * `axis`.
@@ -9,7 +9,7 @@ import { normalize } from "@thi.ng/vectors/normalize";
9
9
  */
10
10
  export const quatFromAxisAngle = (axis, theta) => {
11
11
  theta *= 0.5;
12
- return normalize([0, 0, 0, Math.cos(theta)], axis, Math.sin(theta));
12
+ return normalize3([0, 0, 0, Math.cos(theta)], axis, Math.sin(theta));
13
13
  };
14
14
  /**
15
15
  * Decomposes quaternion into `[axis, theta]` tuple.
@@ -17,7 +17,7 @@ export const quatFromAxisAngle = (axis, theta) => {
17
17
  * @param quat -
18
18
  */
19
19
  export const quatToAxisAngle = (quat) => {
20
- const n = normalize([], quat);
20
+ const n = normalize4([], quat);
21
21
  const w = n[3];
22
22
  const m = Math.sqrt(1 - w * w);
23
23
  const theta = 2 * Math.acos(w);
@@ -1,5 +1,5 @@
1
1
  import { sincos } from "@thi.ng/math/angle";
2
- import { normalize as _normalize } from "@thi.ng/vectors/normalize";
2
+ import { normalize3 } from "@thi.ng/vectors/normalize";
3
3
  import { setC } from "@thi.ng/vectors/setc";
4
4
  import { mat33to44 } from "./m33-m44.js";
5
5
  /**
@@ -13,7 +13,7 @@ import { mat33to44 } from "./m33-m44.js";
13
13
  * @param normalize -
14
14
  */
15
15
  export const rotationAroundAxis33 = (out, axis, theta, normalize = false) => {
16
- const [x, y, z] = normalize ? _normalize([], axis) : axis;
16
+ const [x, y, z] = normalize ? normalize3([], axis) : axis;
17
17
  const [s, c] = sincos(theta);
18
18
  const t = 1 - c;
19
19
  const xs = x * s;