@woosh/meep-engine 2.120.5 → 2.121.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 (112) hide show
  1. package/README.md +1 -1
  2. package/editor/view/node-graph/NodeGraphEditorView.d.ts.map +1 -1
  3. package/editor/view/node-graph/NodeGraphView.d.ts.map +1 -1
  4. package/editor/view/node-graph/NodeView.d.ts.map +1 -1
  5. package/editor/view/node-graph/PortView.d.ts.map +1 -1
  6. package/package.json +1 -1
  7. package/src/core/codegen/LineBuilder.d.ts +2 -2
  8. package/src/core/codegen/LineBuilder.d.ts.map +1 -1
  9. package/src/core/codegen/LineBuilder.js +14 -9
  10. package/src/core/collection/array/array_set_diff_sorting.d.ts +1 -1
  11. package/src/core/collection/array/array_set_diff_sorting.js +1 -1
  12. package/src/core/collection/map/HashMap.d.ts.map +1 -1
  13. package/src/core/collection/map/HashMap.js +29 -2
  14. package/src/core/color/oklab/find_cusp.d.ts.map +1 -1
  15. package/src/core/color/oklab/find_cusp.js +4 -1
  16. package/src/core/color/oklab/oklab_to_linear_srgb.d.ts.map +1 -1
  17. package/src/core/color/oklab/oklab_to_linear_srgb.js +1 -0
  18. package/src/core/color/operations/color_lighten.d.ts +1 -1
  19. package/src/core/color/operations/color_lighten.d.ts.map +1 -1
  20. package/src/core/color/operations/color_lighten.js +6 -1
  21. package/src/core/geom/2d/aabb/aabb2_intersects_point.d.ts +12 -0
  22. package/src/core/geom/2d/aabb/aabb2_intersects_point.d.ts.map +1 -0
  23. package/src/core/geom/2d/aabb/aabb2_intersects_point.js +17 -0
  24. package/src/core/geom/2d/quad-tree/QuadTreeNode.d.ts +17 -6
  25. package/src/core/geom/2d/quad-tree/QuadTreeNode.d.ts.map +1 -1
  26. package/src/core/geom/2d/quad-tree/QuadTreeNode.js +59 -98
  27. package/src/core/geom/2d/quad-tree/qt_collect_by_box.d.ts +14 -0
  28. package/src/core/geom/2d/quad-tree/qt_collect_by_box.d.ts.map +1 -0
  29. package/src/core/geom/2d/quad-tree/qt_collect_by_box.js +90 -0
  30. package/src/core/geom/2d/quad-tree/qt_collect_by_point.d.ts +11 -0
  31. package/src/core/geom/2d/quad-tree/qt_collect_by_point.d.ts.map +1 -0
  32. package/src/core/geom/2d/quad-tree/qt_collect_by_point.js +85 -0
  33. package/src/core/geom/3d/ray/ray3_distance_to_point.d.ts +14 -1
  34. package/src/core/geom/3d/ray/ray3_distance_to_point.d.ts.map +1 -1
  35. package/src/core/geom/3d/ray/ray3_distance_to_point.js +18 -1
  36. package/src/core/geom/3d/shape/UnionShape3D.d.ts.map +1 -1
  37. package/src/core/geom/3d/shape/UnionShape3D.js +4 -0
  38. package/src/core/geom/3d/shape/UnitCubeShape3D.d.ts.map +1 -1
  39. package/src/core/geom/3d/shape/UnitCubeShape3D.js +4 -0
  40. package/src/core/geom/ConicRay.d.ts +5 -1
  41. package/src/core/geom/ConicRay.d.ts.map +1 -1
  42. package/src/core/geom/ConicRay.js +5 -1
  43. package/src/core/geom/Vector1.d.ts.map +1 -1
  44. package/src/core/geom/Vector1.js +15 -2
  45. package/src/core/geom/Vector3.d.ts.map +1 -1
  46. package/src/core/geom/Vector3.js +10 -2
  47. package/src/core/geom/packing/max-rect/MaxRectanglesPacker.d.ts.map +1 -1
  48. package/src/core/geom/packing/max-rect/MaxRectanglesPacker.js +3 -0
  49. package/src/core/geom/packing/max-rect/cutArea.d.ts.map +1 -1
  50. package/src/core/geom/packing/max-rect/cutArea.js +8 -1
  51. package/src/core/geom/packing/max-rect/findBestContainer.d.ts +4 -4
  52. package/src/core/geom/packing/max-rect/findBestContainer.d.ts.map +1 -1
  53. package/src/core/geom/packing/max-rect/findBestContainer.js +30 -8
  54. package/src/core/geom/packing/max-rect/packOneBox.d.ts.map +1 -1
  55. package/src/core/geom/packing/max-rect/packOneBox.js +7 -2
  56. package/src/core/geom/packing/max-rect/removeRedundantBoxesArray.d.ts.map +1 -1
  57. package/src/core/geom/packing/max-rect/removeRedundantBoxesArray.js +13 -7
  58. package/src/core/geom/packing/miniball/Miniball.d.ts.map +1 -1
  59. package/src/core/geom/packing/miniball/Miniball.js +27 -1
  60. package/src/core/geom/packing/miniball/PointSet.d.ts.map +1 -1
  61. package/src/core/geom/packing/miniball/PointSet.js +25 -4
  62. package/src/core/geom/packing/miniball/Quality.js +1 -3
  63. package/src/core/process/action/AsynchronousDelayAction.js +1 -1
  64. package/src/engine/EntityCreator.js +1 -1
  65. package/src/engine/achievements/AchievementManager.js +1 -1
  66. package/src/engine/animation/AnimationUtils.js +1 -1
  67. package/src/engine/animation/async/prototypeAsyncAnimation.js +2 -2
  68. package/src/engine/animation/behavior/animateProperty.js +1 -1
  69. package/src/engine/animation/playTrackRealTime.js +1 -1
  70. package/src/engine/ecs/Entity.d.ts.map +1 -1
  71. package/src/engine/ecs/Entity.js +12 -7
  72. package/src/engine/ecs/EntityComponentDataset.d.ts.map +1 -1
  73. package/src/engine/ecs/EntityComponentDataset.js +14 -7
  74. package/src/engine/ecs/EntityReference.d.ts +4 -4
  75. package/src/engine/ecs/EntityReference.js +4 -4
  76. package/src/engine/ecs/dynamic_actions/DynamicActorSystem.js +1 -1
  77. package/src/engine/ecs/speaker/VoiceSystem.d.ts +8 -2
  78. package/src/engine/ecs/speaker/VoiceSystem.d.ts.map +1 -1
  79. package/src/engine/ecs/speaker/VoiceSystem.js +1 -1
  80. package/src/engine/ecs/util/hideEntityGracefully.js +3 -3
  81. package/src/engine/graphics/ecs/camera/filter/setup_filtered_camera_controller.d.ts.map +1 -1
  82. package/src/engine/graphics/ecs/camera/filter/setup_filtered_camera_controller.js +6 -6
  83. package/src/engine/graphics/ecs/decal/v2/prototypeDecalSystem.js +1 -1
  84. package/src/engine/graphics/ecs/mesh-v2/aggregate/prototypeSGMesh.js +1 -1
  85. package/src/engine/graphics/ecs/mesh-v2/sample/prototypeShadedGeometry.js +2 -2
  86. package/src/engine/graphics/ecs/mesh-v2/sample/prototype_sg_raycast.js +1 -1
  87. package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +1 -1
  88. package/src/engine/graphics/ecs/trail2d/prototypeTrail2D.js +1 -1
  89. package/src/engine/graphics/impostors/octahedral/prototypeBaker.js +1 -1
  90. package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +2 -2
  91. package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +4 -4
  92. package/src/engine/graphics/sh3/path_tracer/make_one_vector3.d.ts.map +1 -1
  93. package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.d.ts.map +1 -1
  94. package/src/engine/graphics/sh3/path_tracer/make_sky_rtiw.d.ts.map +1 -1
  95. package/src/engine/graphics/sh3/path_tracer/make_zero_vector3.d.ts.map +1 -1
  96. package/src/engine/input/devices/PointerDevice.js +1 -1
  97. package/src/engine/intelligence/behavior/ecs/BehaviorComponent.d.ts +79 -3
  98. package/src/engine/intelligence/behavior/ecs/BehaviorComponent.d.ts.map +1 -1
  99. package/src/engine/intelligence/behavior/ecs/BehaviorComponent.js +24 -8
  100. package/src/engine/intelligence/behavior/ecs/BehaviorComponentSerializationAdapter.d.ts.map +1 -1
  101. package/src/engine/intelligence/behavior/ecs/BehaviorComponentSerializationAdapter.js +2 -2
  102. package/src/engine/intelligence/behavior/ecs/BehaviorSystem.d.ts +33 -7
  103. package/src/engine/intelligence/behavior/primitive/ActionBehavior.d.ts +3 -2
  104. package/src/engine/intelligence/behavior/primitive/ActionBehavior.d.ts.map +1 -1
  105. package/src/engine/intelligence/behavior/primitive/ActionBehavior.js +7 -5
  106. package/src/engine/intelligence/behavior/primitive/SucceedingBehavior.d.ts +10 -9
  107. package/src/engine/intelligence/behavior/primitive/SucceedingBehavior.d.ts.map +1 -1
  108. package/src/engine/intelligence/behavior/primitive/SucceedingBehavior.js +19 -20
  109. package/src/engine/physics/fluid/prototype.js +1 -1
  110. package/src/engine/physics/inverse_kinematics/fabrik/prototype.js +1 -1
  111. package/src/view/View.d.ts.map +1 -1
  112. package/src/view/View.js +14 -1
