@woosh/meep-engine 2.106.0 → 2.106.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.
Files changed (73) hide show
  1. package/build/meep.cjs +320 -165
  2. package/build/meep.min.js +1 -1
  3. package/build/meep.module.js +320 -165
  4. package/package.json +1 -1
  5. package/src/core/collection/array/array_copy.spec.d.ts +2 -0
  6. package/src/core/collection/array/array_copy.spec.d.ts.map +1 -0
  7. package/src/core/collection/array/array_copy.spec.js +19 -0
  8. package/src/core/collection/list/List.d.ts.map +1 -1
  9. package/src/core/collection/list/List.js +55 -30
  10. package/src/core/collection/list/List.spec.js +101 -0
  11. package/src/core/collection/list/ListForwarder.d.ts.map +1 -1
  12. package/src/core/collection/list/ListForwarder.js +49 -53
  13. package/src/core/collection/list/ListForwarder.spec.js +2 -0
  14. package/src/core/collection/list/SortedListProjection.d.ts +4 -1
  15. package/src/core/collection/list/SortedListProjection.d.ts.map +1 -1
  16. package/src/core/collection/list/SortedListProjection.js +4 -1
  17. package/src/core/collection/map/AbstractAsyncMap.d.ts.map +1 -1
  18. package/src/core/collection/map/AbstractAsyncMap.js +0 -3
  19. package/src/core/collection/map/AsyncMapWrapper.d.ts +6 -10
  20. package/src/core/collection/map/AsyncMapWrapper.d.ts.map +1 -1
  21. package/src/core/collection/map/AsyncMapWrapper.js +14 -9
  22. package/src/core/collection/map/HashMap.d.ts.map +1 -1
  23. package/src/core/collection/map/HashMap.js +14 -0
  24. package/src/core/collection/map/ObservedMap.d.ts +12 -3
  25. package/src/core/collection/map/ObservedMap.d.ts.map +1 -1
  26. package/src/core/collection/map/ObservedMap.js +14 -4
  27. package/src/core/collection/queue/Deque.d.ts.map +1 -1
  28. package/src/core/collection/queue/Deque.js +100 -95
  29. package/src/core/collection/set/ArraySet.d.ts.map +1 -0
  30. package/src/core/collection/set/{Set.js → ArraySet.js} +2 -2
  31. package/src/core/collection/set/set_remove.d.ts +3 -3
  32. package/src/core/collection/set/set_remove.d.ts.map +1 -1
  33. package/src/core/collection/set/set_remove.js +5 -5
  34. package/src/core/color/oklab/find_gamut_intersection.js +1 -1
  35. package/src/core/geom/2d/Rectangle.d.ts +54 -5
  36. package/src/core/geom/2d/Rectangle.d.ts.map +1 -1
  37. package/src/core/geom/2d/Rectangle.js +70 -3
  38. package/src/core/geom/2d/circle/Circle.d.ts +1 -1
  39. package/src/core/geom/2d/circle/Circle.js +1 -1
  40. package/src/core/geom/2d/compute_triangle_area_2d.d.ts.map +1 -1
  41. package/src/core/geom/2d/compute_triangle_area_2d.js +7 -1
  42. package/src/core/geom/2d/shape/AbstractShape.d.ts +2 -0
  43. package/src/core/geom/2d/shape/AbstractShape.d.ts.map +1 -1
  44. package/src/core/geom/2d/shape/AbstractShape.js +8 -2
  45. package/src/core/geom/2d/shape/CircleShape.d.ts +14 -0
  46. package/src/core/geom/2d/shape/CircleShape.d.ts.map +1 -1
  47. package/src/core/geom/2d/shape/CircleShape.js +64 -22
  48. package/src/core/geom/2d/uv_map_circle_to_square.d.ts +8 -0
  49. package/src/core/geom/2d/uv_map_circle_to_square.d.ts.map +1 -0
  50. package/src/core/geom/2d/{UvUtils.js → uv_map_circle_to_square.js} +2 -17
  51. package/src/core/geom/2d/uv_map_circle_to_square.spec.d.ts +2 -0
  52. package/src/core/geom/2d/uv_map_circle_to_square.spec.d.ts.map +1 -0
  53. package/src/core/geom/2d/uv_map_circle_to_square.spec.js +28 -0
  54. package/src/core/geom/2d/uv_map_square_to_circle.d.ts +8 -0
  55. package/src/core/geom/2d/uv_map_square_to_circle.d.ts.map +1 -0
  56. package/src/core/geom/2d/uv_map_square_to_circle.js +14 -0
  57. package/src/core/geom/2d/uv_map_square_to_circle.spec.d.ts +2 -0
  58. package/src/core/geom/2d/uv_map_square_to_circle.spec.d.ts.map +1 -0
  59. package/src/core/geom/2d/uv_map_square_to_circle.spec.js +30 -0
  60. package/src/core/geom/Vector3.d.ts +13 -4
  61. package/src/core/geom/Vector3.d.ts.map +1 -1
  62. package/src/core/geom/Vector3.js +83 -36
  63. package/src/core/geom/Vector3.spec.js +113 -12
  64. package/src/core/collection/set/Set.d.ts.map +0 -1
  65. package/src/core/geom/2d/Geometry2D.d.ts +0 -31
  66. package/src/core/geom/2d/Geometry2D.d.ts.map +0 -1
  67. package/src/core/geom/2d/Geometry2D.js +0 -59
  68. package/src/core/geom/2d/UvUtils.d.ts +0 -15
  69. package/src/core/geom/2d/UvUtils.d.ts.map +0 -1
  70. package/src/core/geom/2d/UvUtils.spec.d.ts +0 -2
  71. package/src/core/geom/2d/UvUtils.spec.d.ts.map +0 -1
  72. package/src/core/geom/2d/UvUtils.spec.js +0 -55
  73. /package/src/core/collection/set/{Set.d.ts → ArraySet.d.ts} +0 -0
