@woosh/meep-engine 2.89.5 → 2.91.0

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 (63) hide show
  1. package/build/bundle-worker-terrain.js +1 -1
  2. package/build/meep.cjs +55 -36
  3. package/build/meep.min.js +1 -1
  4. package/build/meep.module.js +55 -36
  5. package/package.json +1 -1
  6. package/src/core/binary/de_interleave_2_bits.spec.d.ts.map +1 -0
  7. package/src/core/binary/de_interleave_bits_by_2.d.ts.map +1 -0
  8. package/src/core/binary/reinterpret_float32_as_int32.d.ts.map +1 -0
  9. package/src/core/binary/split_by_2.d.ts.map +1 -0
  10. package/src/core/binary/split_by_3.d.ts.map +1 -0
  11. package/src/core/bvh2/binary/2/BinaryUint32BVH.d.ts.map +1 -1
  12. package/src/core/bvh2/binary/2/BinaryUint32BVH.js +3 -4
  13. package/src/core/bvh2/bvh3/BVH.js +1 -1
  14. package/src/core/geom/2d/aabb/AABB2.d.ts.map +1 -1
  15. package/src/core/geom/2d/aabb/AABB2.js +2 -4
  16. package/src/core/geom/2d/aabb/aabb2_array_combine.d.ts +11 -0
  17. package/src/core/geom/2d/aabb/aabb2_array_combine.d.ts.map +1 -0
  18. package/src/core/geom/2d/aabb/aabb2_array_combine.js +35 -0
  19. package/src/core/geom/2d/aabb/aabb2_array_set.d.ts +11 -0
  20. package/src/core/geom/2d/aabb/aabb2_array_set.d.ts.map +1 -0
  21. package/src/core/geom/2d/aabb/aabb2_array_set.js +21 -0
  22. package/src/core/geom/2d/aabb/aabb2_compute_area.d.ts +10 -0
  23. package/src/core/geom/2d/aabb/aabb2_compute_area.d.ts.map +1 -0
  24. package/src/core/geom/2d/aabb/aabb2_compute_area.js +14 -0
  25. package/src/core/geom/2d/bvh/BVH2D.d.ts +289 -0
  26. package/src/core/geom/2d/bvh/BVH2D.d.ts.map +1 -0
  27. package/src/core/geom/2d/bvh/BVH2D.js +1143 -0
  28. package/src/core/geom/2d/bvh/BVH2D.spec.d.ts +2 -0
  29. package/src/core/geom/2d/bvh/BVH2D.spec.d.ts.map +1 -0
  30. package/src/core/geom/2d/bvh/BVH2D.spec.js +358 -0
  31. package/src/core/geom/2d/lt-grid/LooseTightGrid.js +2 -2
  32. package/src/core/geom/2d/quad-tree/QuadTreeNode.spec.js +1 -1
  33. package/src/core/geom/2d/r-tree/StaticR2Tree.d.ts +79 -0
  34. package/src/core/geom/2d/r-tree/StaticR2Tree.d.ts.map +1 -0
  35. package/src/core/geom/2d/r-tree/StaticR2Tree.js +384 -0
  36. package/src/core/geom/2d/r-tree/StaticR2Tree.spec.d.ts +2 -0
  37. package/src/core/geom/2d/r-tree/StaticR2Tree.spec.d.ts.map +1 -0
  38. package/src/core/geom/2d/r-tree/StaticR2Tree.spec.js +62 -0
  39. package/src/core/geom/3d/morton/mortonEncode_magicbits.js +1 -1
  40. package/src/core/geom/3d/topology/struct/binary/io/OrderedEdge.js +1 -1
  41. package/src/engine/graphics/render/forward_plus/LightManager.d.ts.map +1 -1
  42. package/src/engine/graphics/render/forward_plus/LightManager.js +2 -0
  43. package/src/engine/graphics/render/forward_plus/cluster/read_plane_pair.d.ts +1 -1
  44. package/src/engine/graphics/render/forward_plus/cluster/read_plane_pair.js +1 -1
  45. package/src/engine/graphics/texture/virtual/tile/compose_tile_address.js +1 -1
  46. package/src/engine/graphics/texture/virtual/tile/tile_address_to_finger_print.js +1 -1
  47. package/src/engine/input/devices/KeyboardDevice.d.ts.map +1 -1
  48. package/src/engine/input/devices/KeyboardDevice.js +7 -1
  49. package/src/core/geom/3d/morton/de_interleave_2_bits.spec.d.ts.map +0 -1
  50. package/src/core/geom/3d/morton/de_interleave_bits_by_2.d.ts.map +0 -1
  51. package/src/core/geom/3d/morton/reinterpret_float32_as_int32.d.ts.map +0 -1
  52. package/src/core/geom/3d/morton/split_by_2.d.ts.map +0 -1
  53. package/src/core/geom/3d/morton/split_by_3.d.ts.map +0 -1
  54. /package/src/core/{geom/3d/morton → binary}/de_interleave_2_bits.spec.d.ts +0 -0
  55. /package/src/core/{geom/3d/morton → binary}/de_interleave_2_bits.spec.js +0 -0
  56. /package/src/core/{geom/3d/morton → binary}/de_interleave_bits_by_2.d.ts +0 -0
  57. /package/src/core/{geom/3d/morton → binary}/de_interleave_bits_by_2.js +0 -0
  58. /package/src/core/{geom/3d/morton → binary}/reinterpret_float32_as_int32.d.ts +0 -0
  59. /package/src/core/{geom/3d/morton → binary}/reinterpret_float32_as_int32.js +0 -0
  60. /package/src/core/{geom/3d/morton → binary}/split_by_2.d.ts +0 -0
  61. /package/src/core/{geom/3d/morton → binary}/split_by_2.js +0 -0
  62. /package/src/core/{geom/3d/morton → binary}/split_by_3.d.ts +0 -0
  63. /package/src/core/{geom/3d/morton → binary}/split_by_3.js +0 -0
