@woosh/meep-engine 2.121.0 → 2.121.2

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 (56) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/src/core/collection/map/HashMap.d.ts.map +1 -1
  4. package/src/core/collection/map/HashMap.js +29 -2
  5. package/src/core/geom/2d/aabb/aabb2_intersects_point.d.ts +12 -0
  6. package/src/core/geom/2d/aabb/aabb2_intersects_point.d.ts.map +1 -0
  7. package/src/core/geom/2d/aabb/aabb2_intersects_point.js +17 -0
  8. package/src/core/geom/2d/quad-tree/QuadTreeNode.d.ts +17 -6
  9. package/src/core/geom/2d/quad-tree/QuadTreeNode.d.ts.map +1 -1
  10. package/src/core/geom/2d/quad-tree/QuadTreeNode.js +59 -98
  11. package/src/core/geom/2d/quad-tree/qt_collect_by_box.d.ts +14 -0
  12. package/src/core/geom/2d/quad-tree/qt_collect_by_box.d.ts.map +1 -0
  13. package/src/core/geom/2d/quad-tree/qt_collect_by_box.js +90 -0
  14. package/src/core/geom/2d/quad-tree/qt_collect_by_point.d.ts +11 -0
  15. package/src/core/geom/2d/quad-tree/qt_collect_by_point.d.ts.map +1 -0
  16. package/src/core/geom/2d/quad-tree/qt_collect_by_point.js +85 -0
  17. package/src/core/geom/3d/ray/ray3_distance_to_point.d.ts +14 -1
  18. package/src/core/geom/3d/ray/ray3_distance_to_point.d.ts.map +1 -1
  19. package/src/core/geom/3d/ray/ray3_distance_to_point.js +18 -1
  20. package/src/core/geom/3d/shape/UnionShape3D.d.ts.map +1 -1
  21. package/src/core/geom/3d/shape/UnionShape3D.js +4 -0
  22. package/src/core/geom/3d/shape/UnitCubeShape3D.d.ts.map +1 -1
  23. package/src/core/geom/3d/shape/UnitCubeShape3D.js +4 -0
  24. package/src/core/geom/ConicRay.d.ts +5 -1
  25. package/src/core/geom/ConicRay.d.ts.map +1 -1
  26. package/src/core/geom/ConicRay.js +5 -1
  27. package/src/core/geom/Vector3.d.ts.map +1 -1
  28. package/src/core/geom/Vector3.js +67 -49
  29. package/src/core/geom/packing/max-rect/MaxRectanglesPacker.d.ts.map +1 -1
  30. package/src/core/geom/packing/max-rect/MaxRectanglesPacker.js +3 -0
  31. package/src/core/geom/packing/max-rect/cutArea.d.ts.map +1 -1
  32. package/src/core/geom/packing/max-rect/cutArea.js +8 -1
  33. package/src/core/geom/packing/max-rect/findBestContainer.d.ts +4 -4
  34. package/src/core/geom/packing/max-rect/findBestContainer.d.ts.map +1 -1
  35. package/src/core/geom/packing/max-rect/findBestContainer.js +30 -8
  36. package/src/core/geom/packing/max-rect/packOneBox.d.ts.map +1 -1
  37. package/src/core/geom/packing/max-rect/packOneBox.js +7 -2
  38. package/src/core/geom/packing/max-rect/removeRedundantBoxesArray.d.ts.map +1 -1
  39. package/src/core/geom/packing/max-rect/removeRedundantBoxesArray.js +13 -7
  40. package/src/core/geom/packing/miniball/Miniball.d.ts.map +1 -1
  41. package/src/core/geom/packing/miniball/Miniball.js +27 -1
  42. package/src/core/geom/packing/miniball/PointSet.d.ts.map +1 -1
  43. package/src/core/geom/packing/miniball/PointSet.js +25 -4
  44. package/src/core/geom/packing/miniball/Quality.js +1 -3
  45. package/src/core/geom/vec3/v3_lerp.d.ts +2 -2
  46. package/src/core/geom/vec3/v3_lerp.d.ts.map +1 -1
  47. package/src/core/geom/vec3/v3_lerp.js +3 -1
  48. package/src/core/geom/vec3/v3_slerp.d.ts.map +1 -1
  49. package/src/core/geom/vec3/v3_slerp.js +5 -0
  50. package/src/core/graph/layout/box/position_box_next_to_box.d.ts.map +1 -1
  51. package/src/core/graph/layout/box/position_box_next_to_box.js +15 -8
  52. package/src/core/math/lerp.d.ts +1 -1
  53. package/src/core/math/lerp.d.ts.map +1 -1
  54. package/src/core/math/lerp.js +3 -2
  55. package/src/view/View.d.ts.map +1 -1
  56. package/src/view/View.js +14 -1
