@woosh/meep-engine 2.118.3 → 2.118.4

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.
Files changed (40) hide show
  1. package/build/meep.cjs +86 -105
  2. package/build/meep.min.js +1 -1
  3. package/build/meep.module.js +86 -105
  4. package/package.json +5 -5
  5. package/src/core/binary/EndianType.d.ts +3 -0
  6. package/src/core/binary/EndianType.d.ts.map +1 -1
  7. package/src/core/binary/EndianType.js +2 -1
  8. package/src/core/binary/uint8_to_float.d.ts.map +1 -1
  9. package/src/core/binary/uint8_to_float.js +5 -0
  10. package/src/core/collection/queue/Deque.d.ts.map +1 -1
  11. package/src/core/collection/queue/Deque.js +32 -32
  12. package/src/core/color/Color.js +3 -3
  13. package/src/core/color/kelvin/rgb_to_kelvin.d.ts.map +1 -1
  14. package/src/core/color/kelvin/rgb_to_kelvin.js +16 -7
  15. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.d.ts.map +1 -0
  16. package/src/core/geom/Vector3.d.ts.map +1 -1
  17. package/src/core/geom/Vector3.js +5 -19
  18. package/src/core/geom/packing/computeBoundingSphereOfSpheres.js +1 -1
  19. package/src/core/math/compute_legendre_polynomial.d.ts +1 -1
  20. package/src/core/math/compute_legendre_polynomial.d.ts.map +1 -1
  21. package/src/core/math/compute_legendre_polynomial.js +6 -1
  22. package/src/core/math/max3.d.ts.map +1 -1
  23. package/src/core/math/max3.js +4 -0
  24. package/src/core/math/solveQuadratic.d.ts.map +1 -1
  25. package/src/core/math/solveQuadratic.js +5 -1
  26. package/src/core/primitives/boolean/compareBooleans.js +2 -0
  27. package/src/core/primitives/boolean/computeBooleanHash.d.ts +7 -0
  28. package/src/core/primitives/boolean/computeBooleanHash.d.ts.map +1 -0
  29. package/src/core/primitives/boolean/computeBooleanHash.js +8 -0
  30. package/src/core/primitives/numbers/computeHashFloat.d.ts.map +1 -1
  31. package/src/core/primitives/numbers/computeHashFloat.js +4 -2
  32. package/src/engine/ecs/gui/position/ViewportPosition.d.ts +0 -5
  33. package/src/engine/ecs/gui/position/ViewportPosition.d.ts.map +1 -1
  34. package/src/engine/ecs/gui/position/ViewportPosition.js +42 -53
  35. package/src/engine/ecs/speaker/VoiceSystem.d.ts +2 -3
  36. package/src/engine/ecs/speaker/VoiceSystem.d.ts.map +1 -1
  37. package/src/engine/graphics/sh3/lpv/find_max_depth_radius_for_point.js +2 -2
  38. package/src/core/geometry/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.d.ts.map +0 -1
  39. /package/src/core/{geometry → geom}/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.d.ts +0 -0
  40. /package/src/core/{geometry → geom}/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.js +0 -0
@@ -3,7 +3,7 @@
3
3
  * Useful in Spherical Harmonics coefficient computation
4
4
  * @param {number} l band
5
5
  * @param {number} m
6
- * @param {number} x
6
+ * @param {number} x must be between 0 and 1
7
7
  * @returns {number}
8
8
  */
9
9
  export function compute_legendre_polynomial(l: number, m: number, x: number): number;