@@ -52052,7 +52052,7 @@ const COLUMN_USER_DATA = COLUMN_CHILD_2;
52052
52052
  *
52053
52053
  * @type {number}
52054
52054
  */
52055
- const NULL_NODE = 4294967295;
52055
+ const NULL_NODE = UINT32_MAX;
52056
52056
 
52057
52057
  /**
52058
52058
  * @readonly
@@ -55534,7 +55534,7 @@ class BinaryUint32BVH {
55534
55534
 
55535
55535
  // build bottom-most level, just above the leaves
55536
55536
  for (i = 0; i < level_node_count; i++) {
55537
- const leaf_index_0 = i * 2;
55537
+ const leaf_index_0 = i << 1;
55538
55538
  const leaf_index_1 = leaf_index_0 + 1;
55539
55539
 
55540
55540
  const leaf_offset_0 = leaf_node_block_address + leaf_index_0 * BVH_LEAF_NODE_SIZE;
@@ -55562,18 +55562,17 @@ class BinaryUint32BVH {
55562
55562
 
55563
55563
  //build intermediate nodes
55564
55564
  for (; level >= 0; level--) {
55565
- level_node_count = Math.pow(2, level);
55565
+ level_node_count = 1 << level;
55566
55566
  parentIndex = (level_node_count - 1);
55567
55567
 
55568
55568
  for (i = 0; i < level_node_count; i++) {
55569
55569
 
55570
55570
  const childIndex0 = (parentIndex << 1) + 1;
55571
- const childIndex1 = childIndex0 + 1;
55572
55571
 
55573
55572
  const address_parent = parentIndex * BVH_BINARY_NODE_SIZE;
55574
55573
 
55575
55574
  const address_child_0 = childIndex0 * BVH_BINARY_NODE_SIZE;
55576
- const address_child_1 = childIndex1 * BVH_BINARY_NODE_SIZE;
55575
+ const address_child_1 = address_child_0 + BVH_BINARY_NODE_SIZE;
55577
55576
 
55578
55577
  aabb3_array_combine(
55579
55578
  float32, address_parent,
@@ -79317,6 +79316,21 @@ function line_segment_compute_line_segment_intersection_2d(
79317
79316
  return collision;
79318
79317
  }
79319
79318
 
79319
+ /**
79320
+ *
79321
+ * @param {number} x0
79322
+ * @param {number} y0
79323
+ * @param {number} x1
79324
+ * @param {number} y1
79325
+ * @return {number}
79326
+ */
79327
+ function aabb2_compute_area(x0, y0, x1, y1) {
79328
+ const dx = x1 - x0;
79329
+ const dy = y1 - y0;
79330
+
79331
+ return dx * dy;
79332
+ }
79333
+
79320
79334
  /**
79321
79335
  *
79322
79336
  * @param {number} ax0
@@ -79655,10 +79669,7 @@ class AABB2 {
79655
79669
  const x1 = this.x1;
79656
79670
  const y1 = this.y1;
79657
79671
 
79658
- const dx = x1 - x0;
79659
- const dy = y1 - y0;
79660
-
79661
- return dx * dy;
79672
+ return aabb2_compute_area(x0, y0, x1, y1);
79662
79673
  }
79663
79674
 
79664
79675
  /**
@@ -89892,6 +89903,32 @@ function classifyPassTypeFromObject(object) {
89892
89903
  return RenderPassType.Opaque;
89893
89904
  }
89894
89905
 
89906
+ const KeyboardEvents = {
89907
+ KeyUp: 'keyup',
89908
+ KeyDown: 'keydown'
89909
+ };
89910
+
89911
+ /**
89912
+ * Representation of an input device key
89913
+ */
89914
+ class InputDeviceSwitch {
89915
+ /**
89916
+ * Button press
89917
+ * @type {Signal}
89918
+ */
89919
+ down = new Signal()
89920
+ /**
89921
+ * Button release
89922
+ * @type {Signal}
89923
+ */
89924
+ up = new Signal()
89925
+ /**
89926
+ * is button currently being pressed?
89927
+ * @type {boolean}
89928
+ */
89929
+ is_down = false
89930
+ }
89931
+
89895
89932
  /**
89896
89933
  * Created by Alex on 06/03/2017.
89897
89934
  */