@@ -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":"Vector3.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Vector3.js"],"names":[],"mappings":";AAgBA;;;GAGG;AACH;IAs7BI;;;;;OAKG;IACH,cAJW,OAAO,GAAC,OAAO,KACf,OAAO,GAAC,OAAO,GACb,MAAM,CAIlB;IAED;;;;;OAKG;IACH,mBAJW,OAAO,KACP,OAAO,GACL,MAAM,CAIlB;IAED;;;;;OAKG;IACH,wBAJW,MAAM,EAAE,WACR,MAAM,GACJ,OAAO,CAQnB;IAED;;;;OAIG;IACH,yBAHW,MAAM,GACJ,OAAO,CAInB;IA99BD;;;;;;OAMG;IACH,gBALW,MAAM,MACN,MAAM,MACN,MAAM,EAuChB;IA1BG;;;;OAIG;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 +2,6 @@ import { assert } from "../assert.js";
2
2
  import Signal from "../events/signal/Signal.js";
3
3
  import { EPSILON } from "../math/EPSILON.js";
4
4
  import { epsilonEquals } from "../math/epsilonEquals.js";
5
- import { lerp } from "../math/lerp.js";
6
5
  import { sign } from "../math/sign.js";
7
6
  import { computeHashFloat } from "../primitives/numbers/computeHashFloat.js";
8
7
  import { v3_angle_between } from "./vec3/v3_angle_between.js";