@@ -1 +1 @@
1
- {"version":3,"file":"compute_legendre_polynomial.d.ts","sourceRoot":"","sources":["../../../../src/core/math/compute_legendre_polynomial.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,+CALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CAuClB"}
1
+ {"version":3,"file":"compute_legendre_polynomial.d.ts","sourceRoot":"","sources":["../../../../src/core/math/compute_legendre_polynomial.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,+CALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CA0ClB"}
@@ -1,12 +1,17 @@
1
+ import { assert } from "../assert.js";
2
+
1
3
  /**
2
4
  * Computes associated Legendre Polynomial P(l,m,x) at x
3
5
  * Useful in Spherical Harmonics coefficient computation
4
6
  * @param {number} l band
5
7
  * @param {number} m
6
- * @param {number} x
8
+ * @param {number} x must be between 0 and 1
7
9
  * @returns {number}
8
10
  */
9
11
  export function compute_legendre_polynomial(l, m, x) {
12
+ assert.lessThanOrEqual(x,1,'only valid for X <= 1');
13
+
14
+ // TODO we might be able to do better, see https://github.com/halueda/wavy-orbitals/blob/fe738b0f8de8783cb7886d2c6ee616c2befb363b/legendre.js#L16
10
15
  // based on code from https://github.com/jan-van-bergen/SphericalHarmonicLighting/blob/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/SphericalHarmonics.cpp#L61
11
16
 
12
17
  // Apply rule 2; P m m
@@ -1 +1 @@
1
- {"version":3,"file":"max3.d.ts","sourceRoot":"","sources":["../../../../src/core/math/max3.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CAYlB"}
1
+ {"version":3,"file":"max3.d.ts","sourceRoot":"","sources":["../../../../src/core/math/max3.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CAgBlB"}
@@ -8,11 +8,15 @@
8
8
  export function max3(a, b, c) {
9
9
 
10
10
  let v = a;
11
+
11
12
  if (v < b) {
12
13
  v = b;
13
14
  }
15
+
14
16
  if (v < c) {
15
17
  v = c;
16
18
  }
19
+
17
20
  return v;
21
+
18
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"solveQuadratic.d.ts","sourceRoot":"","sources":["../../../../src/core/math/solveQuadratic.js"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,uCAJW,MAAM,EAAE,iBACR,MAAM,KAJN,MAAM,KACN,MAAM,KACN,MAAM,GAGJ,MAAM,CAgDlB"}
1
+ {"version":3,"file":"solveQuadratic.d.ts","sourceRoot":"","sources":["../../../../src/core/math/solveQuadratic.js"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,uCAJW,MAAM,EAAE,iBACR,MAAM,KAJN,MAAM,KACN,MAAM,KACN,MAAM,GAGJ,MAAM,CAoDlB"}
@@ -10,7 +10,11 @@ import { EPSILON } from "./EPSILON.js";
10
10
  * @param {number} result_offset offset into result array where solutions are written to
11
11
  * @returns {number} number of found solutions (roots)
12
12
  */
13
- export function solveQuadratic(result, result_offset, a, b, c) {
13
+ export function solveQuadratic(
14
+ result, result_offset,
15
+ a, b, c
16
+ ) {
17
+
14
18
  assert.isNumber(a, 'a');
15
19
  assert.isNumber(b, 'b');
16
20
  assert.isNumber(c, 'c');
@@ -15,3 +15,5 @@ export function compareBooleans(a, b) {
15
15
  return -1;
16
16
  }
17
17
  }
18
+
19
+
@@ -0,0 +1,7 @@
1
+ /**
2
+ *
3
+ * @param {boolean} v
4
+ * @returns {number}
5
+ */
6
+ export function computeBooleanHash(v: boolean): number;
7
+ //# sourceMappingURL=computeBooleanHash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeBooleanHash.d.ts","sourceRoot":"","sources":["../../../../../src/core/primitives/boolean/computeBooleanHash.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,sCAHW,OAAO,GACL,MAAM,CAIlB"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ *
3
+ * @param {boolean} v
4
+ * @returns {number}
5
+ */
6
+ export function computeBooleanHash(v) {
7
+ return v ? 1 : 0;
8
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"computeHashFloat.d.ts","sourceRoot":"","sources":["../../../../../src/core/primitives/numbers/computeHashFloat.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oCAHW,MAAM,GACJ,MAAM,CAalB"}
1
+ {"version":3,"file":"computeHashFloat.d.ts","sourceRoot":"","sources":["../../../../../src/core/primitives/numbers/computeHashFloat.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,oCAHW,MAAM,GACJ,MAAM,CAalB"}
@@ -1,3 +1,5 @@
1
+ import { UINT32_MAX } from "../../binary/UINT32_MAX.js";
2
+
1
3
  /**
2
4
  *
3
5
  * @param {number} v
@@ -5,12 +7,12 @@
5
7
  */
6
8
  export function computeHashFloat(v) {
7
9
  //we break the number up into fractional and whole parts
8
- const whole = v | 0;
10
+ const whole = v >> 0;
9
11
 
10
12
  const fraction = v - whole;
11
13
 
12
14
  //fractional part is scaled up into int32 range, this inexact method, as it will produce 0 hash for values below a certain threshold
13
- const fractionHash = fraction * 1367130550;
15
+ const fractionHash = fraction * UINT32_MAX;
14
16
 
15
17
  //take XOR of both parts
16
18
  return fractionHash ^ whole;
@@ -6,11 +6,6 @@ export namespace ViewportPositionFlags {
6
6
  export default ViewportPosition;
7
7
  declare class ViewportPosition {
8
8
  static fromJSON(opt: any): ViewportPosition;
9
- /**
10
- *
11
- * @constructor
12
- */
13
- constructor(options: any);
14
9
  /**
15
10
  * Clip-scale position, on-screen values are in range of 0 to 1
16
11
  * @type {Vector2}
@@ -1 +1 @@
1
- {"version":3,"file":"ViewportPosition.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/gui/position/ViewportPosition.js"],"names":[],"mappings":"oCAOU,MAAM;;;;;;AAOhB;IAkHI,4CAMC;IAvHD;;;OAGG;IACH,0BAkDC;IAjDG;;;OAGG;IACH,UAFU,OAAO,CAEY;IAE7B;;;OAGG;IACH,QAFU,OAAO,CAEU;IAC3B;;;OAGG;IACH,QAFU,OAAO,CAEc;IAG/B;;;;OAIG;IACH,sBAFU,OAAO,CAEgB;IAEjC;;;;OAIG;IACH,iBAFU,MAAM,CAES;IAGzB;;;OAGG;IACH,mBAFU,OAAO,CAEa;IAE9B;;;OAGG;IACH,SAFU,eAAe,CAEe;IAQ5C;;;;OAIG;IACH,cAHW,gBAAgB,GACd,OAAO,CAWnB;IAED,eAUC;IAED;;;;;;;aAgBC;IAED;;;;;;;MASC;CASJ;;;;;oBAtImB,kCAAkC;4BAC1B,2CAA2C"}
1
+ {"version":3,"file":"ViewportPosition.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/gui/position/ViewportPosition.js"],"names":[],"mappings":"oCAOU,MAAM;;;;;;AAOhB;IAuGI,4CAMC;IA5GD;;;OAGG;IACH,UAFU,OAAO,CAEQ;IAEzB;;;OAGG;IACH,QAFU,OAAO,CAEM;IACvB;;;OAGG;IACH,QAFU,OAAO,CAEU;IAG3B;;;;OAIG;IACH,sBAFU,OAAO,CAEY;IAE7B;;;;OAIG;IACH,iBAFU,MAAM,CAEK;IAGrB;;;OAGG;IACH,mBAFU,OAAO,CAES;IAE1B;;;OAGG;IACH,SAFU,eAAe,CAEW;IAEpC;;;;OAIG;IACH,cAHW,gBAAgB,GACd,OAAO,CAWnB;IAED,eAUC;IAED;;;;;;;aAgBC;IAED;;;;;;;MASC;CASJ;;;;;oBA3HmB,kCAAkC;4BAC1B,2CAA2C"}
@@ -14,60 +14,49 @@ export const ViewportPositionFlags = {
14
14
 
15
15
  class ViewportPosition {
16
16
  /**
17
- *
18
- * @constructor
17
+ * Clip-scale position, on-screen values are in range of 0 to 1
18
+ * @type {Vector2}
19
19
  */
20
- constructor(options) {
21
- /**
22
- * Clip-scale position, on-screen values are in range of 0 to 1
23
- * @type {Vector2}
24
- */
25
- this.position = new Vector2();
26
-
27
- /**
28
- * Fixed offset in pixels
29
- * @type {Vector2}
30
- */
31
- this.offset = new Vector2();
32
- /**
33
- * ranges from 0..1 in both X and Y, controls anchor point of element positioning
34
- * @type {Vector2}
35
- */
36
- this.anchor = new Vector2(0, 0);
37
-
38
-
39
- /**
40
- * Makes display element avoid overlap with GUI elements
41
- * @see GUIElement
42
- * @type {boolean}
43
- */
44
- this.resolveGuiCollisions = false;
45
-
46
- /**
47
- * How far should the HUD stay away from the edge if it's sticky
48
- * @see stickToScreenEdge
49
- * @type {number}
50
- */
51
- this.screenEdgeWidth = 10;
52
-
53
-
54
- /**
55
- * Controls whenever or not HUD should remain on the screen when it gets to the edge
56
- * @type {boolean}
57
- */
58
- this.stickToScreenEdge = false;
59
-
60
- /**
61
- * Can be used to enable and disable positioning
62
- * @type {ObservedBoolean}
63
- */
64
- this.enabled = new ObservedBoolean(true);
65
-
66
- if (options !== undefined) {
67
- console.warn("ViewportPosition constructor options is deprecated, please use static fromJSON method instead if you need similar functionality");
68
- this.fromJSON(options);
69
- }
70
- }
20
+ position = new Vector2();
21
+
22
+ /**
23
+ * Fixed offset in pixels
24
+ * @type {Vector2}
25
+ */
26
+ offset = new Vector2();
27
+ /**
28
+ * ranges from 0..1 in both X and Y, controls anchor point of element positioning
29
+ * @type {Vector2}
30
+ */
31
+ anchor = new Vector2(0, 0);
32
+
33
+
34
+ /**
35
+ * Makes display element avoid overlap with GUI elements
36
+ * @see GUIElement
37
+ * @type {boolean}
38
+ */
39
+ resolveGuiCollisions = false;
40
+
41
+ /**
42
+ * How far should the HUD stay away from the edge if it's sticky
43
+ * @see stickToScreenEdge
44
+ * @type {number}
45
+ */
46
+ screenEdgeWidth = 10;
47
+
48
+
49
+ /**
50
+ * Controls whenever or not HUD should remain on the screen when it gets to the edge
51
+ * @type {boolean}
52
+ */
53
+ stickToScreenEdge = false;
54
+
55
+ /**
56
+ * Can be used to enable and disable positioning
57
+ * @type {ObservedBoolean}
58
+ */
59
+ enabled = new ObservedBoolean(true);
71
60
 
72
61
  /**
73
62
  *
@@ -9,7 +9,7 @@ export class VoiceSystem extends AbstractContextSystem<any> {
9
9
  font_size: number;
10
10
  });
11
11
  dependencies: (typeof Voice)[];
12
- components_used: (ResourceAccessSpecification<typeof ViewportPosition> | ResourceAccessSpecification<typeof BehaviorComponent>)[];
12
+ components_used: ResourceAccessSpecification<typeof BehaviorComponent>[];
13
13
  /**
14
14
  *
15
15
  * @type {Localization}
@@ -100,7 +100,6 @@ export class VoiceSystem extends AbstractContextSystem<any> {
100
100
  }
101
101
  import { AbstractContextSystem } from "../system/AbstractContextSystem.js";
102
102
  import { Voice } from "./Voice.js";
103
- import ViewportPosition from "../gui/position/ViewportPosition.js";
104
- import { ResourceAccessSpecification } from "../../../core/model/ResourceAccessSpecification.js";
105
103
  import { BehaviorComponent } from "../../intelligence/behavior/ecs/BehaviorComponent.js";
104
+ import { ResourceAccessSpecification } from "../../../core/model/ResourceAccessSpecification.js";
106
105
  //# sourceMappingURL=VoiceSystem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"VoiceSystem.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/speaker/VoiceSystem.js"],"names":[],"mappings":"AA2JA;IACI;;;;OAIG;IACH;;;OA2FC;IArFG,+BAA2B;IAE3B,kIAQC;IAGD;;;OAGG;IACH,0BAAuB;IAEvB;;;OAGG;IACH,eAAe;IAEf;;;OAGG;IACH,4BAAiB;IAEjB;;;OAGG;IACH,8BAAgB;IAEhB;;;OAGG;IACH,eAAoB;IAEpB;;;;OAIG;IACH,iCAAyC;IAEzC;;;;OAIG;IACH,kBAAkC;IAIlC;;;;OAIG;IACH,eAAkB;IAElB;;;;OAIG;IACH,oBAAgC;IAEhC;;;OAGG;IACH,oBAAqC;IAErC;;;;OAIG;IACH,gBAAoB;IAGxB;;;OAGG;IACH,kBAFY,MAAM,CAIjB;IAED,0EAuBC;IAED;;;;;OAKG;IACH,uBAJW,MAAM,UACN,MAAM,SACN,KAAK,QAsBf;IAED;;;;;OAKG;IACH,wBAoBC;IAED;;;;;OAKG;IACH,gBAJW,MAAM,WACN,MAAM,SACN,KAAK,QAuHf;CACJ;sCAxbqC,oCAAoC;sBAIpD,YAAY;6BALL,qCAAqC;4CArBtB,oDAAoD;kCAQ9D,sDAAsD"}
1
+ {"version":3,"file":"VoiceSystem.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/speaker/VoiceSystem.js"],"names":[],"mappings":"AA2JA;IACI;;;;OAIG;IACH;;;OA2FC;IArFG,+BAA2B;IAE3B,yEAQC;IAGD;;;OAGG;IACH,0BAAuB;IAEvB;;;OAGG;IACH,eAAe;IAEf;;;OAGG;IACH,4BAAiB;IAEjB;;;OAGG;IACH,8BAAgB;IAEhB;;;OAGG;IACH,eAAoB;IAEpB;;;;OAIG;IACH,iCAAyC;IAEzC;;;;OAIG;IACH,kBAAkC;IAIlC;;;;OAIG;IACH,eAAkB;IAElB;;;;OAIG;IACH,oBAAgC;IAEhC;;;OAGG;IACH,oBAAqC;IAErC;;;;OAIG;IACH,gBAAoB;IAGxB;;;OAGG;IACH,kBAFY,MAAM,CAIjB;IAED,0EAuBC;IAED;;;;;OAKG;IACH,uBAJW,MAAM,UACN,MAAM,SACN,KAAK,QAsBf;IAED;;;;;OAKG;IACH,wBAoBC;IAED;;;;;OAKG;IACH,gBAJW,MAAM,WACN,MAAM,SACN,KAAK,QAuHf;CACJ;sCAxbqC,oCAAoC;sBAIpD,YAAY;kCAlBA,sDAAsD;4CAR5C,oDAAoD"}
@@ -1,7 +1,7 @@
1
- import { v3_distance_sqr } from "../../../../core/geom/vec3/v3_distance_sqr.js";
2
1
  import {
3
2
  tetrahedral_mesh_find_tets_attached_to_vertex
4
- } from "../../../../core/geometry/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.js";
3
+ } from "../../../../core/geom/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.js";
4
+ import { v3_distance_sqr } from "../../../../core/geom/vec3/v3_distance_sqr.js";
5
5
  import { max2 } from "../../../../core/math/max2.js";
6
6
 
7
7
  /**
@@ -1 +0,0 @@
1
- {"version":3,"file":"tetrahedral_mesh_find_tets_attached_to_vertex.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geometry/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,sEANW,MAAM,EAAE,iBACR,MAAM,uCAEN,MAAM,GACJ,MAAM,CAyBlB"}