@@ -89998,32 +90035,6 @@ const KeyCodes = {
89998
90035
  'back_quote': 223
89999
90036
  };
90000
90037
 
90001
- const KeyboardEvents = {
90002
- KeyUp: 'keyup',
90003
- KeyDown: 'keydown'
90004
- };
90005
-
90006
- /**
90007
- * Representation of an input device key
90008
- */
90009
- class InputDeviceSwitch {
90010
- /**
90011
- * Button press
90012
- * @type {Signal}
90013
- */
90014
- down = new Signal()
90015
- /**
90016
- * Button release
90017
- * @type {Signal}
90018
- */
90019
- up = new Signal()
90020
- /**
90021
- * is button currently being pressed?
90022
- * @type {boolean}
90023
- */
90024
- is_down = false
90025
- }
90026
-
90027
90038
  /**
90028
90039
  * Created by Alex on 06/03/2017.
90029
90040
  */
@@ -90125,6 +90136,12 @@ class KeyboardDevice {
90125
90136
  * @private
90126
90137
  */
90127
90138
  #handlerKeyDown = (event) => {
90139
+ if (event.repeat) {
90140
+ // ignore automatic repetition
90141
+ // see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat
90142
+ return;
90143
+ }
90144
+
90128
90145
  this.on.down.send1(event);
90129
90146
 
90130
90147
  //hook up dispatch handler for individual keys
@@ -108672,7 +108689,7 @@ function compute_cluster_planes_from_points(result, points, x_slices, y_slices,
108672
108689
  }
108673
108690
 
108674
108691
  /**
108675
- * Read out a pair of planes from an numeric array
108692
+ * Read out a pair of planes from a numeric array
108676
108693
  * @param {number[]|Float32Array} source
108677
108694
  * @param {number} source_offset
108678
108695
  * @param {number[]|Float64Array|Float32Array} destination
@@ -110111,6 +110128,7 @@ class LightManager {
110111
110128
 
110112
110129
  const tile_data_offset = tile_index * 4;
110113
110130
 
110131
+ //assign lights
110114
110132
  lookup_address_offset += assign_cluster(
110115
110133
  tile_data_offset,
110116
110134
  bvh_lights,
@@ -110120,6 +110138,7 @@ class LightManager {
110120
110138
  light_source_data
110121
110139
  );
110122
110140
 
110141
+ // assign decals
110123
110142
  const decal_count = assign_cluster(
110124
110143
  tile_data_offset + 2,
110125
110144
  bvh_decals,
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Fully featured ECS game engine written in JavaScript",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.89.5",
8
+ "version": "2.91.0",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"de_interleave_2_bits.spec.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/de_interleave_2_bits.spec.js"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"de_interleave_bits_by_2.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/de_interleave_bits_by_2.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAHW,MAAM,GACJ,MAAM,CAWlB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reinterpret_float32_as_int32.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/reinterpret_float32_as_int32.js"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,oDAHW,MAAM,GACJ,MAAM,CAKlB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"split_by_2.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/split_by_2.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,8BAHW,MAAM,GACJ,MAAM,CAUlB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"split_by_3.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/split_by_3.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,8BAHW,MAAM,GACJ,MAAM,CASlB"}
@@ -1 +1 @@
1
- {"version":3,"file":"BinaryUint32BVH.d.ts","sourceRoot":"","sources":["../../../../../../src/core/bvh2/binary/2/BinaryUint32BVH.js"],"names":[],"mappings":"AAcA;;;GAGG;AACH,gCAFU,MAAM,CAEmB;AAEnC;;;;GAIG;AACH,mCAFU,MAAM,CAEsB;AACtC;;;GAGG;AACH,iCAFU,MAAM,CAEoB;AAiDpC;IACI;;;;OAIG;IACH,sBAAc;IAEd;;;;OAIG;IACH,gCAAe;IAEf;;;;OAIG;IACH,+BAAc;IAEd;;;;OAIG;IACH,4BAAwB;IAExB;;;;OAIG;IACH,0BAAsB;IA0CtB;;;OAGG;IACH,2BAOC;IAED,wBAEC;IAnDD;;;OAGG;IACH,oBAFa,MAAM,CAIlB;IAED,2BAEC;IAED,gCAEC;IAED,8BAEC;IAED;;;OAGG;IACH,uBAFa,MAAM,CAIlB;IAED,4BAEC;IAED,0BAEC;IAmBD;;;;OAIG;IACH,2BAHW,MAAM,GACJ,MAAM,CAalB;IAED,6BASC;IAED;;;OAGG;IACH,oBAFW,MAAM,QAchB;IAED;;;;;;;;;;OAUG;IACH,mBATW,MAAM,WACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAwBhB;IAED;;;;;OAKG;IACH,oBAJW,MAAM,eACN,MAAM,EAAE,GAAC,YAAY,sBACrB,MAAM,QAIhB;IAED;;;;OAIG;IACH,4BAHW,MAAM,GACJ,MAAM,CAQlB;IAED,qCAoBC;IAED;;;;;;;OAOG;IACH,yCAYC;IAED;;;;;;OAMG;IACH,kDAuBC;IAED,wBAUC;IAGD;;;OAGG;IACH,oBAFW,MAAM,EAAE,QAkElB;IAED;;;;;OAKG;IACH,sBAUC;IAED;;OAEG;IACH,cAuEC;CACJ"}
1
+ {"version":3,"file":"BinaryUint32BVH.d.ts","sourceRoot":"","sources":["../../../../../../src/core/bvh2/binary/2/BinaryUint32BVH.js"],"names":[],"mappings":"AAcA;;;GAGG;AACH,gCAFU,MAAM,CAEmB;AAEnC;;;;GAIG;AACH,mCAFU,MAAM,CAEsB;AACtC;;;GAGG;AACH,iCAFU,MAAM,CAEoB;AAiDpC;IACI;;;;OAIG;IACH,sBAAc;IAEd;;;;OAIG;IACH,gCAAe;IAEf;;;;OAIG;IACH,+BAAc;IAEd;;;;OAIG;IACH,4BAAwB;IAExB;;;;OAIG;IACH,0BAAsB;IA0CtB;;;OAGG;IACH,2BAOC;IAED,wBAEC;IAnDD;;;OAGG;IACH,oBAFa,MAAM,CAIlB;IAED,2BAEC;IAED,gCAEC;IAED,8BAEC;IAED;;;OAGG;IACH,uBAFa,MAAM,CAIlB;IAED,4BAEC;IAED,0BAEC;IAmBD;;;;OAIG;IACH,2BAHW,MAAM,GACJ,MAAM,CAalB;IAED,6BASC;IAED;;;OAGG;IACH,oBAFW,MAAM,QAchB;IAED;;;;;;;;;;OAUG;IACH,mBATW,MAAM,WACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAwBhB;IAED;;;;;OAKG;IACH,oBAJW,MAAM,eACN,MAAM,EAAE,GAAC,YAAY,sBACrB,MAAM,QAIhB;IAED;;;;OAIG;IACH,4BAHW,MAAM,GACJ,MAAM,CAQlB;IAED,qCAoBC;IAED;;;;;;;OAOG;IACH,yCAYC;IAED;;;;;;OAMG;IACH,kDAuBC;IAED,wBAUC;IAGD;;;OAGG;IACH,oBAFW,MAAM,EAAE,QAkElB;IAED;;;;;OAKG;IACH,sBAUC;IAED;;OAEG;IACH,cAsEC;CACJ"}
@@ -476,7 +476,7 @@ export class BinaryUint32BVH {
476
476
 
477
477
  // build bottom-most level, just above the leaves
478
478
  for (i = 0; i < level_node_count; i++) {
479
- const leaf_index_0 = i * 2;
479
+ const leaf_index_0 = i << 1;
480
480
  const leaf_index_1 = leaf_index_0 + 1;
481
481
 
482
482
  const leaf_offset_0 = leaf_node_block_address + leaf_index_0 * BVH_LEAF_NODE_SIZE;
@@ -504,18 +504,17 @@ export class BinaryUint32BVH {
504
504
 
505
505
  //build intermediate nodes
506
506
  for (; level >= 0; level--) {
507
- level_node_count = Math.pow(2, level);
507
+ level_node_count = 1 << level;
508
508
  parentIndex = (level_node_count - 1);
509
509
 
510
510
  for (i = 0; i < level_node_count; i++) {
511
511
 
512
512
  const childIndex0 = (parentIndex << 1) + 1;
513
- const childIndex1 = childIndex0 + 1;
514
513
 
515
514
  const address_parent = parentIndex * BVH_BINARY_NODE_SIZE;
516
515
 
517
516
  const address_child_0 = childIndex0 * BVH_BINARY_NODE_SIZE;
518
- const address_child_1 = childIndex1 * BVH_BINARY_NODE_SIZE;
517
+ const address_child_1 = address_child_0 + BVH_BINARY_NODE_SIZE;
519
518
 
520
519
  aabb3_array_combine(
521
520
  float32, address_parent,
@@ -23,7 +23,7 @@ const COLUMN_USER_DATA = COLUMN_CHILD_2;
23
23
  *
24
24
  * @type {number}
25
25
  */
26
- export const NULL_NODE = 4294967295;
26
+ export const NULL_NODE = UINT32_MAX;
27
27
 
28
28
  /**
29
29
  * @readonly
@@ -1 +1 @@
1
- {"version":3,"file":"AABB2.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/aabb/AABB2.js"],"names":[],"mappings":";AAiBA;;;GAGG;AACH;IACI;;;;;;OAMG;IACH,gEA+BC;IApBG;;;OAGG;IACH,WAAY;IACZ;;;OAGG;IACH,WAAY;IACZ;;;OAGG;IACH,WAAY;IACZ;;;OAGG;IACH,WAAY;IAGhB;;;OAGG;IACH,WAFW,MAAM,QAIhB;IAED;;;OAGG;IACH,aAFW,MAAM,QAIhB;IAED;;;OAGG;IACH,gBAFW,MAAM,EAAE,QA8BlB;IAED;;;OAGG;IACH,sBAFW,MAAM,QAShB;IAED;;;;;OAKG;IACH,sBAJW,KAAK,UACL,KAAK,GACH,OAAO,CAcnB;IAED;;;;OAIG;IACH,qBAHW,KAAK,GACH,OAAO,CAcnB;IAED;;;;;;;OAOG;IACH,0EAMC;IAED;;;;OAIG;IACH,qBAHW,MAAM,KACN,MAAM,QAKhB;IAED;;;OAGG;IACH,QAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,QAFa,MAAM,CAIlB;IAED;;;;;;OAMG;IACH,0BALW,OAAO,MACP,OAAO,UACP,OAAO,GACL,OAAO,CA0BnB;IAED;;;;OAIG;IACH,kCAHW,OAAO,UACP,OAAO,QAmBjB;IAED;;;;OAIG;IACH,wBAHW,KAAK,GACH,MAAM,CAIlB;IAED;;;;;;;OAOG;IACH,sBANW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CA4BlB;IAED;;;OAGG;IACH,eAFa,MAAM,CAYlB;IAED;;;OAGG;IACH,sBAFY,MAAM,CAYjB;IAED;;;;;OAKG;IACH,iBAJW,MAAM,KACN,MAAM,GACJ,OAAO,CAInB;IAED;;;OAGG;IACH,mBAFW,KAAK,QAIf;IAED;;;OAGG;IACH,kBAFW,OAAO,QAOjB;IAED;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,aAFa,MAAM,CAIlB;IAED;;;;;;;OAOG;IACH,0DAiBC;IAED;;;;OAIG;IACH,eAHW,MAAM,KACN,MAAM,QAOhB;IAED;;;;OAIG;IACH,aAHW,MAAM,UACN,MAAM,QAIhB;IAED;;;OAGG;IACH,SAFa,KAAK,CAIjB;IAED;;;;OAIG;IACH,YAHW,KAAK,GACH,KAAK,CAIjB;IAED;;;;OAIG;IACH,cAHW,KAAK,GACH,OAAO,CAOnB;IAED;;;;;;OAMG;IACH,UALW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAQhB;IAED;;;;;;OAMG;IACH,uBALW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAsBhB;IAED;;OAEG;IACH,oCAEC;IAED,mBAEC;IAED;;;;;MAOC;IAED,0BAEC;CACJ;;;qBAqCS,KAAK;qBAML,KAAK;;oBAljBK,kBAAkB;AA0gBtC;;;;;;;GAOG;AACH,gDANW,KAAK,MACL,KAAK,MACL,OAAO,MACP,OAAO,GACL,OAAO,CAsBnB"}
1
+ {"version":3,"file":"AABB2.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/aabb/AABB2.js"],"names":[],"mappings":";AAkBA;;;GAGG;AACH;IACI;;;;;;OAMG;IACH,gEA+BC;IApBG;;;OAGG;IACH,WAAY;IACZ;;;OAGG;IACH,WAAY;IACZ;;;OAGG;IACH,WAAY;IACZ;;;OAGG;IACH,WAAY;IAGhB;;;OAGG;IACH,WAFW,MAAM,QAIhB;IAED;;;OAGG;IACH,aAFW,MAAM,QAIhB;IAED;;;OAGG;IACH,gBAFW,MAAM,EAAE,QA8BlB;IAED;;;OAGG;IACH,sBAFW,MAAM,QAShB;IAED;;;;;OAKG;IACH,sBAJW,KAAK,UACL,KAAK,GACH,OAAO,CAcnB;IAED;;;;OAIG;IACH,qBAHW,KAAK,GACH,OAAO,CAcnB;IAED;;;;;;;OAOG;IACH,0EAMC;IAED;;;;OAIG;IACH,qBAHW,MAAM,KACN,MAAM,QAKhB;IAED;;;OAGG;IACH,QAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,QAFa,MAAM,CAIlB;IAED;;;;;;OAMG;IACH,0BALW,OAAO,MACP,OAAO,UACP,OAAO,GACL,OAAO,CA0BnB;IAED;;;;OAIG;IACH,kCAHW,OAAO,UACP,OAAO,QAmBjB;IAED;;;;OAIG;IACH,wBAHW,KAAK,GACH,MAAM,CAIlB;IAED;;;;;;;OAOG;IACH,sBANW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CA4BlB;IAED;;;OAGG;IACH,eAFa,MAAM,CASlB;IAED;;;OAGG;IACH,sBAFY,MAAM,CAYjB;IAED;;;;;OAKG;IACH,iBAJW,MAAM,KACN,MAAM,GACJ,OAAO,CAInB;IAED;;;OAGG;IACH,mBAFW,KAAK,QAIf;IAED;;;OAGG;IACH,kBAFW,OAAO,QAOjB;IAED;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,aAFa,MAAM,CAIlB;IAED;;;;;;;OAOG;IACH,0DAiBC;IAED;;;;OAIG;IACH,eAHW,MAAM,KACN,MAAM,QAOhB;IAED;;;;OAIG;IACH,aAHW,MAAM,UACN,MAAM,QAIhB;IAED;;;OAGG;IACH,SAFa,KAAK,CAIjB;IAED;;;;OAIG;IACH,YAHW,KAAK,GACH,KAAK,CAIjB;IAED;;;;OAIG;IACH,cAHW,KAAK,GACH,OAAO,CAOnB;IAED;;;;;;OAMG;IACH,UALW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAQhB;IAED;;;;;;OAMG;IACH,uBALW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAsBhB;IAED;;OAEG;IACH,oCAEC;IAED,mBAEC;IAED;;;;;MAOC;IAED,0BAEC;CACJ;;;qBAqCS,KAAK;qBAML,KAAK;;oBAhjBK,kBAAkB;AAwgBtC;;;;;;;GAOG;AACH,gDANW,KAAK,MACL,KAAK,MACL,OAAO,MACP,OAAO,GACL,OAAO,CAsBnB"}
@@ -12,6 +12,7 @@ import Vector2 from "../../Vector2.js";
12
12
  import {
13
13
  line_segment_compute_line_segment_intersection_2d
14
14
  } from "../line/line_segment_compute_line_segment_intersection_2d.js";
15
+ import { aabb2_compute_area } from "./aabb2_compute_area.js";
15
16
  import { aabb2_compute_overlap } from "./aabb2_compute_overlap.js";
16
17
  import { aabb2_overlap_exists } from "./aabb2_overlap_exists.js";
17
18
 
@@ -316,10 +317,7 @@ class AABB2 {
316
317
  const x1 = this.x1;
317
318
  const y1 = this.y1;
318
319
 
319
- const dx = x1 - x0;
320
- const dy = y1 - y0;
321
-
322
- return dx * dy;
320
+ return aabb2_compute_area(x0, y0, x1, y1);
323
321
  }
324
322
 
325
323
  /**
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Merge bounds of two axis-aligned bounding boxes, the result is a box that tightly bounds inputs
3
+ * @param {ArrayLike<number>|number[]|Float32Array} result where resulting value is written to
4
+ * @param {number} result_offset
5
+ * @param {ArrayLike<number>|number[]|Float32Array} a
6
+ * @param {number} a_offset
7
+ * @param {ArrayLike<number>|number[]|Float32Array} b
8
+ * @param {number} b_offset
9
+ */
10
+ export function aabb2_array_combine(result: ArrayLike<number> | number[] | Float32Array, result_offset: number, a: ArrayLike<number> | number[] | Float32Array, a_offset: number, b: ArrayLike<number> | number[] | Float32Array, b_offset: number): void;
11
+ //# sourceMappingURL=aabb2_array_combine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aabb2_array_combine.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/aabb/aabb2_array_combine.js"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,4CAPW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,iBACvC,MAAM,KACN,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,YACvC,MAAM,KACN,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,YACvC,MAAM,QAwBhB"}
@@ -0,0 +1,35 @@
1
+ import { max2 } from "../../../math/max2.js";
2
+ import { min2 } from "../../../math/min2.js";
3
+
4
+ /**
5
+ * Merge bounds of two axis-aligned bounding boxes, the result is a box that tightly bounds inputs
6
+ * @param {ArrayLike<number>|number[]|Float32Array} result where resulting value is written to
7
+ * @param {number} result_offset
8
+ * @param {ArrayLike<number>|number[]|Float32Array} a
9
+ * @param {number} a_offset
10
+ * @param {ArrayLike<number>|number[]|Float32Array} b
11
+ * @param {number} b_offset
12
+ */
13
+ export function aabb2_array_combine(
14
+ result, result_offset,
15
+ a, a_offset,
16
+ b, b_offset
17
+ ) {
18
+
19
+ const a_x0 = a[a_offset];
20
+ const a_y0 = a[a_offset + 1];
21
+ const a_x1 = a[a_offset + 2];
22
+ const a_y1 = a[a_offset + 3];
23
+
24
+ const b_x0 = b[b_offset];
25
+ const b_y0 = b[b_offset + 1];
26
+ const b_x1 = b[b_offset + 2];
27
+ const b_y1 = b[b_offset + 3];
28
+
29
+ result[result_offset] = min2(a_x0, b_x0);
30
+ result[result_offset + 1] = min2(a_y0, b_y0);
31
+
32
+ result[result_offset + 2] = max2(a_x1, b_x1);
33
+ result[result_offset + 3] = max2(a_y1, b_y1);
34
+
35
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ *
3
+ * @param {ArrayLike<number>|Float32Array|number[]} result
4
+ * @param {number} result_offset
5
+ * @param {number} x0
6
+ * @param {number} y0
7
+ * @param {number} x1
8
+ * @param {number} y1
9
+ */
10
+ export function aabb2_array_set(result: ArrayLike<number> | Float32Array | number[], result_offset: number, x0: number, y0: number, x1: number, y1: number): void;
11
+ //# sourceMappingURL=aabb2_array_set.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aabb2_array_set.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/aabb/aabb2_array_set.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wCAPW,UAAU,MAAM,CAAC,GAAC,YAAY,GAAC,MAAM,EAAE,iBACvC,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAahB"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ *
3
+ * @param {ArrayLike<number>|Float32Array|number[]} result
4
+ * @param {number} result_offset
5
+ * @param {number} x0
6
+ * @param {number} y0
7
+ * @param {number} x1
8
+ * @param {number} y1
9
+ */
10
+ export function aabb2_array_set(
11
+ result, result_offset,
12
+ x0, y0,
13
+ x1, y1,
14
+ ) {
15
+
16
+ result[result_offset + 0] = x0;
17
+ result[result_offset + 1] = y0;
18
+
19
+ result[result_offset + 2] = x1;
20
+ result[result_offset + 3] = y1;
21
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ *
3
+ * @param {number} x0
4
+ * @param {number} y0
5
+ * @param {number} x1
6
+ * @param {number} y1
7
+ * @return {number}
8
+ */
9
+ export function aabb2_compute_area(x0: number, y0: number, x1: number, y1: number): number;
10
+ //# sourceMappingURL=aabb2_compute_area.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aabb2_compute_area.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/aabb/aabb2_compute_area.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,uCANW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACL,MAAM,CAOjB"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ *
3
+ * @param {number} x0
4
+ * @param {number} y0
5
+ * @param {number} x1
6
+ * @param {number} y1
7
+ * @return {number}
8
+ */
9
+ export function aabb2_compute_area(x0, y0, x1, y1) {
10
+ const dx = x1 - x0;
11
+ const dy = y1 - y0;
12
+
13
+ return dx * dy;
14
+ }