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