package/build/meep.cjs CHANGED
@@ -2108,10 +2108,23 @@ let Vector3$1 = class Vector3 {
2108
2108
  * @constructor
2109
2109
  */
2110
2110
  constructor(x = 0, y = 0, z = 0) {
2111
+ /**
2112
+ * @type {number}
2113
+ */
2111
2114
  this.x = x;
2115
+ /**
2116
+ * @type {number}
2117
+ */
2112
2118
  this.y = y;
2119
+ /**
2120
+ * @type {number}
2121
+ */
2113
2122
  this.z = z;
2114
2123
 
2124
+ /**
2125
+ * @readonly
2126
+ * @type {Signal<number,number,number,number,number,number>}
2127
+ */
2115
2128
  this.onChanged = new Signal();
2116
2129
  }
2117
2130
 
@@ -2409,7 +2422,11 @@ let Vector3$1 = class Vector3 {
2409
2422
  const ax = first.x, ay = first.y, az = first.z;
2410
2423
  const bx = second.x, by = second.y, bz = second.z;
2411
2424
 
2412
- this._crossVectors(ax, ay, az, bx, by, bz);
2425
+ this._crossVectors(
2426
+ ax, ay, az,
2427
+ bx, by, bz
2428
+ );
2429
+
2413
2430
  }
2414
2431
 
2415
2432
  /**
@@ -2621,6 +2638,7 @@ let Vector3$1 = class Vector3 {
2621
2638
  /**
2622
2639
  *
2623
2640
  * @param {THREE.Matrix4} matrix4
2641
+ * @deprecated use {@link @applyMatrix4} directly instead, pass `mat.elements`
2624
2642
  */
2625
2643
  applyMatrix4_three(matrix4) {
2626
2644
  this.applyMatrix4(matrix4.elements);
@@ -2649,7 +2667,9 @@ let Vector3$1 = class Vector3 {
2649
2667
  * @param {ArrayLike<number>|number[]|Float32Array} m4
2650
2668
  */
2651
2669
  applyDirectionMatrix4(m4) {
2652
- const x = this.x, y = this.y, z = this.z;
2670
+ const x = this.x;
2671
+ const y = this.y;
2672
+ const z = this.z;
2653
2673
 
2654
2674
  const _x = m4[0] * x + m4[4] * y + m4[8] * z;
2655
2675
  const _y = m4[1] * x + m4[5] * y + m4[9] * z;
@@ -2680,25 +2700,34 @@ let Vector3$1 = class Vector3 {
2680
2700
  }
2681
2701
 
2682
2702
  /**
2683
- *
2703
+ * @deprecated use non-three.js version instead
2684
2704
  * @param {THREE.Matrix3} m
2685
2705
  * @returns {Vector3}
2686
2706
  */
2687
2707
  applyMatrix3_three(m) {
2708
+ this.applyMatrix3(m.elements);
2688
2709
 
2689
- const x = this.x, y = this.y, z = this.z;
2690
- const e = m.elements;
2710
+ return this;
2711
+ }
2691
2712
 
2692
- const _x = e[0] * x + e[3] * y + e[6] * z;
2693
- const _y = e[1] * x + e[4] * y + e[7] * z;
2694
- const _z = e[2] * x + e[5] * y + e[8] * z;
2713
+ /**
2714
+ *
2715
+ * @param {number[]|Float32Array} mat
2716
+ */
2717
+ applyMatrix3(mat) {
2718
+ const x = this.x;
2719
+ const y = this.y;
2720
+ const z = this.z;
2695
2721
 
2696
- return this.set(_x, _y, _z);
2722
+ const _x = mat[0] * x + mat[3] * y + mat[6] * z;
2723
+ const _y = mat[1] * x + mat[4] * y + mat[7] * z;
2724
+ const _z = mat[2] * x + mat[5] * y + mat[8] * z;
2697
2725
 
2726
+ this.set(_x, _y, _z);
2698
2727
  }
2699
2728
 
2700
2729
  /**
2701
- *
2730
+ * @deprecated use non-three.js version instead
2702
2731
  * @param {THREE.Matrix4} matrix4
2703
2732
  */
2704
2733
  threejs_setFromMatrixPosition(matrix4) {
@@ -2783,17 +2812,7 @@ let Vector3$1 = class Vector3 {
2783
2812
  const y1 = other.y;
2784
2813
  const z1 = other.z;
2785
2814
 
2786
- const d = v3_dot(x0, y0, z0, x1, y1, z1);
2787
-
2788
- const mag2 = (x1 * x1 + y1 * y1 + z1 * z1);
2789
-
2790
- const m = d / mag2;
2791
-
2792
- const x = x1 * m;
2793
- const y = y1 * m;
2794
- const z = z1 * m;
2795
-
2796
- this.set(x, y, z);
2815
+ this._projectVectors(x0, y0, z0, x1, y1, z1);
2797
2816
  }
2798
2817
 
2799
2818
  /**
@@ -2830,7 +2849,10 @@ let Vector3$1 = class Vector3 {
2830
2849
  * @param {number} y1
2831
2850
  * @param {number} z1
2832
2851
  */
2833
- _projectVectors(x0, y0, z0, x1, y1, z1) {
2852
+ _projectVectors(
2853
+ x0, y0, z0,
2854
+ x1, y1, z1
2855
+ ) {
2834
2856
 
2835
2857
  const d = v3_dot(x0, y0, z0, x1, y1, z1);
2836
2858
 
@@ -2853,11 +2875,15 @@ let Vector3$1 = class Vector3 {
2853
2875
  */
2854
2876
  setFromSphericalCoords(radius, phi, theta) {
2855
2877
 
2856
- const sinPhiRadius = Math.sin(phi) * radius;
2878
+ const sin_phi = Math.sin(phi);
2879
+ const cos_phi = Math.cos(phi);
2880
+
2881
+ const sin_theta = Math.sin(theta);
2882
+ const cos_theta = Math.cos(theta);
2857
2883
 
2858
- const _x = sinPhiRadius * Math.sin(theta);
2859
- const _y = Math.cos(phi) * radius;
2860
- const _z = sinPhiRadius * Math.cos(theta);
2884
+ const _x = radius * sin_phi * sin_theta;
2885
+ const _y = radius * cos_phi;
2886
+ const _z = radius * sin_phi * cos_theta;
2861
2887
 
2862
2888
  this.set(_x, _y, _z);
2863
2889
  }
@@ -2865,11 +2891,15 @@ let Vector3$1 = class Vector3 {
2865
2891
  /**
2866
2892
  *
2867
2893
  * @param {function} processor
2894
+ * @param {*} [thisArg]
2868
2895
  * @returns {Vector3}
2869
2896
  */
2870
- process(processor) {
2871
- processor(this.x, this.y, this.z);
2872
- this.onChanged.add(processor);
2897
+ process(processor, thisArg) {
2898
+
2899
+ processor.call(thisArg, this.x, this.y, this.z);
2900
+
2901
+ this.onChanged.add(processor, thisArg);
2902
+
2873
2903
  return this;
2874
2904
  }
2875
2905
 
@@ -2883,6 +2913,7 @@ let Vector3$1 = class Vector3 {
2883
2913
  */
2884
2914
  fromJSON(json) {
2885
2915
  if (typeof json === 'number') {
2916
+ // special case where input is a number
2886
2917
  this.setScalar(json);
2887
2918
  } else {
2888
2919
  this.copy(json);
@@ -2896,6 +2927,7 @@ let Vector3$1 = class Vector3 {
2896
2927
  /**
2897
2928
  *
2898
2929
  * @param {BinaryBuffer} buffer
2930
+ * @deprecated
2899
2931
  */
2900
2932
  toBinaryBuffer(buffer) {
2901
2933
  buffer.writeFloat64(this.x);
@@ -2906,6 +2938,7 @@ let Vector3$1 = class Vector3 {
2906
2938
  /**
2907
2939
  *
2908
2940
  * @param {BinaryBuffer} buffer
2941
+ * @deprecated
2909
2942
  */
2910
2943
  fromBinaryBuffer(buffer) {
2911
2944
  const x = buffer.readFloat64();
@@ -2918,6 +2951,7 @@ let Vector3$1 = class Vector3 {
2918
2951
  /**
2919
2952
  *
2920
2953
  * @param {BinaryBuffer} buffer
2954
+ * @deprecated
2921
2955
  */
2922
2956
  toBinaryBufferFloat32(buffer) {
2923
2957
  buffer.writeFloat32(this.x);
@@ -2928,6 +2962,7 @@ let Vector3$1 = class Vector3 {
2928
2962
  /**
2929
2963
  *
2930
2964
  * @param {BinaryBuffer} buffer
2965
+ * @deprecated
2931
2966
  */
2932
2967
  fromBinaryBufferFloat32(buffer) {
2933
2968
  const x = buffer.readFloat32();
@@ -3047,12 +3082,6 @@ Vector3$1.prototype.fromArray = Vector3$1.prototype.readFromArray;
3047
3082
  Vector3$1.prototype.toArray = Vector3$1.prototype.writeToArray;
3048
3083
 
3049
3084
 
3050
- /**
3051
- * @readonly
3052
- * @type {boolean}
3053
- */
3054
- Vector3$1.prototype.isVector3 = true;
3055
-
3056
3085
  /**
3057
3086
  * @readonly
3058
3087
  * @type {Vector3}
@@ -3109,10 +3138,20 @@ Vector3$1.forward = Object.freeze(new Vector3$1(0, 0, 1));
3109
3138
  */
3110
3139
  Vector3$1.back = Object.freeze(new Vector3$1(0, 0, -1));
3111
3140
 
3141
+ /**
3142
+ * @readonly
3143
+ * @type {boolean}
3144
+ */
3145
+ Vector3$1.prototype.isVector3 = true;
3146
+
3147
+ /**
3148
+ * @readonly
3149
+ * @type {string}
3150
+ */
3112
3151
  Vector3$1.typeName = "Vector3";
3113
3152
 
3114
3153
  /**
3115
- *
3154
+ * @deprecated use {@link v3_dot} directly instead
3116
3155
  * @param {number} x0
3117
3156
  * @param {number} y0
3118
3157
  * @param {number} z0
@@ -60225,13 +60264,21 @@ class HashMap {
60225
60264
  this.#entries_bound++;
60226
60265
 
60227
60266
  if (this.#entries[i] !== undefined) {
60267
+
60268
+ // entry exists, let's reuse it
60269
+
60228
60270
  const entry = this.#entries[i];
60229
60271
 
60230
60272
  entry.hash = hash;
60231
60273
  entry.key = k;
60232
60274
  entry.value = v;
60275
+
60233
60276
  } else {
60277
+
60278
+ // entry slot is empty
60279
+
60234
60280
  this.#entries[i] = new HashMapEntry(k, v, hash);
60281
+
60235
60282
  }
60236
60283
 
60237
60284
  return i;
@@ -60380,6 +60427,7 @@ class HashMap {
60380
60427
  * @return {V}
60381
60428
  */
60382
60429
  getOrCompute(key, compute, compute_context) {
60430
+
60383
60431
  const existing = this.get(key);
60384
60432
 
60385
60433
  if (existing !== undefined) {
@@ -60593,6 +60641,7 @@ class HashMap {
60593
60641
  }
60594
60642
 
60595
60643
  forEach(callback, thisArg) {
60644
+
60596
60645
  const count = this.#bin_count;
60597
60646
  const entries = this.#entries;
60598
60647
  const bins = this.#bins;
@@ -61447,18 +61496,27 @@ class List {
61447
61496
  removed: new Signal()
61448
61497
  };
61449
61498
 
61499
+ /**
61500
+ *
61501
+ * @type {T[]}
61502
+ */
61503
+ data = []
61504
+
61450
61505
  /**
61451
61506
  * @param {[]} [array]
61452
61507
  * @constructor
61453
61508
  */
61454
61509
  constructor(array) {
61455
61510
 
61456
- /**
61457
- * @private
61458
- * @readonly
61459
- * @type {T[]}
61460
- */
61461
- this.data = array !== undefined ? array.slice() : [];
61511
+ if (array !== undefined) {
61512
+
61513
+ /**
61514
+ * @private
61515
+ * @readonly
61516
+ * @type {T[]}
61517
+ */
61518
+ this.data = array.slice();
61519
+ }
61462
61520
 
61463
61521
  /**
61464
61522
  * Number of elements in the list
@@ -61547,9 +61605,11 @@ class List {
61547
61605
 
61548
61606
  if (index > this.length) {
61549
61607
  this.length = index;
61550
- }
61551
61608
 
61552
- this.data.splice(index, 0, el);
61609
+ this.data[index] = el;
61610
+ } else {
61611
+ this.data.splice(index, 0, el);
61612
+ }
61553
61613
 
61554
61614
  this.length++;
61555
61615
 
@@ -61687,11 +61747,11 @@ class List {
61687
61747
  addAllUnique(elements) {
61688
61748
  const data = this.data;
61689
61749
 
61690
- const unique = elements.filter(function (e, i) {
61691
- return data.indexOf(e) === -1 && elements.indexOf(e, i + 1) === -1;
61692
- });
61750
+ const length = data.length;
61693
61751
 
61694
- this.addAll(unique);
61752
+ for (let i = 0; i < length; i++) {
61753
+ this.addUnique(data[i]);
61754
+ }
61695
61755
  }
61696
61756
 
61697
61757
  /**
@@ -61702,21 +61762,23 @@ class List {
61702
61762
  */
61703
61763
  removeMany(index, removeCount) {
61704
61764
 
61705
- const els = this.data.splice(index, removeCount);
61765
+ const removed_elements = this.data.splice(index, removeCount);
61706
61766
 
61707
- const removedCount = els.length;
61767
+ const removedCount = removed_elements.length;
61708
61768
 
61709
61769
  this.length -= removedCount;
61710
61770
 
61711
- if (this.on.removed.hasHandlers()) {
61771
+ const onRemoved = this.on.removed;
61772
+
61773
+ if (onRemoved.hasHandlers()) {
61712
61774
  for (let i = 0; i < removedCount; i++) {
61713
- const element = els[i];
61775
+ const element = removed_elements[i];
61714
61776
 
61715
- this.on.removed.send2(element, index + i);
61777
+ onRemoved.send2(element, index + i);
61716
61778
  }
61717
61779
  }
61718
61780
 
61719
- return els;
61781
+ return removed_elements;
61720
61782
  }
61721
61783
 
61722
61784
  /**
@@ -61795,8 +61857,13 @@ class List {
61795
61857
  }
61796
61858
  }
61797
61859
 
61798
- sort() {
61799
- Array.prototype.sort.apply(this.data, arguments);
61860
+ /**
61861
+ *
61862
+ * @param {function(a:T, b:T):number} [compare_function]
61863
+ * @returns {List}
61864
+ */
61865
+ sort(compare_function) {
61866
+ Array.prototype.sort.call(this.data, compare_function);
61800
61867
  return this;
61801
61868
  }
61802
61869
 
@@ -61960,18 +62027,24 @@ class List {
61960
62027
  *
61961
62028
  * @param {function(el:T):boolean} matcher
61962
62029
  * @param {function(el:T, index:number):*} callback
62030
+ * @returns {boolean}
61963
62031
  */
61964
62032
  visitFirstMatch(matcher, callback) {
61965
- const data = this.data;
61966
- let i = 0;
61967
- const l = this.length;
61968
- for (; i < l; i++) {
61969
- const el = data[i];
61970
- if (matcher(el)) {
61971
- callback(el, i);
61972
- return;
61973
- }
62033
+ const index = this.findIndex(matcher);
62034
+
62035
+ if (index === -1) {
62036
+ return false;
61974
62037
  }
62038
+
62039
+ const el = this.data[index];
62040
+
62041
+ if (matcher(el)) {
62042
+ callback(el, index);
62043
+ return true;
62044
+ } else {
62045
+ return false;
62046
+ }
62047
+
61975
62048
  }
61976
62049
 
61977
62050
  /**
@@ -84573,15 +84646,25 @@ class BinaryHeap {
84573
84646
  * @template K,V
84574
84647
  */
84575
84648
  class ObservedMap {
84649
+ /**
84650
+ * @readonly
84651
+ */
84652
+ on = {
84653
+ /**
84654
+ * @type {Signal}
84655
+ */
84656
+ set: new Signal(),
84657
+ /**
84658
+ * @type {Signal}
84659
+ */
84660
+ deleted: new Signal()
84661
+ };
84662
+
84576
84663
  /**
84577
84664
  * @template K,V
84578
84665
  * @constructor
84579
84666
  */
84580
84667
  constructor(source = new Map()) {
84581
- this.on = {
84582
- set: new Signal(),
84583
- deleted: new Signal()
84584
- };
84585
84668
 
84586
84669
  /**
84587
84670
  *
@@ -84651,11 +84734,42 @@ const STATUS_FULL = 0;
84651
84734
  const STATUS_EMPTY = 1;
84652
84735
  const STATUS_NORMAL = 2;
84653
84736
 
84737
+ const EMPTY_ARRAY = new Array(0);
84738
+
84654
84739
  /**
84655
84740
  * Double-ended queue backed by an array
84656
84741
  * @template T
84657
84742
  */
84658
84743
  class Deque {
84744
+
84745
+ /**
84746
+ * Using static array allocator to preserve data locality.
84747
+ * Initialization via "[]" would give us a dynamically sized array,
84748
+ * but it would have unpredictable locality as array may or may not have it's elements stored next to each other in memory
84749
+ * @type {T[]}
84750
+ * @private
84751
+ */
84752
+ #data=EMPTY_ARRAY;
84753
+ /**
84754
+ *
84755
+ * @type {number}
84756
+ * @private
84757
+ */
84758
+ #head = 0;
84759
+ /**
84760
+ *
84761
+ * @type {number}
84762
+ * @private
84763
+ */
84764
+ #tail = 0;
84765
+
84766
+ /**
84767
+ *
84768
+ * @type {number}
84769
+ * @private
84770
+ */
84771
+ #status = STATUS_EMPTY;
84772
+
84659
84773
  /**
84660
84774
  * @template T
84661
84775
  * @param {number} [min_size]
@@ -84664,34 +84778,8 @@ class Deque {
84664
84778
 
84665
84779
  const size = ceilPowerOfTwo(max2(1, min_size));
84666
84780
 
84667
- /**
84668
- * Using static array allocator to preserve data locality.
84669
- * Initialization via "[]" would give us a dynamically sized array,
84670
- * but it would have unpredictable locality as array may or may not have it's elements stored next to each other in memory
84671
- * @type {T[]}
84672
- * @private
84673
- */
84674
- this.__data = new Array(size);
84781
+ this.#data = new Array(size);
84675
84782
 
84676
- /**
84677
- *
84678
- * @type {number}
84679
- * @private
84680
- */
84681
- this.__head = 0;
84682
- /**
84683
- *
84684
- * @type {number}
84685
- * @private
84686
- */
84687
- this.__tail = 0;
84688
-
84689
- /**
84690
- *
84691
- * @type {number}
84692
- * @private
84693
- */
84694
- this.__status = STATUS_EMPTY;
84695
84783
  }
84696
84784
 
84697
84785
  /**
@@ -84699,14 +84787,14 @@ class Deque {
84699
84787
  * @param {boolean} adding
84700
84788
  * @private
84701
84789
  */
84702
- resetStatus(adding) {
84703
- const head = this.__head;
84704
- const tail = this.__tail;
84790
+ #reset_status(adding) {
84791
+ const head = this.#head;
84792
+ const tail = this.#tail;
84705
84793
 
84706
84794
  if (head === tail) {
84707
- this.__status = adding ? STATUS_FULL : STATUS_EMPTY;
84795
+ this.#status = adding ? STATUS_FULL : STATUS_EMPTY;
84708
84796
  } else {
84709
- this.__status = STATUS_NORMAL;
84797
+ this.#status = STATUS_NORMAL;
84710
84798
  }
84711
84799
  }
84712
84800
 
@@ -84716,10 +84804,10 @@ class Deque {
84716
84804
  * @returns {number}
84717
84805
  * @private
84718
84806
  */
84719
- __circular_next_position(current) {
84807
+ #circular_next_position(current) {
84720
84808
  const next = current + 1;
84721
84809
 
84722
- const length = this.__data.length;
84810
+ const length = this.#data.length;
84723
84811
 
84724
84812
  return (next >= length) ? 0 : next;
84725
84813
  }
@@ -84730,20 +84818,20 @@ class Deque {
84730
84818
  * @returns {number}
84731
84819
  * @private
84732
84820
  */
84733
- __circular_previous_position(current) {
84821
+ #circular_previous_position(current) {
84734
84822
  const prev = current - 1;
84735
- return (prev < 0) ? (this.__data.length - 1) : prev;
84823
+ return (prev < 0) ? (this.#data.length - 1) : prev;
84736
84824
  }
84737
84825
 
84738
- __check_and_expand() {
84739
- const status = this.__status;
84826
+ #check_and_expand() {
84827
+ const status = this.#status;
84740
84828
 
84741
84829
  if (status !== STATUS_FULL) {
84742
84830
  // queue still has space, we're done
84743
84831
  return;
84744
84832
  }
84745
84833
 
84746
- const length = this.__data.length;
84834
+ const length = this.#data.length;
84747
84835
 
84748
84836
  if (UINT32_MAX === length) {
84749
84837
  throw new Error('Maximum array size exceeded');
@@ -84762,19 +84850,19 @@ class Deque {
84762
84850
  */
84763
84851
  const new_data = new Array(new_length);
84764
84852
 
84765
- const head = this.__head;
84853
+ const head = this.#head;
84766
84854
 
84767
84855
  // copy the front portion
84768
- array_copy(this.__data, head, new_data, 0, length - head);
84856
+ array_copy(this.#data, head, new_data, 0, length - head);
84769
84857
  // copy the remainder
84770
- array_copy(this.__data, 0, new_data, length - head, head);
84858
+ array_copy(this.#data, 0, new_data, length - head, head);
84771
84859
 
84772
- this.__head = 0;
84773
- this.__tail = length;
84860
+ this.#head = 0;
84861
+ this.#tail = length;
84774
84862
 
84775
- this.__status = STATUS_NORMAL;
84863
+ this.#status = STATUS_NORMAL;
84776
84864
 
84777
- this.__data = new_data;
84865
+ this.#data = new_data;
84778
84866
  }
84779
84867
 
84780
84868
  /**
@@ -84786,34 +84874,34 @@ class Deque {
84786
84874
  }
84787
84875
 
84788
84876
  clear() {
84789
- if (this.__status !== STATUS_EMPTY) {
84790
- let cursor = this.__head;
84791
- const tail = this.__tail;
84877
+ if (this.#status !== STATUS_EMPTY) {
84878
+ let cursor = this.#head;
84879
+ const tail = this.#tail;
84792
84880
 
84793
84881
  do {
84794
- this.__data[cursor] = undefined;
84795
- cursor = this.__circular_next_position(cursor);
84882
+ this.#data[cursor] = undefined;
84883
+ cursor = this.#circular_next_position(cursor);
84796
84884
  } while (cursor !== tail);
84797
84885
 
84798
- this.__status = STATUS_EMPTY;
84886
+ this.#status = STATUS_EMPTY;
84799
84887
  }
84800
84888
 
84801
- this.__head = 0;
84802
- this.__tail = 0;
84889
+ this.#head = 0;
84890
+ this.#tail = 0;
84803
84891
  }
84804
84892
 
84805
84893
  /**
84806
84894
  * @returns {number}
84807
84895
  */
84808
84896
  size() {
84809
- const data = this.__data;
84897
+ const data = this.#data;
84810
84898
 
84811
- if (this.__status === STATUS_FULL) {
84899
+ if (this.#status === STATUS_FULL) {
84812
84900
  return data.length;
84813
84901
  }
84814
84902
 
84815
- const head = this.__head;
84816
- const tail = this.__tail;
84903
+ const head = this.#head;
84904
+ const tail = this.#tail;
84817
84905
 
84818
84906
  return (head <= tail) ? (tail - head) : (tail + data.length - head);
84819
84907
  }
@@ -84824,43 +84912,43 @@ class Deque {
84824
84912
  * @param {boolean} shift_front should we shift elements before the removed element or after?
84825
84913
  * @private
84826
84914
  */
84827
- __remove_internal(current, shift_front) {
84915
+ #remove_internal(current, shift_front) {
84828
84916
  let cursor = current;
84829
84917
 
84830
84918
  if (shift_front) {
84831
84919
 
84832
84920
  // shift towards tail
84833
84921
 
84834
- const head = this.__head;
84922
+ const head = this.#head;
84835
84923
 
84836
84924
  while (cursor !== head) {
84837
- const next = this.__circular_previous_position(cursor);
84838
- this.__data[cursor] = this.__data[next];
84925
+ const next = this.#circular_previous_position(cursor);
84926
+ this.#data[cursor] = this.#data[next];
84839
84927
  cursor = next;
84840
84928
  }
84841
84929
 
84842
- this.__head = this.__circular_next_position(head);
84930
+ this.#head = this.#circular_next_position(head);
84843
84931
 
84844
84932
  } else {
84845
84933
 
84846
84934
  // shift towards head
84847
84935
 
84848
- const tail = this.__tail;
84936
+ const tail = this.#tail;
84849
84937
 
84850
84938
  while (cursor !== tail) {
84851
- const next = this.__circular_next_position(cursor);
84852
- this.__data[cursor] = this.__data[next];
84939
+ const next = this.#circular_next_position(cursor);
84940
+ this.#data[cursor] = this.#data[next];
84853
84941
  cursor = next;
84854
84942
  }
84855
84943
 
84856
- this.__tail = this.__circular_previous_position(tail);
84944
+ this.#tail = this.#circular_previous_position(tail);
84857
84945
 
84858
84946
  }
84859
84947
 
84860
84948
  // fill in slot of last moved element
84861
- this.__data[cursor] = undefined;
84949
+ this.#data[cursor] = undefined;
84862
84950
 
84863
- this.resetStatus(false);
84951
+ this.#reset_status(false);
84864
84952
  }
84865
84953
 
84866
84954
  /**
@@ -84869,13 +84957,13 @@ class Deque {
84869
84957
  * @returns {boolean}
84870
84958
  */
84871
84959
  remove(e) {
84872
- const i = this.__index_of(e);
84960
+ const i = this.#index_of(e);
84873
84961
 
84874
84962
  if (i === -1) {
84875
84963
  return false;
84876
84964
  }
84877
84965
 
84878
- this.__remove_internal(i, true);
84966
+ this.#remove_internal(i, true);
84879
84967
 
84880
84968
  return true;
84881
84969
  }
@@ -84886,14 +84974,14 @@ class Deque {
84886
84974
  * @returns {number}
84887
84975
  * @private
84888
84976
  */
84889
- __index_of(e) {
84977
+ #index_of(e) {
84890
84978
  const size = this.size();
84891
84979
 
84892
- const data = this.__data;
84980
+ const data = this.#data;
84893
84981
  const capacity = data.length;
84894
84982
 
84895
84983
  for (let i = 0; i < size; i++) {
84896
- const index = (this.__head + i) % capacity;
84984
+ const index = (this.#head + i) % capacity;
84897
84985
 
84898
84986
  const el = data[index];
84899
84987
 
@@ -84911,7 +84999,7 @@ class Deque {
84911
84999
  * @returns {boolean}
84912
85000
  */
84913
85001
  has(e) {
84914
- return this.__index_of(e) !== -1;
85002
+ return this.#index_of(e) !== -1;
84915
85003
  }
84916
85004
 
84917
85005
  /**
@@ -84919,10 +85007,10 @@ class Deque {
84919
85007
  * @param {T} e
84920
85008
  */
84921
85009
  addFirst(e) {
84922
- this.__check_and_expand();
84923
- this.__head = this.__circular_previous_position(this.__head);
84924
- this.__data[this.__head] = e;
84925
- this.resetStatus(true);
85010
+ this.#check_and_expand();
85011
+ this.#head = this.#circular_previous_position(this.#head);
85012
+ this.#data[this.#head] = e;
85013
+ this.#reset_status(true);
84926
85014
  }
84927
85015
 
84928
85016
  /**
@@ -84930,10 +85018,10 @@ class Deque {
84930
85018
  * @returns {T|undefined}
84931
85019
  */
84932
85020
  removeFirst() {
84933
- const element = this.__data[this.__head];
84934
- this.__data[this.__head] = undefined;
84935
- this.__head = this.__circular_next_position(this.__head);
84936
- this.resetStatus(false);
85021
+ const element = this.#data[this.#head];
85022
+ this.#data[this.#head] = undefined;
85023
+ this.#head = this.#circular_next_position(this.#head);
85024
+ this.#reset_status(false);
84937
85025
  return element;
84938
85026
  }
84939
85027
 
@@ -84942,7 +85030,7 @@ class Deque {
84942
85030
  * @returns {T|undefined}
84943
85031
  */
84944
85032
  getFirst() {
84945
- return this.__data[this.__head];
85033
+ return this.#data[this.#head];
84946
85034
  }
84947
85035
 
84948
85036
  /**
@@ -84950,10 +85038,10 @@ class Deque {
84950
85038
  * @param {T} e
84951
85039
  */
84952
85040
  addLast(e) {
84953
- this.__check_and_expand();
84954
- this.__data[this.__tail] = e;
84955
- this.__tail = this.__circular_next_position(this.__tail);
84956
- this.resetStatus(true);
85041
+ this.#check_and_expand();
85042
+ this.#data[this.#tail] = e;
85043
+ this.#tail = this.#circular_next_position(this.#tail);
85044
+ this.#reset_status(true);
84957
85045
  }
84958
85046
 
84959
85047
  /**
@@ -84961,11 +85049,11 @@ class Deque {
84961
85049
  * @returns {T}
84962
85050
  */
84963
85051
  removeLast() {
84964
- const last = this.__circular_previous_position(this.__tail);
84965
- const element = this.__data[last];
84966
- this.__data[last] = undefined;
84967
- this.__tail = last;
84968
- this.resetStatus(false);
85052
+ const last = this.#circular_previous_position(this.#tail);
85053
+ const element = this.#data[last];
85054
+ this.#data[last] = undefined;
85055
+ this.#tail = last;
85056
+ this.#reset_status(false);
84969
85057
  return element;
84970
85058
  }
84971
85059
 
@@ -84975,8 +85063,8 @@ class Deque {
84975
85063
  * @returns {T|undefined}
84976
85064
  */
84977
85065
  getLast() {
84978
- const last = this.__circular_previous_position(this.__tail);
84979
- return this.__data[last];
85066
+ const last = this.#circular_previous_position(this.#tail);
85067
+ return this.#data[last];
84980
85068
  }
84981
85069
  }
84982
85070
 
@@ -98789,6 +98877,38 @@ class Rectangle {
98789
98877
  this.size = new Vector2(width, height);
98790
98878
  }
98791
98879
 
98880
+ /**
98881
+ *
98882
+ * @return {number}
98883
+ */
98884
+ get x0() {
98885
+ return this.position.x;
98886
+ }
98887
+
98888
+ /**
98889
+ *
98890
+ * @return {number}
98891
+ */
98892
+ get x1() {
98893
+ return this.position.x + this.size.x;
98894
+ }
98895
+
98896
+ /**
98897
+ *
98898
+ * @return {number}
98899
+ */
98900
+ get y0() {
98901
+ return this.position.y;
98902
+ }
98903
+
98904
+ /**
98905
+ *
98906
+ * @return {number}
98907
+ */
98908
+ get y1() {
98909
+ return this.position.y + this.size.y;
98910
+ }
98911
+
98792
98912
  /**
98793
98913
  *
98794
98914
  * @param {number} x
@@ -98806,7 +98926,13 @@ class Rectangle {
98806
98926
  * @returns {Rectangle}
98807
98927
  */
98808
98928
  clone() {
98809
- return new Rectangle(this.position.x, this.position.y, this.size.x, this.size.y);
98929
+ const position = this.position;
98930
+ const size = this.size;
98931
+
98932
+ return new Rectangle(
98933
+ position.x, position.y,
98934
+ size.x, size.y
98935
+ );
98810
98936
  }
98811
98937
 
98812
98938
  /**
@@ -98867,6 +98993,11 @@ class Rectangle {
98867
98993
  return overlap1D(x0, x1, _x0, s.x + _x0) && overlap1D(y0, y1, _y0, _y0 + s.y);
98868
98994
  }
98869
98995
 
98996
+ /**
98997
+ *
98998
+ * @param {Rectangle} other
98999
+ * @returns {boolean}
99000
+ */
98870
99001
  overlaps(other) {
98871
99002
  const x0 = other.position.x;
98872
99003
  const y0 = other.position.y;
@@ -98875,6 +99006,13 @@ class Rectangle {
98875
99006
  return this._overlaps(x0, y0, x1, y1);
98876
99007
  }
98877
99008
 
99009
+ /**
99010
+ *
99011
+ * @param {number} x0
99012
+ * @param {number} y0
99013
+ * @param {number} x1
99014
+ * @param {number} y1
99015
+ */
98878
99016
  _resizeToFit(x0, y0, x1, y1) {
98879
99017
  const size = this.size;
98880
99018
 
@@ -98900,6 +99038,10 @@ class Rectangle {
98900
99038
  size.set(nX1 - nX0, nY1 - nY0);
98901
99039
  }
98902
99040
 
99041
+ /**
99042
+ *
99043
+ * @param {Rectangle} other
99044
+ */
98903
99045
  resizeToFit(other) {
98904
99046
  const x0 = other.position.x;
98905
99047
  const y0 = other.position.y;
@@ -98909,6 +99051,14 @@ class Rectangle {
98909
99051
  return this._resizeToFit(x0, y0, x1, y1);
98910
99052
  }
98911
99053
 
99054
+ /**
99055
+ *
99056
+ * @param {number} x0
99057
+ * @param {number} y0
99058
+ * @param {number} x1
99059
+ * @param {number} y1
99060
+ * @returns {boolean}
99061
+ */
98912
99062
  _contains(x0, y0, x1, y1) {
98913
99063
  const size = this.size;
98914
99064
 
@@ -98921,6 +99071,11 @@ class Rectangle {
98921
99071
  return x0 >= _x0 && x1 <= _x1 && y0 >= _y0 && y1 <= _y1;
98922
99072
  }
98923
99073
 
99074
+ /**
99075
+ *
99076
+ * @param {Rectangle} other
99077
+ * @returns {boolean}
99078
+ */
98924
99079
  contains(other) {
98925
99080
  const x0 = other.position.x;
98926
99081
  const y0 = other.position.y;