@@ -2,6 +2,8 @@ import { assert } from "../../../assert.js";
2
2
  import { max2 } from "../../../math/max2.js";
3
3
  import { min2 } from "../../../math/min2.js";
4
4
  import AABB2 from "../../2d/aabb/AABB2.js";
5
+ import { qt_collect_by_box } from "./qt_collect_by_box.js";
6
+ import { qt_collect_by_point } from "./qt_collect_by_point.js";
5
7
  import { QuadTreeDatum } from "./QuadTreeDatum.js";
6
8
 
7
9
 
@@ -13,45 +15,45 @@ const THRESHOLD_MERGE = 8;
13
15
  * @extends AABB2
14
16
  */
15
17
  export class QuadTreeNode extends AABB2 {
16
- constructor(x0 = 0, y0 = 0, x1 = 0, y1 = 0) {
17
- super(x0, y0, x1, y1);
18
-
19
- /**
20
- *
21
- * @type {QuadTreeNode|null}
22
- */
23
- this.topLeft = null;
24
- /**
25
- *
26
- * @type {QuadTreeNode|null}
27
- */
28
- this.topRight = null;
29
- /**
30
- *
31
- * @type {QuadTreeNode|null}
32
- */
33
- this.bottomLeft = null;
34
- /**
35
- *
36
- * @type {QuadTreeNode|null}
37
- */
38
- this.bottomRight = null;
18
+ /**
19
+ *
20
+ * @type {QuadTreeNode|null}
21
+ */
22
+ topLeft = null;
23
+ /**
24
+ *
25
+ * @type {QuadTreeNode|null}
26
+ */
27
+ topRight = null;
28
+ /**
29
+ *
30
+ * @type {QuadTreeNode|null}
31
+ */
32
+ bottomLeft = null;
33
+ /**
34
+ *
35
+ * @type {QuadTreeNode|null}
36
+ */
37
+ bottomRight = null;
39
38
 
40
- /**
41
- *
42
- * @type {QuadTreeNode|null}
43
- */
44
- this.parentNode = null;
39
+ /**
40
+ *
41
+ * @type {QuadTreeNode|null}
42
+ */
43
+ parentNode = null;
45
44
 
46
- this.treeDataCount = 0;
45
+ /**
46
+ *
47
+ * @type {number}
48
+ */
49
+ treeDataCount = 0;
47
50
 
48
51
 
49
- /**
50
- *
51
- * @type {QuadTreeDatum<D>[]}
52
- */
53
- this.data = [];
54
- }
52
+ /**
53
+ *
54
+ * @type {QuadTreeDatum<D>[]}
55
+ */
56
+ data = [];
55
57
 
56
58
  balance() {
57
59
  const dataLength = this.data.length;
@@ -174,8 +176,8 @@ export class QuadTreeNode extends AABB2 {
174
176
  }
175
177
  }
176
178
 
177
- const xm = (x0 + x1) *0.5;
178
- const ym = (y0 + y1) *0.5;
179
+ const xm = (x0 + x1) * 0.5;
180
+ const ym = (y0 + y1) * 0.5;
179
181
 
180
182
  if (datum.y1 < ym) {
181
183
  //top
@@ -417,7 +419,7 @@ export class QuadTreeNode extends AABB2 {
417
419
 
418
420
  /**
419
421
  *
420
- * @param {function(QuadTreeNode):boolean} visitor
422
+ * @param {function(QuadTreeNode<D>):boolean} visitor
421
423
  * @param {*} [thisArg]
422
424
  */
423
425
  traversePreOrder(visitor, thisArg) {
@@ -437,75 +439,34 @@ export class QuadTreeNode extends AABB2 {
437
439
  }
438
440
 
439
441
  /**
440
- *
442
+ * @deprecated use {@link qt_collect_by_point}
441
443
  * @param {number} x
442
444
  * @param {number} y
443
445
  * @param {function(QuadTreeDatum<D>, x:number,y:number):boolean?} visitor
444
446
  * @param {*} [thisArg]
445
447
  */
446
- traversePointIntersections(x, y, visitor, thisArg) {
447
- const data = this.data;
448
- const dataCount = data.length;
449
-
450
- for (let i = 0; i < dataCount; i++) {
451
- const datum = data[i];
452
-
453
- if (datum.x0 <= x && datum.x1 >= x && datum.y0 <= y && datum.y1 >= y) {
454
- const continueTraversal = visitor.call(thisArg, datum, x, y);
455
-
456
- if (continueTraversal === false) {
457
- return;
458
- }
459
- }
460
- }
461
-
462
- if (this.isSplit()) {
463
-
464
- const hx = (this.x0 + this.x1) / 2;
465
- const hy = (this.y0 + this.y1) / 2;
466
-
467
- if (hx >= x) {
468
- if (hy >= y) {
469
- this.topLeft.traversePointIntersections(x, y, visitor, thisArg);
470
- }
471
- if (hy <= y) {
472
- this.bottomLeft.traversePointIntersections(x, y, visitor, thisArg);
473
- }
474
- }
475
-
476
- if (hx <= x) {
477
- if (hy >= y) {
478
- this.topRight.traversePointIntersections(x, y, visitor, thisArg);
479
- }
480
- if (hy <= y) {
481
- this.bottomRight.traversePointIntersections(x, y, visitor, thisArg);
482
- }
483
- }
484
-
485
- }
448
+ traversePointIntersections(
449
+ x,
450
+ y,
451
+ visitor,
452
+ thisArg
453
+ ) {
454
+ throw new Error('Deprecated, use `qt_collect_by_point` instead')
486
455
  }
487
456
 
488
457
  /**
489
- *
458
+ * @deprecated use {@link qt_collect_by_point} directly
490
459
  * @param {Array<QuadTreeDatum<D>>} result
491
460
  * @param {number} x
492
461
  * @param {number} y
493
462
  * @returns {number} number of intersecting objects added to the result
494
463
  */
495
464
  requestDatumIntersectionsPoint(result, x, y) {
496
- //TODO optimize closures out to avoid GC
497
-
498
- let count = 0;
499
-
500
- this.traversePointIntersections(x, y, (d) => {
501
- result[count++] = d;
502
- });
503
-
504
- return count;
465
+ return qt_collect_by_point(result, 0, this, x, y);
505
466
  }
506
467
 
507
468
  /**
508
- *
469
+ * @deprecated use {@link qt_collect_by_box} instead
509
470
  * @param {Array<QuadTreeDatum<D>>} result
510
471
  * @param {number} x0
511
472
  * @param {number} y0
@@ -514,18 +475,12 @@ export class QuadTreeNode extends AABB2 {
514
475
  * @returns {number} number of intersecting objects added to the result
515
476
  */
516
477
  requestDatumIntersectionsRectangle(result, x0, y0, x1, y1) {
517
- let count = 0;
518
-
519
- //TODO optimize closures out, to avoid GC
520
- this.traverseRectangleIntersections(x0, y0, x1, y1, (d) => {
521
- result[count++] = d;
522
- });
523
-
524
- return count;
478
+ return qt_collect_by_box(result, 0, this, x0, y0, x1, y1);
525
479
  }
526
480
 
527
481
  /**
528
482
  * NOTE: touching is not counted as intersection
483
+ * @deprecated use {@link qt_collect_by_box} instead
529
484
  * @param {number} x0
530
485
  * @param {number} y0
531
486
  * @param {number} x1
@@ -576,3 +531,9 @@ export class QuadTreeNode extends AABB2 {
576
531
  }
577
532
 
578
533
  }
534
+
535
+ /**
536
+ * @readonly
537
+ * @type {boolean}
538
+ */
539
+ QuadTreeNode.prototype.isQuadTreeNode = true;
@@ -0,0 +1,14 @@
1
+ /**
2
+ *
3
+ * @template T
4
+ * @param {Array<QuadTreeDatum<T>>} result
5
+ * @param {number} result_offset
6
+ * @param {QuadTreeNode<T>} tree
7
+ * @param {number} x0
8
+ * @param {number} y0
9
+ * @param {number} x1
10
+ * @param {number} y1
11
+ * @returns {number}
12
+ */
13
+ export function qt_collect_by_box<T>(result: Array<QuadTreeDatum<T>>, result_offset: number, tree: QuadTreeNode<T>, x0: number, y0: number, x1: number, y1: number): number;
14
+ //# sourceMappingURL=qt_collect_by_box.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qt_collect_by_box.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/quad-tree/qt_collect_by_box.js"],"names":[],"mappings":"AASA;;;;;;;;;;;GAWG;AACH,kCAVa,CAAC,UACH,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,iBACvB,MAAM,QACN,YAAY,CAAC,CAAC,CAAC,MACf,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAsElB"}
@@ -0,0 +1,90 @@
1
+ import { assert } from "../../../assert.js";
2
+ import { aabb2_overlap_exists } from "../aabb/aabb2_overlap_exists.js";
3
+
4
+ /**
5
+ *
6
+ * @type {QuadTreeNode[]}
7
+ */
8
+ const node_stack = [];
9
+
10
+ /**
11
+ *
12
+ * @template T
13
+ * @param {Array<QuadTreeDatum<T>>} result
14
+ * @param {number} result_offset
15
+ * @param {QuadTreeNode<T>} tree
16
+ * @param {number} x0
17
+ * @param {number} y0
18
+ * @param {number} x1
19
+ * @param {number} y1
20
+ * @returns {number}
21
+ */
22
+ export function qt_collect_by_box(
23
+ result, result_offset,
24
+ tree,
25
+ x0, y0,x1, y1
26
+ ){
27
+ assert.isArray(result, 'result');
28
+ assert.isNonNegativeInteger(result_offset, 'result_offset');
29
+ assert.defined(tree, 'tree');
30
+ assert.notNull(tree, 'tree');
31
+ assert.equal(tree.isQuadTreeNode, true, 'tree.isQuadTreeNode !== true');
32
+ assert.isNumber(x0, 'x0');
33
+ assert.isNumber(y0, 'y0');
34
+ assert.isNumber(x1, 'x1');
35
+ assert.isNumber(y1, 'y1');
36
+
37
+ let result_cursor = result_offset;
38
+
39
+ let stack_pointer = 1;
40
+
41
+ node_stack[0] = tree;
42
+
43
+ while (stack_pointer-- > 0) {
44
+
45
+ const node = node_stack[stack_pointer];
46
+
47
+ if (!aabb2_overlap_exists(node.x0, node.y0, node.x1, node.y1, x0, y0, x1,y1)) {
48
+ // not a match
49
+ continue;
50
+ }
51
+
52
+ const data = node.data;
53
+ const data_count = data.length;
54
+
55
+ for (let i = 0; i < data_count; i++) {
56
+ const datum = data[i];
57
+
58
+ if (aabb2_overlap_exists(datum.x0, datum.y0, datum.x1, datum.y1, x0, y0, x1,y1)) {
59
+ result[result_cursor++] = datum;
60
+ }
61
+ }
62
+
63
+ if (node.isSplit()) {
64
+ const hx = (node.x0 + node.x1) * 0.5;
65
+ const hy = (node.y0 + node.y1) * 0.5;
66
+
67
+ if (hx >= x0) {
68
+ if (hy >= y0) {
69
+ node_stack[stack_pointer++] = node.topLeft;
70
+ }
71
+ if (hy <= y1) {
72
+ node_stack[stack_pointer++] = node.bottomLeft;
73
+ }
74
+ }
75
+
76
+ if (hx <= x1) {
77
+ if (hy >= y0) {
78
+ node_stack[stack_pointer++] = node.topRight;
79
+ }
80
+ if (hy <= y1) {
81
+ node_stack[stack_pointer++] = node.bottomRight;
82
+ }
83
+ }
84
+
85
+
86
+ }
87
+ }
88
+
89
+ return result_cursor - result_offset;
90
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @template T
3
+ * @param {Array<QuadTreeDatum<T>>} result
4
+ * @param {number} result_offset
5
+ * @param {QuadTreeNode<T>} tree
6
+ * @param {number} x
7
+ * @param {number} y
8
+ * @returns {number}
9
+ */
10
+ export function qt_collect_by_point<T>(result: Array<QuadTreeDatum<T>>, result_offset: number, tree: QuadTreeNode<T>, x: number, y: number): number;
11
+ //# sourceMappingURL=qt_collect_by_point.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qt_collect_by_point.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/quad-tree/qt_collect_by_point.js"],"names":[],"mappings":"AASA;;;;;;;;GAQG;AACH,oCARa,CAAC,UACH,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,iBACvB,MAAM,QACN,YAAY,CAAC,CAAC,CAAC,KACf,MAAM,KACN,MAAM,GACJ,MAAM,CAoElB"}
@@ -0,0 +1,85 @@
1
+ import { assert } from "../../../assert.js";
2
+ import { aabb2_intersects_point } from "../aabb/aabb2_intersects_point.js";
3
+
4
+ /**
5
+ *
6
+ * @type {QuadTreeNode[]}
7
+ */
8
+ const node_stack = [];
9
+
10
+ /**
11
+ * @template T
12
+ * @param {Array<QuadTreeDatum<T>>} result
13
+ * @param {number} result_offset
14
+ * @param {QuadTreeNode<T>} tree
15
+ * @param {number} x
16
+ * @param {number} y
17
+ * @returns {number}
18
+ */
19
+ export function qt_collect_by_point(
20
+ result, result_offset,
21
+ tree,
22
+ x, y
23
+ ) {
24
+ assert.isArray(result, 'result');
25
+ assert.isNonNegativeInteger(result_offset, 'result_offset');
26
+ assert.defined(tree, 'tree');
27
+ assert.notNull(tree, 'tree');
28
+ assert.equal(tree.isQuadTreeNode, true, 'tree.isQuadTreeNode !== true');
29
+ assert.isNumber(x, 'x');
30
+ assert.isNumber(y, 'y');
31
+
32
+ let result_cursor = result_offset;
33
+
34
+ let stack_pointer = 1;
35
+
36
+ node_stack[0] = tree;
37
+
38
+ while (stack_pointer-- > 0) {
39
+
40
+ const node = node_stack[stack_pointer];
41
+
42
+ if (!aabb2_intersects_point(node.x0, node.y0, node.x1, node.y1, x, y)) {
43
+ // not a match
44
+ continue;
45
+ }
46
+
47
+ const data = node.data;
48
+ const data_count = data.length;
49
+
50
+ for (let i = 0; i < data_count; i++) {
51
+ const datum = data[i];
52
+
53
+ if (aabb2_intersects_point(datum.x0, datum.y0, datum.x1, datum.y1, x, y)) {
54
+ result[result_cursor++] = datum;
55
+ }
56
+ }
57
+
58
+ if (node.isSplit()) {
59
+ const hx = (node.x0 + node.x1) * 0.5;
60
+ const hy = (node.y0 + node.y1) * 0.5;
61
+
62
+ if (hx >= x) {
63
+ if (hy >= y) {
64
+ node_stack[stack_pointer++] = node.topLeft;
65
+ }
66
+ if (hy <= y) {
67
+ node_stack[stack_pointer++] = node.bottomLeft;
68
+ }
69
+ }
70
+
71
+ if (hx <= x) {
72
+ if (hy >= y) {
73
+ node_stack[stack_pointer++] = node.topRight;
74
+ }
75
+ if (hy <= y) {
76
+ node_stack[stack_pointer++] = node.bottomRight;
77
+ }
78
+ }
79
+
80
+
81
+ }
82
+ }
83
+
84
+ return result_cursor - result_offset;
85
+ }
@@ -1,2 +1,15 @@
1
- export function ray3_distance_to_point(origin_x: any, origin_y: any, origin_z: any, direction_x: any, direction_y: any, direction_z: any, ref_x: any, ref_y: any, ref_z: any): number;
1
+ /**
2
+ *
3
+ * @param {number} origin_x
4
+ * @param {number} origin_y
5
+ * @param {number} origin_z
6
+ * @param {number} direction_x
7
+ * @param {number} direction_y
8
+ * @param {number} direction_z
9
+ * @param {number} ref_x
10
+ * @param {number} ref_y
11
+ * @param {number} ref_z
12
+ * @return {number}
13
+ */
14
+ export function ray3_distance_to_point(origin_x: number, origin_y: number, origin_z: number, direction_x: number, direction_y: number, direction_z: number, ref_x: number, ref_y: number, ref_z: number): number;
2
15
  //# sourceMappingURL=ray3_distance_to_point.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ray3_distance_to_point.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/ray/ray3_distance_to_point.js"],"names":[],"mappings":"AAEA,sLAWC"}
1
+ {"version":3,"file":"ray3_distance_to_point.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/ray/ray3_distance_to_point.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,iDAXW,MAAM,YACN,MAAM,YACN,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,SACN,MAAM,SACN,MAAM,SACN,MAAM,GACL,MAAM,CAiBjB"}
@@ -1,6 +1,23 @@
1
1
  import { v3_dot } from "../../vec3/v3_dot.js";
2
2
 
3
- export function ray3_distance_to_point(origin_x, origin_y, origin_z, direction_x, direction_y, direction_z, ref_x, ref_y, ref_z){
3
+ /**
4
+ *
5
+ * @param {number} origin_x
6
+ * @param {number} origin_y
7
+ * @param {number} origin_z
8
+ * @param {number} direction_x
9
+ * @param {number} direction_y
10
+ * @param {number} direction_z
11
+ * @param {number} ref_x
12
+ * @param {number} ref_y
13
+ * @param {number} ref_z
14
+ * @return {number}
15
+ */
16
+ export function ray3_distance_to_point(
17
+ origin_x, origin_y, origin_z,
18
+ direction_x, direction_y, direction_z,
19
+ ref_x, ref_y, ref_z
20
+ ) {
4
21
  // find the closest point
5
22
  const sp0_x = ref_x - origin_x;
6
23
  const sp0_y = ref_y - origin_y;
@@ -1 +1 @@
1
- {"version":3,"file":"UnionShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/UnionShape3D.js"],"names":[],"mappings":"AA0BA;IAqII;;;;OAIG;IACH,sBAHW,eAAe,EAAE,GACf,YAAY,CAUxB;IA9IG;;;OAGG;IACH,UAFU,eAAe,EAAE,CAET;IAElB;;;;;OAKG;IACH,kCAAmC;IAEnC,qBAAsB;IACtB,qBAAuB;IACvB,uBAAyB;IAG7B,wCAgCC;IAED;;;OAGG;IACH,mCAkBC;IAED;;;OAGG;IACH,2CA8CC;IAiBD,qBAuBC;IAED,2BAYC;IAED,mEAEC;IAED,6CAaC;IAED,oCAYC;IAED,kFAoDC;IAED,qGAyBC;IAED;;;;OAIG;IACH,cAHW,YAAY,GACV,OAAO,CAKnB;IAED,eAWC;CACJ;gCArV+B,sBAAsB"}
1
+ {"version":3,"file":"UnionShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/UnionShape3D.js"],"names":[],"mappings":"AA2BA;IAqII;;;;OAIG;IACH,sBAHW,eAAe,EAAE,GACf,YAAY,CAYxB;IAhJG;;;OAGG;IACH,UAFU,eAAe,EAAE,CAET;IAElB;;;;;OAKG;IACH,kCAAmC;IAEnC,qBAAsB;IACtB,qBAAuB;IACvB,uBAAyB;IAG7B,wCAgCC;IAED;;;OAGG;IACH,mCAkBC;IAED;;;OAGG;IACH,2CA8CC;IAmBD,qBAuBC;IAED,2BAaC;IAED,mEAEC;IAED,6CAaC;IAED,oCAYC;IAED,kFAoDC;IAED,qGAyBC;IAED;;;;OAIG;IACH,cAHW,YAAY,GACV,OAAO,CAKnB;IAED,eAWC;CACJ;gCAxV+B,sBAAsB"}
@@ -1,3 +1,4 @@
1
+ import { assert } from "../../../assert.js";
1
2
  import { array_copy } from "../../../collection/array/array_copy.js";
2
3
  import { binarySearchHighIndex } from "../../../collection/array/binarySearchHighIndex.js";
3
4
  import { isArrayEqual } from "../../../collection/array/isArrayEqual.js";
@@ -163,6 +164,8 @@ export class UnionShape3D extends AbstractShape3D {
163
164
  * @returns {UnionShape3D}
164
165
  */
165
166
  static from(children) {
167
+ assert.isArray(children, 'children');
168
+
166
169
  const r = new UnionShape3D();
167
170
 
168
171
  r.children = children;
@@ -205,6 +208,7 @@ export class UnionShape3D extends AbstractShape3D {
205
208
  for (let i = 0; i < child_count; i++) {
206
209
  const child = children[i];
207
210
 
211
+ // TODO this is incorrect math
208
212
  r += child.surface_area;
209
213
  }
210
214
 
@@ -1 +1 @@
1
- {"version":3,"file":"UnitCubeShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/UnitCubeShape3D.js"],"names":[],"mappings":"AAUA;IAkFI,iCAAwC;IAhFxC,qBAEC;IAED,wCAQC;IAED,4DAYC;IAED,qGAIC;IAED,mEAEC;IAED,6CAqBC;IAED,oCASC;IAED,kFAEC;IAED,eAEC;CAGJ;gCAtF+B,sBAAsB"}
1
+ {"version":3,"file":"UnitCubeShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/UnitCubeShape3D.js"],"names":[],"mappings":"AAUA;IAsFI,iCAAwC;IApFxC,qBAEC;IAED,2BAEC;IAED,wCAQC;IAED,4DAYC;IAED,qGAIC;IAED,mEAEC;IAED,6CAqBC;IAED,oCASC;IAED,kFAEC;IAED,eAEC;CAGJ;gCA1F+B,sBAAsB"}
@@ -14,6 +14,10 @@ export class UnitCubeShape3D extends AbstractShape3D {
14
14
  return 1;
15
15
  }
16
16
 
17
+ get surface_area() {
18
+ return 6;
19
+ }
20
+
17
21
  compute_bounding_box(result) {
18
22
  result[0] = -0.5;
19
23
  result[1] = -0.5;
@@ -49,10 +49,14 @@ export class ConicRay {
49
49
  /**
50
50
  *
51
51
  * @param {ConicRay} other
52
- * @param {number} tolerance
52
+ * @param {number} [tolerance]
53
53
  * @returns {boolean}
54
54
  */
55
55
  roughlyEquals(other: ConicRay, tolerance?: number): boolean;
56
+ /**
57
+ *
58
+ * @return {number}
59
+ */
56
60
  hash(): number;
57
61
  /**
58
62
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ConicRay.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/ConicRay.js"],"names":[],"mappings":"AAQA;;;;GAIG;AACH;IA8KI;;;;;;;OAOG;IACH,sBANW,MAAM,KACN,MAAM,KACN,MAAM,cACN,MAAM,GACJ,QAAQ,CAkBpB;IApMD;;;;OAIG;IACH,oBAFU,OAAO,CAEgB;IAEjC;;;;OAIG;IACH,OAFU,MAAM,CAEN;IAEV;;;MAKC;IAED,0BAGC;IAED;;;OAGG;IACH,uBAFW,YAAY,QAKtB;IAED;;;OAGG;IACH,yBAFW,YAAY,QAQtB;IAED;;;;OAIG;IACH,cAHW,QAAQ,GACN,OAAO,CAMnB;IAED;;;;;OAKG;IACH,qBAJW,QAAQ,cACR,MAAM,GACJ,OAAO,CAKnB;IAED,eAKC;IAED;;;OAGG;IACH,YAFW,QAAQ,QAKlB;IAED;;;;OAIG;IACH,4BAHW,OAAO,GACL,OAAO,CAMnB;IAED;;;;;OAKG;IACH,gDAFW,OAAO,QAsEjB;CA2BJ;oBA/MmB,cAAc"}
1
+ {"version":3,"file":"ConicRay.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/ConicRay.js"],"names":[],"mappings":"AAQA;;;;GAIG;AACH;IAkLI;;;;;;;OAOG;IACH,sBANW,MAAM,KACN,MAAM,KACN,MAAM,cACN,MAAM,GACJ,QAAQ,CAkBpB;IAxMD;;;;OAIG;IACH,oBAFU,OAAO,CAEgB;IAEjC;;;;OAIG;IACH,OAFU,MAAM,CAEN;IAEV;;;MAKC;IAED,0BAGC;IAED;;;OAGG;IACH,uBAFW,YAAY,QAKtB;IAED;;;OAGG;IACH,yBAFW,YAAY,QAQtB;IAED;;;;OAIG;IACH,cAHW,QAAQ,GACN,OAAO,CAMnB;IAED;;;;;OAKG;IACH,qBAJW,QAAQ,cACR,MAAM,GACJ,OAAO,CAKnB;IAED;;;OAGG;IACH,QAFY,MAAM,CAOjB;IAED;;;OAGG;IACH,YAFW,QAAQ,QAKlB;IAED;;;;OAIG;IACH,4BAHW,OAAO,GACL,OAAO,CAMnB;IAED;;;;;OAKG;IACH,gDAFW,OAAO,QAsEjB;CA2BJ;oBAnNmB,cAAc"}
@@ -74,7 +74,7 @@ export class ConicRay {
74
74
  /**
75
75
  *
76
76
  * @param {ConicRay} other
77
- * @param {number} tolerance
77
+ * @param {number} [tolerance]
78
78
  * @returns {boolean}
79
79
  */
80
80
  roughlyEquals(other, tolerance = EPSILON) {
@@ -82,6 +82,10 @@ export class ConicRay {
82
82
  && this.direction.roughlyEquals(other.direction, tolerance);
83
83
  }
84
84
 
85
+ /**
86
+ *
87
+ * @return {number}
88
+ */
85
89
  hash() {
86
90
  return combine_hash(
87
91
  computeHashFloat(this.angle),
@@ -1 +1 @@
1
- {"version":3,"file":"Vector1.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Vector1.js"],"names":[],"mappings":";AAWA;IAmQI;;;;;OAKG;IACH,kBAJW,OAAO,KACP,OAAO,GACN,MAAM,CAIjB;IA1QD;;;;;;OAMG;IACH,gBALW,MAAM,EAchB;IAHG,UAAU;IAEV,0DAA6B;IAWjC;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,iBAHW,OAAO,GACL,MAAM,CAIlB;IAED;;;;OAIG;IACH,OAHW,MAAM,GACJ,OAAO,CAgBnB;IAED;;;OAGG;IACH,aAFW,MAAM,QAOhB;IAED;;;OAGG;IACH,UAFY,OAAO,CAIlB;IAED,kBAEC;IAED,kBAEC;IAED;;;;OAIG;IACH,iBAFY,OAAO,CAIlB;IAED;;;OAGG;IACH,WAFW,OAAO,GAAC,OAAO,GAAC,OAAO,GAAC,OAAO,WAIzC;IAED;;;;OAIG;IACH,iBAFY,OAAO,CAIlB;IAED;;;;OAIG;IACH,WAHW,OAAO,GACL,OAAO,CAInB;IAED;;;;OAIG;IACH,gBAHW,OAAO,GACL,OAAO,CAInB;IAED;;;OAGG;IACH,kBAFW,MAAM,QAIhB;IAED;;;;;OAKG;IACH,WAJW,MAAM,QACN,MAAM,GACJ,OAAO,CAInB;IAED;;;OAGG;IACH,eAEC;IAED;;;OAGG;IACH,YAFW,OAAO,GAAC,OAAO,GAAC,OAAO,GAAC,OAAO,QAIzC;IAED;;;OAGG;IACH,SAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,cAHW,OAAO,GACL,OAAO,CAInB;IAED;;OAEG;IACH,QAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,4BAGC;IAED,iBAEC;IAED,yBAEC;IAED;;;;OAIG;IACH,qBAHW,MAAM,EAAE,WACR,MAAM,QAIhB;IAED;;;;OAIG;IACH,oBAHW,MAAM,EAAE,WACR,MAAM,QAIhB;IAED,oBAEC;IAED;;;OAGG;IACH,uBAFW,YAAY,QAItB;IAED;;;OAGG;IACH,yBAFW,YAAY,QAMtB;IAgBD,iBAEC;IAND,gBAEC;IAaL;;;OAGG;IACH,oBAFU,OAAO,CAEU;IAXvB,sDAIC;CACJ;;;cAYS,OAAO;aAMP,OAAO;;mBAjTE,4BAA4B"}
1
+ {"version":3,"file":"Vector1.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Vector1.js"],"names":[],"mappings":";AAWA;IA4QI;;;;;OAKG;IACH,kBAJW,OAAO,KACP,OAAO,GACN,MAAM,CAIjB;IAnRD;;;;;;OAMG;IACH,gBALW,MAAM,EAchB;IAHG,UAAU;IAEV,0DAA6B;IAWjC;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,iBAHW,OAAO,GACL,MAAM,CAIlB;IAED;;;;OAIG;IACH,OAHW,MAAM,GACJ,OAAO,CAgBnB;IAED;;;OAGG;IACH,aAFW,MAAM,QAOhB;IAED;;;OAGG;IACH,UAFY,OAAO,CAIlB;IAED;;;OAGG;IACH,kBAEC;IAED;;;OAGG;IACH,kBAEC;IAED;;;;OAIG;IACH,iBAFY,OAAO,CAIlB;IAED;;;OAGG;IACH,WAFW,OAAO,GAAC,OAAO,GAAC,OAAO,GAAC,OAAO,WAKzC;IAED;;;;OAIG;IACH,iBAFY,OAAO,CAIlB;IAED;;;;OAIG;IACH,WAHW,OAAO,GACL,OAAO,CAInB;IAED;;;;OAIG;IACH,gBAHW,OAAO,GACL,OAAO,CAInB;IAED;;;OAGG;IACH,kBAFW,MAAM,QAIhB;IAED;;;;;OAKG;IACH,WAJW,MAAM,QACN,MAAM,GACJ,OAAO,CAInB;IAED;;;OAGG;IACH,eAEC;IAED;;;OAGG;IACH,YAFW,OAAO,GAAC,OAAO,GAAC,OAAO,GAAC,OAAO,QAIzC;IAED;;;OAGG;IACH,SAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,cAHW,OAAO,GACL,OAAO,CAInB;IAED;;OAEG;IACH,QAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,4BAGC;IAED,iBAEC;IAED,yBAEC;IAED;;;;OAIG;IACH,qBAHW,MAAM,EAAE,WACR,MAAM,QAIhB;IAED;;;;OAIG;IACH,oBAHW,MAAM,EAAE,WACR,MAAM,QAIhB;IAED,oBAEC;IAED;;;OAGG;IACH,uBAFW,YAAY,QAItB;IAED;;;OAGG;IACH,yBAFW,YAAY,QAMtB;IAkBD,iBAEC;IAND,gBAEC;IAaL;;;OAGG;IACH,oBAFU,OAAO,CAEU;IAXvB,sDAIC;CACJ;;;cAaS,OAAO;aAOP,OAAO;;mBA9TE,4BAA4B"}
@@ -45,7 +45,7 @@ class Vector1 extends Number {
45
45
  }
46
46
 
47
47
  /**
48
- *
48
+ * Currently held value
49
49
  * @returns {number}
50
50
  */
51
51
  getValue() {
@@ -53,7 +53,7 @@ class Vector1 extends Number {
53
53
  }
54
54
 
55
55
  /**
56
- *
56
+ * Useful for sorting
57
57
  * @param {Vector1} other
58
58
  * @returns {number}
59
59
  */
@@ -101,10 +101,18 @@ class Vector1 extends Number {
101
101
  return this.x === 0;
102
102
  }
103
103
 
104
+ /**
105
+ * Increase value by 1.
106
+ * `value++`
107
+ */
104
108
  increment() {
105
109
  this._add(1);
106
110
  }
107
111
 
112
+ /**
113
+ * Decrease value by 1.
114
+ * `value--`
115
+ */
108
116
  decrement() {
109
117
  this._add(-1);
110
118
  }
@@ -123,6 +131,7 @@ class Vector1 extends Number {
123
131
  * @param {Vector1|Vector2|Vector3|Vector4} other
124
132
  */
125
133
  add(other) {
134
+ assert.isObject(other,"other");
126
135
  return this._add(other.x);
127
136
  }
128
137
 
@@ -278,6 +287,8 @@ class Vector1 extends Number {
278
287
  return a.x - b.x;
279
288
  }
280
289
 
290
+ // pretending to be an array
291
+
281
292
  get 0() {
282
293
  return this.x;
283
294
  }
@@ -302,12 +313,14 @@ Vector1.prototype.isVector1 = true;
302
313
  Vector1.typeName = "Vector1";
303
314
 
304
315
  /**
316
+ * Utility singleton
305
317
  * @readonly
306
318
  * @type {Vector1}
307
319
  */
308
320
  Vector1.zero = Object.freeze(new Vector1(0));
309
321
 
310
322
  /**
323
+ * Utility singleton
311
324
  * @readonly
312
325
  * @type {Vector1}
313
326
  */