@woosh/meep-engine 2.126.42 → 2.126.43

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/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Pure JavaScript game engine. Fully featured and production ready.",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.126.42",
8
+ "version": "2.126.43",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Returns the first-order partial derivative of a hermite curve with control points p0, m0, p1, m1 at the parameter t in [0,1].
3
+ *
4
+ * @param {number} t
5
+ * @param {number} p0
6
+ * @param {number} p1
7
+ * @param {number} m0
8
+ * @param {number} m1
9
+ * @returns {number}
10
+ */
11
+ export function spline3_hermite_derivative(t: number, p0: number, p1: number, m0: number, m1: number): number;
12
+ //# sourceMappingURL=spline3_hermite_derivative.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spline3_hermite_derivative.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/spline/spline3_hermite_derivative.js"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,8CAPW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAclB"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Returns the first-order partial derivative of a hermite curve with control points p0, m0, p1, m1 at the parameter t in [0,1].
3
+ *
4
+ * @param {number} t
5
+ * @param {number} p0
6
+ * @param {number} p1
7
+ * @param {number} m0
8
+ * @param {number} m1
9
+ * @returns {number}
10
+ */
11
+ export function spline3_hermite_derivative(t, p0, p1, m0, m1) {
12
+
13
+ // see https://github.com/krishauser/Klampt/blob/0ed16608a3eceee59d04383a17c207ebc33a399f/Python/klampt/math/spline.py#L22
14
+
15
+ const t2 = t * t
16
+ const dcx1 = (6.0 * t2 - 6.0 * t)
17
+ const dcx2 = (-6.0 * t2 + 6.0 * t)
18
+ const dcv1 = 3.0 * t2 - 4.0 * t + 1.0
19
+ const dcv2 = 3.0 * t2 - 2.0 * t
20
+
21
+ return dcx1 * p0 + dcx2 * p1 + dcv1 * m0 + dcv2 * m1
22
+
23
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Subdivides a hermite curve into two hermite curves.
3
+ * The result is written in form [a_p0, a_p1, a_m0, a_m1, b_p0, b_p1, b_m0, b_m1], note the stride and offset.
4
+ * @param {number[]} output where to write the result
5
+ * @param {number} output_offset where to start writing
6
+ * @param {number} output_stride what should be the step between result values, useful when working in higher dimensions. Typically, this will be 1.
7
+ * @param {number} p0
8
+ * @param {number} p1
9
+ * @param {number} m0 tangent at p0
10
+ * @param {number} m1 tangent at p1
11
+ * @param {number} [t=0.5] where to split, normalized position, must be value between 0 and 1
12
+ */
13
+ export function spline3_hermite_subdivide(output: number[], output_offset: number, output_stride: number, p0: number, p1: number, m0: number, m1: number, t?: number): void;
14
+ //# sourceMappingURL=spline3_hermite_subdivide.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spline3_hermite_subdivide.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/spline/spline3_hermite_subdivide.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AACH,kDATW,MAAM,EAAE,iBACR,MAAM,iBACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QA+BhB"}
@@ -0,0 +1,46 @@
1
+ import { assert } from "../../assert.js";
2
+ import { spline3_hermite } from "./spline3_hermite.js";
3
+ import { spline3_hermite_derivative } from "./spline3_hermite_derivative.js";
4
+
5
+ /**
6
+ * Subdivides a hermite curve into two hermite curves.
7
+ * The result is written in form [a_p0, a_p1, a_m0, a_m1, b_p0, b_p1, b_m0, b_m1], note the stride and offset.
8
+ * @param {number[]} output where to write the result
9
+ * @param {number} output_offset where to start writing
10
+ * @param {number} output_stride what should be the step between result values, useful when working in higher dimensions. Typically, this will be 1.
11
+ * @param {number} p0
12
+ * @param {number} p1
13
+ * @param {number} m0 tangent at p0
14
+ * @param {number} m1 tangent at p1
15
+ * @param {number} [t=0.5] where to split, normalized position, must be value between 0 and 1
16
+ */
17
+ export function spline3_hermite_subdivide(
18
+ output,
19
+ output_offset,
20
+ output_stride,
21
+ p0, p1, m0, m1,
22
+ t = 0.5
23
+ ) {
24
+ assert.isNonNegativeInteger(output_offset, 'output_offset');
25
+ assert.isNonNegativeInteger(output_stride, 'output_stride');
26
+ assert.greaterThanOrEqual(output_stride, 1, 'output_stride must be at least 1');
27
+
28
+ // see https://github.com/krishauser/Klampt/blob/0ed16608a3eceee59d04383a17c207ebc33a399f/Python/klampt/math/spline.py#L63
29
+
30
+ const xm = spline3_hermite(t, p0, p1, m0, m1);
31
+ const vm = spline3_hermite_derivative(t, p0, p1, m0, m1);
32
+
33
+
34
+ // first segment
35
+ output[output_offset] = p0;
36
+ output[output_offset + output_stride] = xm;
37
+ output[output_offset + output_stride * 2] = m0 * t;
38
+ output[output_offset + output_stride * 3] = vm * t;
39
+
40
+ // second segment
41
+ output[output_offset + output_stride * 4] = xm;
42
+ output[output_offset + output_stride * 5] = p1;
43
+ output[output_offset + output_stride * 6] = vm * (1 - t);
44
+ output[output_offset + output_stride * 7] = m1 * (1 - t);
45
+
46
+ }
@@ -2,8 +2,8 @@ import { assert } from "../../../core/assert.js";
2
2
  import { allocate_m4 } from "../../../core/geom/3d/mat4/allocate_m4.js";
3
3
  import { compose_matrix4_array } from "../../../core/geom/3d/mat4/compose_matrix4_array.js";
4
4
  import { decompose_matrix_4_array } from "../../../core/geom/3d/mat4/decompose_matrix_4_array.js";
5
- import { m4_multiply } from "../../../core/geom/3d/mat4/m4_multiply.js";
6
5
  import { M4_IDENTITY } from "../../../core/geom/3d/mat4/M4_IDENTITY.js";
6
+ import { m4_multiply } from "../../../core/geom/3d/mat4/m4_multiply.js";
7
7
  import Quaternion from "../../../core/geom/Quaternion.js";
8
8
  import Vector3 from "../../../core/geom/Vector3.js";
9
9
  import { TransformFlags } from "./TransformFlags.js";
@@ -2,8 +2,8 @@ import { Group, Matrix4, Mesh } from "three";
2
2
  import { mergeBufferGeometries } from "three/examples/jsm/utils/BufferGeometryUtils.js";
3
3
  import { array_copy } from "../../../../../core/collection/array/array_copy.js";
4
4
  import { HashMap } from "../../../../../core/collection/map/HashMap.js";
5
- import { m4_multiply } from "../../../../../core/geom/3d/mat4/m4_multiply.js";
6
5
  import { M4_IDENTITY } from "../../../../../core/geom/3d/mat4/M4_IDENTITY.js";
6
+ import { m4_multiply } from "../../../../../core/geom/3d/mat4/m4_multiply.js";
7
7
  import { StaticMaterialCache } from "../../../../asset/loaders/material/StaticMaterialCache.js";
8
8
  import { computeGeometryEquality } from "../../buffered/computeGeometryEquality.js";
9
9
  import { computeGeometryHash } from "../../buffered/computeGeometryHash.js";