@woosh/meep-engine 2.90.0 → 2.91.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.
- package/build/bundle-worker-terrain.js +1 -1
- package/build/meep.cjs +20 -9
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +20 -9
- package/package.json +1 -1
- package/src/core/binary/de_interleave_2_bits.spec.d.ts.map +1 -0
- package/src/core/binary/de_interleave_bits_by_2.d.ts.map +1 -0
- package/src/core/binary/reinterpret_float32_as_int32.d.ts.map +1 -0
- package/src/core/binary/split_by_2.d.ts.map +1 -0
- package/src/core/binary/split_by_3.d.ts.map +1 -0
- package/src/core/bvh2/binary/2/BinaryUint32BVH.d.ts.map +1 -1
- package/src/core/bvh2/binary/2/BinaryUint32BVH.js +3 -4
- package/src/core/bvh2/bvh3/BVH.js +1 -1
- package/src/core/geom/2d/aabb/AABB2.d.ts.map +1 -1
- package/src/core/geom/2d/aabb/AABB2.js +2 -4
- package/src/core/geom/2d/aabb/aabb2_array_combine.d.ts +11 -0
- package/src/core/geom/2d/aabb/aabb2_array_combine.d.ts.map +1 -0
- package/src/core/geom/2d/aabb/aabb2_array_combine.js +35 -0
- package/src/core/geom/2d/aabb/aabb2_array_set.d.ts +11 -0
- package/src/core/geom/2d/aabb/aabb2_array_set.d.ts.map +1 -0
- package/src/core/geom/2d/aabb/aabb2_array_set.js +21 -0
- package/src/core/geom/2d/aabb/aabb2_compute_area.d.ts +10 -0
- package/src/core/geom/2d/aabb/aabb2_compute_area.d.ts.map +1 -0
- package/src/core/geom/2d/aabb/aabb2_compute_area.js +14 -0
- package/src/core/geom/2d/bvh/BVH2D.d.ts +296 -0
- package/src/core/geom/2d/bvh/BVH2D.d.ts.map +1 -0
- package/src/core/geom/2d/bvh/BVH2D.js +1143 -0
- package/src/core/geom/2d/bvh/BVH2D.spec.d.ts +2 -0
- package/src/core/geom/2d/bvh/BVH2D.spec.d.ts.map +1 -0
- package/src/core/geom/2d/bvh/BVH2D.spec.js +358 -0
- package/src/core/geom/2d/bvh/bvh2d_query_all_data_by_circle.d.ts +13 -0
- package/src/core/geom/2d/bvh/bvh2d_query_all_data_by_circle.d.ts.map +1 -0
- package/src/core/geom/2d/bvh/bvh2d_query_all_data_by_circle.js +83 -0
- package/src/core/geom/2d/lt-grid/LooseTightGrid.js +2 -2
- package/src/core/geom/2d/quad-tree/QuadTreeNode.spec.js +1 -1
- package/src/core/geom/2d/r-tree/StaticR2Tree.d.ts +79 -0
- package/src/core/geom/2d/r-tree/StaticR2Tree.d.ts.map +1 -0
- package/src/core/geom/2d/r-tree/StaticR2Tree.js +384 -0
- package/src/core/geom/2d/r-tree/StaticR2Tree.spec.d.ts +2 -0
- package/src/core/geom/2d/r-tree/StaticR2Tree.spec.d.ts.map +1 -0
- package/src/core/geom/2d/r-tree/StaticR2Tree.spec.js +62 -0
- package/src/core/geom/3d/morton/mortonEncode_magicbits.js +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/OrderedEdge.js +1 -1
- package/src/engine/graphics/texture/virtual/tile/compose_tile_address.js +1 -1
- package/src/engine/graphics/texture/virtual/tile/tile_address_to_finger_print.js +1 -1
- package/src/core/geom/3d/morton/de_interleave_2_bits.spec.d.ts.map +0 -1
- package/src/core/geom/3d/morton/de_interleave_bits_by_2.d.ts.map +0 -1
- package/src/core/geom/3d/morton/reinterpret_float32_as_int32.d.ts.map +0 -1
- package/src/core/geom/3d/morton/split_by_2.d.ts.map +0 -1
- package/src/core/geom/3d/morton/split_by_3.d.ts.map +0 -1
- /package/src/core/{geom/3d/morton → binary}/de_interleave_2_bits.spec.d.ts +0 -0
- /package/src/core/{geom/3d/morton → binary}/de_interleave_2_bits.spec.js +0 -0
- /package/src/core/{geom/3d/morton → binary}/de_interleave_bits_by_2.d.ts +0 -0
- /package/src/core/{geom/3d/morton → binary}/de_interleave_bits_by_2.js +0 -0
- /package/src/core/{geom/3d/morton → binary}/reinterpret_float32_as_int32.d.ts +0 -0
- /package/src/core/{geom/3d/morton → binary}/reinterpret_float32_as_int32.js +0 -0
- /package/src/core/{geom/3d/morton → binary}/split_by_2.d.ts +0 -0
- /package/src/core/{geom/3d/morton → binary}/split_by_2.js +0 -0
- /package/src/core/{geom/3d/morton → binary}/split_by_3.d.ts +0 -0
- /package/src/core/{geom/3d/morton → binary}/split_by_3.js +0 -0
package/build/meep.module.js
CHANGED
|
@@ -52052,7 +52052,7 @@ const COLUMN_USER_DATA = COLUMN_CHILD_2;
|
|
|
52052
52052
|
*
|
|
52053
52053
|
* @type {number}
|
|
52054
52054
|
*/
|
|
52055
|
-
const NULL_NODE =
|
|
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
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
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
|
/**
|
package/package.json
CHANGED
|
@@ -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,
|
|
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
|
|
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 =
|
|
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 =
|
|
517
|
+
const address_child_1 = address_child_0 + BVH_BINARY_NODE_SIZE;
|
|
519
518
|
|
|
520
519
|
aabb3_array_combine(
|
|
521
520
|
float32, address_parent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AABB2.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/aabb/AABB2.js"],"names":[],"mappings":";
|
|
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
|
-
|
|
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
|
+
}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
export const COLUMN_PARENT: 4;
|
|
2
|
+
export const COLUMN_CHILD_1: 5;
|
|
3
|
+
export const COLUMN_CHILD_2: 6;
|
|
4
|
+
export const COLUMN_HEIGHT: 7;
|
|
5
|
+
/**
|
|
6
|
+
* A non-leaf node have both CHILD_1 and CHILD_2 set, when CHILD_1 is not set - it's a leaf node
|
|
7
|
+
* So we can utilize space of CHILD_2 to store USER_DATA, hence there is overlap in schema
|
|
8
|
+
* @readonly
|
|
9
|
+
* @type {number}
|
|
10
|
+
*/
|
|
11
|
+
export const COLUMN_USER_DATA: number;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @type {number}
|
|
15
|
+
*/
|
|
16
|
+
export const NULL_NODE: number;
|
|
17
|
+
/**
|
|
18
|
+
* How many words are used for a single NODE in the tree
|
|
19
|
+
* One "word" is 4 bytes for the sake of alignment
|
|
20
|
+
* @readonly
|
|
21
|
+
* @type {number}
|
|
22
|
+
*/
|
|
23
|
+
export const ELEMENT_WORD_COUNT: number;
|
|
24
|
+
/**
|
|
25
|
+
* 2D Bounding Volume Hierarchy implementation.
|
|
26
|
+
* Based on BVH (3D) implementation
|
|
27
|
+
* @class
|
|
28
|
+
*/
|
|
29
|
+
export class BVH2D {
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @type {ArrayBuffer}
|
|
33
|
+
* @private
|
|
34
|
+
*/
|
|
35
|
+
private __data_buffer;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @type {Float32Array}
|
|
39
|
+
* @private
|
|
40
|
+
*/
|
|
41
|
+
private __data_float32;
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @type {Uint32Array}
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
47
|
+
private __data_uint32;
|
|
48
|
+
/**
|
|
49
|
+
* How many nodes are currently reserved, this will grow automatically through {@link #allocate_node} method usage
|
|
50
|
+
* @type {number}
|
|
51
|
+
* @private
|
|
52
|
+
*/
|
|
53
|
+
private __capacity;
|
|
54
|
+
/**
|
|
55
|
+
* Number of used nodes. These are either live nodes, or node sitting in the {@link #__free} pool
|
|
56
|
+
* @type {number}
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
private __size;
|
|
60
|
+
/**
|
|
61
|
+
* Indices of released nodes. Nodes are pulled from here first if available, before the whole tree gets resized
|
|
62
|
+
* @type {number[]}
|
|
63
|
+
* @private
|
|
64
|
+
*/
|
|
65
|
+
private __free;
|
|
66
|
+
/**
|
|
67
|
+
* Pointer into __free array that's used as a stack, so this pointer represents top of the stack
|
|
68
|
+
* @type {number}
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
71
|
+
private __free_pointer;
|
|
72
|
+
/**
|
|
73
|
+
* Root node of the hierarchy
|
|
74
|
+
* @type {number}
|
|
75
|
+
* @private
|
|
76
|
+
*/
|
|
77
|
+
private __root;
|
|
78
|
+
/**
|
|
79
|
+
*
|
|
80
|
+
* @returns {number}
|
|
81
|
+
*/
|
|
82
|
+
get root(): number;
|
|
83
|
+
/**
|
|
84
|
+
*
|
|
85
|
+
* @param {number} v
|
|
86
|
+
*/
|
|
87
|
+
set node_capacity(arg: number);
|
|
88
|
+
/**
|
|
89
|
+
*
|
|
90
|
+
* @returns {number}
|
|
91
|
+
*/
|
|
92
|
+
get node_capacity(): number;
|
|
93
|
+
__grow_capacity(): void;
|
|
94
|
+
/**
|
|
95
|
+
*
|
|
96
|
+
* @param {number} new_capacity in number of nodes
|
|
97
|
+
* @private
|
|
98
|
+
*/
|
|
99
|
+
private __set_capacity;
|
|
100
|
+
/**
|
|
101
|
+
* Trim allocated memory region to only contain allocated nodes
|
|
102
|
+
*/
|
|
103
|
+
trim(): void;
|
|
104
|
+
/**
|
|
105
|
+
*
|
|
106
|
+
* @returns {number}
|
|
107
|
+
*/
|
|
108
|
+
allocate_node(): number;
|
|
109
|
+
/**
|
|
110
|
+
* Release memory used by the node back into the pool
|
|
111
|
+
* NOTE: Make sure that the node is not "live" (not attached to the hierarchy), otherwise this operation may corrupt the tree
|
|
112
|
+
* @param {number} id
|
|
113
|
+
*/
|
|
114
|
+
release_node(id: number): void;
|
|
115
|
+
/**
|
|
116
|
+
*
|
|
117
|
+
* @param {number} id
|
|
118
|
+
* @returns {boolean}
|
|
119
|
+
*/
|
|
120
|
+
node_is_leaf(id: number): boolean;
|
|
121
|
+
/**
|
|
122
|
+
*
|
|
123
|
+
* @param {number} id
|
|
124
|
+
* @returns {number}
|
|
125
|
+
*/
|
|
126
|
+
node_get_user_data(id: number): number;
|
|
127
|
+
/**
|
|
128
|
+
*
|
|
129
|
+
* @param {number} id
|
|
130
|
+
* @param {number} value
|
|
131
|
+
*/
|
|
132
|
+
node_set_user_data(id: number, value: number): void;
|
|
133
|
+
/**
|
|
134
|
+
*
|
|
135
|
+
* @param {number} id
|
|
136
|
+
* @returns {number}
|
|
137
|
+
*/
|
|
138
|
+
node_get_child1(id: number): number;
|
|
139
|
+
/**
|
|
140
|
+
*
|
|
141
|
+
* @param {number} node
|
|
142
|
+
* @param {number} child1
|
|
143
|
+
*/
|
|
144
|
+
node_set_child1(node: number, child1: number): void;
|
|
145
|
+
/**
|
|
146
|
+
*
|
|
147
|
+
* @param {number} id
|
|
148
|
+
* @returns {number}
|
|
149
|
+
*/
|
|
150
|
+
node_get_child2(id: number): number;
|
|
151
|
+
/**
|
|
152
|
+
*
|
|
153
|
+
* @param {number} node
|
|
154
|
+
* @param {number} child2
|
|
155
|
+
*/
|
|
156
|
+
node_set_child2(node: number, child2: number): void;
|
|
157
|
+
/**
|
|
158
|
+
*
|
|
159
|
+
* @param {number} id
|
|
160
|
+
* @returns {number}
|
|
161
|
+
*/
|
|
162
|
+
node_get_parent(id: number): number;
|
|
163
|
+
/**
|
|
164
|
+
*
|
|
165
|
+
* @param {number} node
|
|
166
|
+
* @param {number} parent
|
|
167
|
+
*/
|
|
168
|
+
node_set_parent(node: number, parent: number): void;
|
|
169
|
+
/**
|
|
170
|
+
*
|
|
171
|
+
* @param {number} id
|
|
172
|
+
* @returns {number}
|
|
173
|
+
*/
|
|
174
|
+
node_get_height(id: number): number;
|
|
175
|
+
/**
|
|
176
|
+
*
|
|
177
|
+
* @param {number} id
|
|
178
|
+
* @param {number} height
|
|
179
|
+
*/
|
|
180
|
+
node_set_height(id: number, height: number): void;
|
|
181
|
+
/**
|
|
182
|
+
*
|
|
183
|
+
* @param {number} id
|
|
184
|
+
* @param {number[]|Float32Array} result
|
|
185
|
+
*/
|
|
186
|
+
node_get_aabb(id: number, result: number[] | Float32Array): void;
|
|
187
|
+
/**
|
|
188
|
+
*
|
|
189
|
+
* @param {number} id
|
|
190
|
+
* @param {number[]|ArrayLike<number>} aabb
|
|
191
|
+
*/
|
|
192
|
+
node_set_aabb(id: number, aabb: number[] | ArrayLike<number>): void;
|
|
193
|
+
/**
|
|
194
|
+
*
|
|
195
|
+
* @param {number} id
|
|
196
|
+
* @param {number[]} aabb
|
|
197
|
+
*/
|
|
198
|
+
node_move_aabb(id: number, aabb: number[]): void;
|
|
199
|
+
/**
|
|
200
|
+
*
|
|
201
|
+
* @param {number} id
|
|
202
|
+
* @param {number} x0
|
|
203
|
+
* @param {number} y0
|
|
204
|
+
* @param {number} z0
|
|
205
|
+
* @param {number} x1
|
|
206
|
+
* @param {number} y1
|
|
207
|
+
* @param {number} z1
|
|
208
|
+
*/
|
|
209
|
+
node_set_aabb_primitive(id: number, x0: number, y0: number, x1: number, y1: number): void;
|
|
210
|
+
/**
|
|
211
|
+
*
|
|
212
|
+
* @param {number} id
|
|
213
|
+
* @returns {number}
|
|
214
|
+
*/
|
|
215
|
+
node_get_surface_area(id: number): number;
|
|
216
|
+
/**
|
|
217
|
+
*
|
|
218
|
+
* @param {number} index_a
|
|
219
|
+
* @param {number} index_b
|
|
220
|
+
* @returns {number}
|
|
221
|
+
*/
|
|
222
|
+
node_get_combined_surface_area(index_a: number, index_b: number): number;
|
|
223
|
+
/**
|
|
224
|
+
*
|
|
225
|
+
* @param {number} destination
|
|
226
|
+
* @param {number} index_a
|
|
227
|
+
* @param {number} index_b
|
|
228
|
+
*/
|
|
229
|
+
node_set_combined_aabb(destination: number, index_a: number, index_b: number): void;
|
|
230
|
+
/**
|
|
231
|
+
*
|
|
232
|
+
* @param {number} leaf
|
|
233
|
+
* @returns {void}
|
|
234
|
+
*/
|
|
235
|
+
insert_leaf(leaf: number): void;
|
|
236
|
+
/**
|
|
237
|
+
* refit and update nodes up the tree. Only updates bounds
|
|
238
|
+
* NOTE: Does not update "height"
|
|
239
|
+
* @param {number} parent
|
|
240
|
+
* @private
|
|
241
|
+
*/
|
|
242
|
+
private bubble_up_refit;
|
|
243
|
+
/**
|
|
244
|
+
* refit and update nodes up the tree
|
|
245
|
+
* @param {number} parent
|
|
246
|
+
* @private
|
|
247
|
+
*/
|
|
248
|
+
private bubble_up_update;
|
|
249
|
+
/**
|
|
250
|
+
* NOTE: Leaf node is not released, make sure to call {@link #release_node} separately when you no longer need the leaf node
|
|
251
|
+
* @param {number} leaf
|
|
252
|
+
* @returns {void}
|
|
253
|
+
*/
|
|
254
|
+
remove_leaf(leaf: number): void;
|
|
255
|
+
/**
|
|
256
|
+
* Perform a left or right rotation if node A is imbalanced.
|
|
257
|
+
* Returns the new root index.
|
|
258
|
+
* @param {number} iA
|
|
259
|
+
* @returns {number}
|
|
260
|
+
* @private
|
|
261
|
+
*/
|
|
262
|
+
private balance;
|
|
263
|
+
/**
|
|
264
|
+
* Release all nodes, this essentially resets the tree to empty state
|
|
265
|
+
* NOTE: For performance reasons, released memory is not reset, this means that attempting to access cleared nodes' memory will yield garbage data
|
|
266
|
+
*/
|
|
267
|
+
release_all(): void;
|
|
268
|
+
/**
|
|
269
|
+
*
|
|
270
|
+
* @param {function(node:number, tree:BVH):void} callback
|
|
271
|
+
* @param {*} [ctx]
|
|
272
|
+
*/
|
|
273
|
+
traverse(callback: any, ctx?: any): void;
|
|
274
|
+
/**
|
|
275
|
+
*
|
|
276
|
+
* @param {number[]} destination
|
|
277
|
+
* @param {number} destination_offset
|
|
278
|
+
* @returns {number}
|
|
279
|
+
*/
|
|
280
|
+
collect_nodes_all(destination: number[], destination_offset: number): number;
|
|
281
|
+
/**
|
|
282
|
+
* Update parent and child links of a given node to point to a new location, useful for re-locating nodes
|
|
283
|
+
* @param {number} node node to update
|
|
284
|
+
* @param {number} destination Where updated links should point to
|
|
285
|
+
* @private
|
|
286
|
+
*/
|
|
287
|
+
private __move_node_links;
|
|
288
|
+
/**
|
|
289
|
+
* Swap two nodes in memory
|
|
290
|
+
* @param {number} a
|
|
291
|
+
* @param {number} b
|
|
292
|
+
* @returns {boolean}
|
|
293
|
+
*/
|
|
294
|
+
swap_nodes(a: number, b: number): boolean;
|
|
295
|
+
}
|
|
296
|
+
//# sourceMappingURL=BVH2D.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BVH2D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/bvh/BVH2D.js"],"names":[],"mappings":"AASA,8BAA+B;AAC/B,+BAAgC;AAChC,+BAAgC;AAChC,8BAA+B;AAE/B;;;;;GAKG;AACH,+BAFU,MAAM,CAE+B;AAE/C;;;GAGG;AACH,wBAFU,MAAM,CAEoB;AAcpC;;;;;GAKG;AACH,iCAFU,MAAM,CAEoB;AAgBpC;;;;GAIG;AACH;IAEI;;;;OAIG;IACH,sBAA2E;IAE3E;;;;OAIG;IACH,uBAAsD;IAEtD;;;;OAIG;IACH,sBAAoD;IAEpD;;;;OAIG;IACH,mBAA8B;IAE9B;;;;OAIG;IACH,eAAW;IAEX;;;;OAIG;IACH,eAAY;IAEZ;;;;OAIG;IACH,uBAAmB;IAEnB;;;;OAIG;IACH,eAAmB;IAEnB;;;OAGG;IACH,mBAEC;IAUD;;;OAGG;IACH,+BAMC;IAlBD;;;OAGG;IACH,4BAEC;IAcD,wBAgBC;IAED;;;;OAIG;IACH,uBAqBC;IAED;;OAEG;IACH,aAIC;IAED;;;OAGG;IACH,iBAFa,MAAM,CAmDlB;IAED;;;;OAIG;IACH,iBAFW,MAAM,QAMhB;IAED;;;;OAIG;IACH,iBAHW,MAAM,GACJ,OAAO,CAOnB;IAED;;;;OAIG;IACH,uBAHW,MAAM,GACJ,MAAM,CAKlB;IAED;;;;OAIG;IACH,uBAHW,MAAM,SACN,MAAM,QAOhB;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CAKlB;IAED;;;;OAIG;IACH,sBAHW,MAAM,UACN,MAAM,QAIhB;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CAKlB;IAED;;;;OAIG;IACH,sBAHW,MAAM,UACN,MAAM,QAIhB;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CAKlB;IAED;;;;OAIG;IACH,sBAHW,MAAM,UACN,MAAM,QAIhB;IAGD;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CAKlB;IAED;;;;OAIG;IACH,oBAHW,MAAM,UACN,MAAM,QAKhB;IAED;;;;OAIG;IACH,kBAHW,MAAM,UACN,MAAM,EAAE,GAAC,YAAY,QAa/B;IAED;;;;OAIG;IACH,kBAHW,MAAM,QACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,QAkBpC;IAED;;;;OAIG;IACH,mBAHW,MAAM,QACN,MAAM,EAAE,QAWlB;IAED;;;;;;;;;OASG;IACH,4BARW,MAAM,MACN,MAAM,MACN,MAAM,MAEN,MAAM,MACN,MAAM,QAkBhB;IAED;;;;OAIG;IACH,0BAHW,MAAM,GACJ,MAAM,CAkBlB;IAED;;;;;OAKG;IACH,wCAJW,MAAM,WACN,MAAM,GACJ,MAAM,CA6BlB;IAED;;;;;OAKG;IACH,oCAJW,MAAM,WACN,MAAM,WACN,MAAM,QA+BhB;IAED;;;;OAIG;IACH,kBAHW,MAAM,GACJ,IAAI,CA0GhB;IAED;;;;;OAKG;IACH,wBAuBC;IAED;;;;OAIG;IACH,yBA4BC;IAED;;;;OAIG;IACH,kBAHW,MAAM,GACJ,IAAI,CA6ChB;IAED;;;;;;OAMG;IACH,gBAoMC;IAED;;;OAGG;IACH,oBAIC;IAED;;;;OAIG;IACH,yCA8BC;IAED;;;;;OAKG;IACH,+BAJW,MAAM,EAAE,sBACR,MAAM,GACJ,MAAM,CAWlB;IAED;;;;;OAKG;IACH,0BA6BC;IAED;;;;;OAKG;IACH,cAJW,MAAM,KACN,MAAM,GACJ,OAAO,CAsCnB;CACJ"}
|