@@ -414,7 +413,11 @@ class Vector3 {
414
413
  * @returns {Vector3}
415
414
  */
416
415
  abs() {
417
- return this.set(Math.abs(this.x), Math.abs(this.y), Math.abs(this.z));
416
+ return this.set(
417
+ Math.abs(this.x),
418
+ Math.abs(this.y),
419
+ Math.abs(this.z)
420
+ );
418
421
  }
419
422
 
420
423
  /**
@@ -569,7 +572,11 @@ class Vector3 {
569
572
  * @returns {Vector3}
570
573
  */
571
574
  sign() {
572
- return this.set(sign(this.x), sign(this.y), sign(this.z));
575
+ return this.set(
576
+ sign(this.x),
577
+ sign(this.y),
578
+ sign(this.z)
579
+ );
573
580
  }
574
581
 
575
582
  /**
@@ -579,11 +586,7 @@ class Vector3 {
579
586
  * @returns {Vector3}
580
587
  */
581
588
  lerp(other, fraction) {
582
- const x = lerp(this.x, other.x, fraction);
583
- const y = lerp(this.y, other.y, fraction);
584
- const z = lerp(this.z, other.z, fraction);
585
-
586
- return this.set(x, y, z);
589
+ return this.lerpVectors(this, other, fraction);
587
590
  }
588
591
 
589
592
  /**
@@ -591,9 +594,22 @@ class Vector3 {
591
594
  * @param {Vector3} a
592
595
  * @param {Vector3} b
593
596
  * @param {number} fraction
597
+ * @returns {this}
594
598
  */
595
599
  lerpVectors(a, b, fraction) {
596
600
  v3_lerp(this, a.x, a.y, a.z, b.x, b.y, b.z, fraction);
601
+
602
+ return this;
603
+ }
604
+
605
+ /**
606
+ *
607
+ * @param {Vector3} other
608
+ * @param {number} fraction
609
+ * @return {this}
610
+ */
611
+ slerp(other, fraction) {
612
+ return this.slerpVectors(this, other, fraction);
597
613
  }
598
614
 
599
615
  /**
@@ -601,19 +617,13 @@ class Vector3 {
601
617
  * @param {Vector3} a
602
618
  * @param {Vector3} b
603
619
  * @param {number} fraction
620
+ * @returns {this}
604
621
  */
605
622
  slerpVectors(a, b, fraction) {
606
623
  v3_slerp(this, a.x, a.y, a.z, b.x, b.y, b.z, fraction);
624
+ return this;
607
625
  }
608
626
 
609
- /**
610
- *
611
- * @param {THREE.Matrix4} matrix4
612
- * @deprecated use {@link @applyMatrix4} directly instead, pass `mat.elements`
613
- */
614
- applyMatrix4_three(matrix4) {
615
- this.applyMatrix4(matrix4.elements);
616
- }
617
627
 
618
628
  /**
619
629
  *
@@ -657,31 +667,6 @@ class Vector3 {
657
667
  );
658
668
  }
659
669
 
660
- /**
661
- * @deprecated use non-three.js version instead
662
- * @param {THREE.Matrix4} m
663
- */
664
- transformDirection_three(m) {
665
-
666
- // input: THREE.Matrix4 affine matrix
667
- // vector interpreted as a direction
668
-
669
- const e = m.elements;
670
-
671
- this.applyDirectionMatrix4(e);
672
- }
673
-
674
- /**
675
- * @deprecated use non-three.js version instead
676
- * @param {THREE.Matrix3} m
677
- * @returns {Vector3}
678
- */
679
- applyMatrix3_three(m) {
680
- this.applyMatrix3(m.elements);
681
-
682
- return this;
683
- }
684
-
685
670
  /**
686
671
  *
687
672
  * @param {number[]|Float32Array} mat
@@ -698,13 +683,6 @@ class Vector3 {
698
683
  this.set(_x, _y, _z);
699
684
  }
700
685
 
701
- /**
702
- * @deprecated use non-three.js version instead
703
- * @param {THREE.Matrix4} matrix4
704
- */
705
- threejs_setFromMatrixPosition(matrix4) {
706
- this.setFromMatrixPosition(matrix4.elements);
707
- }
708
686
 
709
687
  /**
710
688
  *
@@ -859,7 +837,11 @@ class Vector3 {
859
837
  }
860
838
 
861
839
  toJSON() {
862
- return { x: this.x, y: this.y, z: this.z };
840
+ return {
841
+ x: this.x,
842
+ y: this.y,
843
+ z: this.z
844
+ };
863
845
  }
864
846
 
865
847
  /**
@@ -1010,6 +992,42 @@ class Vector3 {
1010
992
  static fromScalar(value) {
1011
993
  return new Vector3(value, value, value);
1012
994
  }
995
+
996
+
997
+ /**
998
+ *
999
+ * @param {THREE.Matrix4} matrix4
1000
+ * @deprecated use {@link @applyMatrix4} directly instead, pass `mat.elements`
1001
+ */
1002
+ applyMatrix4_three(matrix4) {
1003
+ throw new Error("use applyMatrix4 instead")
1004
+ }
1005
+
1006
+ /**
1007
+ * @deprecated use non-three.js version instead
1008
+ * @param {THREE.Matrix4} m
1009
+ */
1010
+ transformDirection_three(m) {
1011
+ throw new Error("use applyDirectionMatrix4 instead")
1012
+ }
1013
+
1014
+ /**
1015
+ * @deprecated use non-three.js version instead
1016
+ * @param {THREE.Matrix3} m
1017
+ * @returns {Vector3}
1018
+ */
1019
+ applyMatrix3_three(m) {
1020
+ throw new Error("use applyMatrix3 instead")
1021
+ }
1022
+
1023
+ /**
1024
+ * @deprecated use non-three.js version instead
1025
+ * @param {THREE.Matrix4} matrix4
1026
+ */
1027
+ threejs_setFromMatrixPosition(matrix4) {
1028
+ throw new Error("use setFromMatrixPosition instead")
1029
+ }
1030
+
1013
1031
  }
1014
1032
 
1015
1033
  // Aliases
@@ -1 +1 @@
1
- {"version":3,"file":"MaxRectanglesPacker.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/packing/max-rect/MaxRectanglesPacker.js"],"names":[],"mappings":"AAWA;;;;GAIG;AACH;IACI;;;;OAIG;IACH,mBAHW,MAAM,UACN,MAAM,EAmBhB;IAhBG,cAAsC;IAEtC;;;OAGG;IACH,wBAAiD;IAKjD;;;OAGG;IACH,OAFU,KAAK,EAAE,CAEF;IAGnB;;;;OAIG;IACH,YAHW,KAAK,GACH,OAAO,CAoBnB;IAED;;;;OAIG;IACH,kBAHW,KAAK,EAAE,GACL,MAAM,CAgBlB;IAED;;;;OAIG;IACH,SAHW,KAAK,GACH,OAAO,CAanB;IAED;;;;;;OAMG;IACH,UAJW,MAAM,KACN,MAAM,GACL,OAAO,CAIlB;IAED;;;;OAIG;IACH,eAHW,KAAK,EAAE,GACL,OAAO,CA8CnB;IAED;;;OAGG;IACH,UAFa,OAAO,CAWnB;IAED;;OAEG;IACH,cAKC;IAED;;;;;OAKG;IACH,cAJW,MAAM,UACN,MAAM,GACJ,OAAO,CA2BnB;IAED,oBAsBC;CACJ;oBAnPmB,kBAAkB;6BADT,oCAAoC;kBAF/C,wBAAwB"}
1
+ {"version":3,"file":"MaxRectanglesPacker.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/packing/max-rect/MaxRectanglesPacker.js"],"names":[],"mappings":"AAWA;;;;GAIG;AACH;IACI;;;;OAIG;IACH,mBAHW,MAAM,UACN,MAAM,EAmBhB;IAhBG,cAAsC;IAEtC;;;OAGG;IACH,wBAAiD;IAKjD;;;OAGG;IACH,OAFU,KAAK,EAAE,CAEF;IAGnB;;;;OAIG;IACH,YAHW,KAAK,GACH,OAAO,CAoBnB;IAED;;;;OAIG;IACH,kBAHW,KAAK,EAAE,GACL,MAAM,CAgBlB;IAED;;;;OAIG;IACH,SAHW,KAAK,GACH,OAAO,CAanB;IAED;;;;;;OAMG;IACH,UAJW,MAAM,KACN,MAAM,GACL,OAAO,CAIlB;IAED;;;;OAIG;IACH,eAHW,KAAK,EAAE,GACL,OAAO,CAiDnB;IAED;;;OAGG;IACH,UAFa,OAAO,CAWnB;IAED;;OAEG;IACH,cAKC;IAED;;;;;OAKG;IACH,cAJW,MAAM,UACN,MAAM,GACJ,OAAO,CA2BnB;IAED,oBAsBC;CACJ;oBAtPmB,kBAAkB;6BADT,oCAAoC;kBAF/C,wBAAwB"}
@@ -120,6 +120,9 @@ export class MaxRectanglesPacker {
120
120
  * @returns {boolean}
121
121
  */
122
122
  addMany(boxes) {
123
+ assert.defined(boxes,'boxes');
124
+ assert.isArray(boxes,'boxes');
125
+
123
126
  // assert.ok(this.validate());
124
127
 
125
128
  const numBoxes = boxes.length;
@@ -1 +1 @@
1
- {"version":3,"file":"cutArea.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/packing/max-rect/cutArea.js"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,iCAHW,KAAK,SACL,YAAY,QAsEtB"}
1
+ {"version":3,"file":"cutArea.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/packing/max-rect/cutArea.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,iCAHW,KAAK,SACL,YAAY,QA4EtB"}
@@ -1,3 +1,4 @@
1
+ import { assert } from "../../../assert.js";
1
2
  import { max2 } from "../../../math/max2.js";
2
3
  import { min2 } from "../../../math/min2.js";
3
4
  import { QuadTreeDatum } from "../../2d/quad-tree/QuadTreeDatum.js";
@@ -8,7 +9,13 @@ import { removeRedundantBoxesArray } from "./removeRedundantBoxesArray.js";
8
9
  * @param {AABB2} scissor area to be cut out
9
10
  * @param {QuadTreeNode} boxes
10
11
  */
11
- export function cutArea(scissor, boxes) {
12
+ export function cutArea(
13
+ scissor,
14
+ boxes
15
+ ) {
16
+
17
+ assert.defined(scissor, 'scissor');
18
+ assert.defined(boxes, 'boxes');
12
19
 
13
20
  /**
14
21
  *
@@ -1,10 +1,10 @@
1
1
  /**
2
- *
2
+ * @template T
3
3
  * @param {number} width
4
4
  * @param {number} height
5
- * @param {QuadTreeNode} boxes
5
+ * @param {QuadTreeNode<T>} boxes
6
6
  * @param {function(containerWidth:number, containerHeight:number, childWidth:number, childHeight:number):number} costFunction
7
- * @returns {QuadTreeDatum} suitable container box
7
+ * @returns {QuadTreeDatum<T>} suitable container box
8
8
  */
9
- export function findBestContainer(width: number, height: number, boxes: QuadTreeNode, costFunction: any): QuadTreeDatum;
9
+ export function findBestContainer<T>(width: number, height: number, boxes: QuadTreeNode<T>, costFunction: any): QuadTreeDatum<T>;
10
10
  //# sourceMappingURL=findBestContainer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"findBestContainer.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/packing/max-rect/findBestContainer.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,yCANW,MAAM,UACN,MAAM,SACN,YAAY,sBAEV,aAAa,CAmDzB"}
1
+ {"version":3,"file":"findBestContainer.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/packing/max-rect/findBestContainer.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,kCAPa,CAAC,SACH,MAAM,UACN,MAAM,SACN,YAAY,CAAC,CAAC,CAAC,sBAEb,aAAa,CAAC,CAAC,CAAC,CAuE5B"}
@@ -1,16 +1,34 @@
1
+ import { assert } from "../../../assert.js";
2
+
1
3
  /**
2
- *
4
+ * @template T
3
5
  * @param {number} width
4
6
  * @param {number} height
5
- * @param {QuadTreeNode} boxes
7
+ * @param {QuadTreeNode<T>} boxes
6
8
  * @param {function(containerWidth:number, containerHeight:number, childWidth:number, childHeight:number):number} costFunction
7
- * @returns {QuadTreeDatum} suitable container box
9
+ * @returns {QuadTreeDatum<T>} suitable container box
8
10
  */
9
- export function findBestContainer(width, height, boxes, costFunction) {
11
+ export function findBestContainer(
12
+ width,
13
+ height,
14
+ boxes,
15
+ costFunction
16
+ ) {
17
+
18
+ assert.isNumber(width,'width');
19
+ assert.isNumber(height,'height');
20
+ assert.defined(boxes,'boxes');
21
+ assert.isFunction(costFunction,'costFunction');
22
+
10
23
  let best = null;
11
24
  let bestScore = Number.POSITIVE_INFINITY;
12
25
 
13
- const visitor = (node) => {
26
+ /**
27
+ *
28
+ * @param {QuadTreeNode} node
29
+ * @return {boolean}
30
+ */
31
+ function visitor(node){
14
32
 
15
33
  if (node.getWidth() < width) {
16
34
  //too small, don't traverse deeper
@@ -23,9 +41,9 @@ export function findBestContainer(width, height, boxes, costFunction) {
23
41
  }
24
42
 
25
43
  const data = node.data;
26
- const numBoxes = data.length;
44
+ const box_count = data.length;
27
45
 
28
- for (let i = 0; i < numBoxes; i++) {
46
+ for (let i = 0; i < box_count; i++) {
29
47
  const box = data[i];
30
48
 
31
49
  const bW = box.getWidth();
@@ -43,6 +61,10 @@ export function findBestContainer(width, height, boxes, costFunction) {
43
61
  }
44
62
 
45
63
  const cost = costFunction(bW, bH, width, height);
64
+
65
+ assert.isNumber(cost,'cost');
66
+ assert.notNaN(cost,'cost');
67
+
46
68
  if (cost < bestScore) {
47
69
  bestScore = cost;
48
70
  best = box;
@@ -50,7 +72,7 @@ export function findBestContainer(width, height, boxes, costFunction) {
50
72
  }
51
73
 
52
74
  return true;
53
- };
75
+ }
54
76
 
55
77
  boxes.traversePreOrder(visitor);
56
78
 
@@ -1 +1 @@
1
- {"version":3,"file":"packOneBox.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/packing/max-rect/packOneBox.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,gCAJW,KAAK,QACL,YAAY,GACV,OAAO,CAuCnB"}
1
+ {"version":3,"file":"packOneBox.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/packing/max-rect/packOneBox.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,gCAJW,KAAK,QACL,YAAY,GACV,OAAO,CA4CnB"}
@@ -1,7 +1,7 @@
1
- import { findBestContainer } from "./findBestContainer.js";
1
+ import { QuadTreeDatum } from "../../2d/quad-tree/QuadTreeDatum.js";
2
2
  import { costByRemainingArea } from "./cost/costByRemainingArea.js";
3
3
  import { cutArea } from "./cutArea.js";
4
- import { QuadTreeDatum } from "../../2d/quad-tree/QuadTreeDatum.js";
4
+ import { findBestContainer } from "./findBestContainer.js";
5
5
 
6
6
  /**
7
7
  *
@@ -34,14 +34,19 @@ export function packOneBox(box, free) {
34
34
 
35
35
  //split remaining space
36
36
  if (box.y1 !== container.y1) {
37
+
37
38
  const splitA = new QuadTreeDatum(container.x0, box.y1, container.x1, container.y1);
38
39
 
39
40
  free.insertDatum(splitA);
41
+
40
42
  }
41
43
 
42
44
  if (box.x1 !== container.x1) {
45
+
43
46
  const splitB = new QuadTreeDatum(box.x1, container.y0, container.x1, container.y1);
47
+
44
48
  free.insertDatum(splitB);
49
+
45
50
  }
46
51
 
47
52
 
@@ -1 +1 @@
1
- {"version":3,"file":"removeRedundantBoxesArray.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/packing/max-rect/removeRedundantBoxesArray.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,iDAFW,KAAK,EAAE,QAqCjB"}
1
+ {"version":3,"file":"removeRedundantBoxesArray.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/packing/max-rect/removeRedundantBoxesArray.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,iDAFW,KAAK,EAAE,QA2CjB"}
@@ -4,9 +4,9 @@
4
4
  */
5
5
  export function removeRedundantBoxesArray(boxes) {
6
6
  let i, j;
7
- let numBoxes = boxes.length;
7
+ let box_count = boxes.length;
8
8
 
9
- loop_a: for (i = 0; i < numBoxes; i++) {
9
+ loop_a: for (i = 0; i < box_count; i++) {
10
10
  const a = boxes[i];
11
11
 
12
12
  const ax0 = a.x0;
@@ -14,7 +14,7 @@ export function removeRedundantBoxesArray(boxes) {
14
14
  const ax1 = a.x1;
15
15
  const ay1 = a.y1;
16
16
 
17
- for (j = i + 1; j < numBoxes; j++) {
17
+ for (j = i + 1; j < box_count; j++) {
18
18
  const b = boxes[j];
19
19
 
20
20
  const bx0 = b.x0;
@@ -24,16 +24,22 @@ export function removeRedundantBoxesArray(boxes) {
24
24
 
25
25
  //question is now whether it is containment
26
26
  if (ax0 >= bx0 && ax1 <= bx1 && ay0 >= by0 && ay1 <= by1) {
27
- //b contains a
27
+
28
+ // B contains A
29
+
28
30
  boxes.splice(i, 1);
29
31
  i--;
30
- numBoxes--;
32
+ box_count--;
31
33
  continue loop_a;
34
+
32
35
  } else if (bx0 >= ax0 && bx1 <= ax1 && by0 >= ay0 && by1 <= ay1) {
33
- //a contains b
36
+
37
+ // A contains B
38
+
34
39
  boxes.splice(j, 1);
35
40
  j--;
36
- numBoxes--;
41
+ box_count--;
42
+
37
43
  }
38
44
  }
39
45
  }