@woosh/meep-engine 2.77.0 → 2.78.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.
@@ -70695,6 +70695,14 @@ class NodeContainer {
70695
70695
  */
70696
70696
  __neighbors = new Map();
70697
70697
 
70698
+ /**
70699
+ * NOTE: this method allocates memory internally
70700
+ * @returns {N[]}
70701
+ */
70702
+ get neighbours() {
70703
+ return Array.from(this.__neighbors.keys());
70704
+ }
70705
+
70698
70706
  /**
70699
70707
  *
70700
70708
  * @return {number}
@@ -70712,7 +70720,7 @@ class NodeContainer {
70712
70720
  }
70713
70721
 
70714
70722
  /**
70715
- *
70723
+ * NOTE: this method allocates memory internally
70716
70724
  * @returns {N[]}
70717
70725
  */
70718
70726
  get inNodes() {
@@ -70720,7 +70728,7 @@ class NodeContainer {
70720
70728
  }
70721
70729
 
70722
70730
  /**
70723
- *
70731
+ * NOTE: this method allocates memory internally
70724
70732
  * @returns {N[]}
70725
70733
  */
70726
70734
  get outNodes() {
@@ -70728,6 +70736,10 @@ class NodeContainer {
70728
70736
  }
70729
70737
 
70730
70738
 
70739
+ /**
70740
+ * NOTE: this method allocates memory internally
70741
+ * @returns {Edge<N>[]}
70742
+ */
70731
70743
  get outEdges() {
70732
70744
  /**
70733
70745
  *
@@ -70740,6 +70752,10 @@ class NodeContainer {
70740
70752
  return result;
70741
70753
  }
70742
70754
 
70755
+ /**
70756
+ * NOTE: this method allocates memory internally
70757
+ * @returns {Edge<N>[]}
70758
+ */
70743
70759
  get inEdges() {
70744
70760
  /**
70745
70761
  *
@@ -71155,6 +71171,14 @@ class Graph {
71155
71171
  return container.getEdgeCount();
71156
71172
  }
71157
71173
 
71174
+ /**
71175
+ *
71176
+ * @returns {N[]}
71177
+ */
71178
+ get nodes() {
71179
+ return Array.from(this.getNodes());
71180
+ }
71181
+
71158
71182
  /**
71159
71183
  * Do not modify this set directly
71160
71184
  * @return {Iterable<N>}
@@ -71360,6 +71384,21 @@ class Graph {
71360
71384
  return edge_count;
71361
71385
  }
71362
71386
 
71387
+ /**
71388
+ *
71389
+ * @param {N} node
71390
+ * @returns {N[]}
71391
+ */
71392
+ getNeighbours(node) {
71393
+ const container = this.__nodes.get(node);
71394
+
71395
+ if (container === undefined) {
71396
+ return [];
71397
+ }
71398
+
71399
+ return container.neighbours;
71400
+ }
71401
+
71363
71402
  /**
71364
71403
  *
71365
71404
  * @param {N} node
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.77.0",
8
+ "version": "2.78.0",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1,4 +1,4 @@
1
- import Graph from "../Graph.js";
1
+ import { Graph } from "../v2/Graph.js";
2
2
  import { colorizeGraphGreedy } from "./colorizeGraphGreedy.js";
3
3
 
4
4
  test('empty graph', () => {
@@ -1,21 +1,16 @@
1
- /**
2
- *
3
- * @param {Array.<Circle>} input
4
- * @param {Graph} graph
5
- */
6
1
  import { assert } from "../../assert.js";
7
- import Circle from "../../geom/2d/circle/Circle.js";
8
2
  import AABB2 from "../../geom/2d/aabb/AABB2.js";
3
+ import Circle from "../../geom/2d/circle/Circle.js";
4
+ import {
5
+ line_segment_line_segment_intersection_exists_2d
6
+ } from "../../geom/2d/line/line_segment_line_segment_intersection_exists_2d.js";
9
7
  import Vector2, { v2_distance } from "../../geom/Vector2.js";
10
8
  import { max2 } from "../../math/max2.js";
11
9
  import { min2 } from "../../math/min2.js";
10
+ import { applyCentralGravityAABB2 } from "./box/applyCentralGravityAABB2.js";
11
+ import { resolveAABB2Overlap } from "./box/resolveAABB2Overlap.js";
12
12
  import { computeDisconnectedSubGraphs } from "./computeDisconnectedSubGraphs.js";
13
13
  import { Connection } from "./Connection.js";
14
- import { resolveAABB2Overlap } from "./box/resolveAABB2Overlap.js";
15
- import { applyCentralGravityAABB2 } from "./box/applyCentralGravityAABB2.js";
16
- import {
17
- line_segment_line_segment_intersection_exists_2d
18
- } from "../../geom/2d/line/line_segment_line_segment_intersection_exists_2d.js";
19
14
 
20
15
 
21
16
  /**
@@ -179,6 +179,14 @@ export class Graph {
179
179
  return container.getEdgeCount();
180
180
  }
181
181
 
182
+ /**
183
+ *
184
+ * @returns {N[]}
185
+ */
186
+ get nodes() {
187
+ return Array.from(this.getNodes());
188
+ }
189
+
182
190
  /**
183
191
  * Do not modify this set directly
184
192
  * @return {Iterable<N>}
@@ -390,6 +398,21 @@ export class Graph {
390
398
  return edge_count;
391
399
  }
392
400
 
401
+ /**
402
+ *
403
+ * @param {N} node
404
+ * @returns {N[]}
405
+ */
406
+ getNeighbours(node) {
407
+ const container = this.__nodes.get(node);
408
+
409
+ if (container === undefined) {
410
+ return [];
411
+ }
412
+
413
+ return container.neighbours;
414
+ }
415
+
393
416
  /**
394
417
  *
395
418
  * @param {N} node
@@ -26,6 +26,14 @@ export class NodeContainer {
26
26
  */
27
27
  __neighbors = new Map();
28
28
 
29
+ /**
30
+ * NOTE: this method allocates memory internally
31
+ * @returns {N[]}
32
+ */
33
+ get neighbours() {
34
+ return Array.from(this.__neighbors.keys());
35
+ }
36
+
29
37
  /**
30
38
  *
31
39
  * @return {number}
@@ -43,7 +51,7 @@ export class NodeContainer {
43
51
  }
44
52
 
45
53
  /**
46
- *
54
+ * NOTE: this method allocates memory internally
47
55
  * @returns {N[]}
48
56
  */
49
57
  get inNodes() {
@@ -51,7 +59,7 @@ export class NodeContainer {
51
59
  }
52
60
 
53
61
  /**
54
- *
62
+ * NOTE: this method allocates memory internally
55
63
  * @returns {N[]}
56
64
  */
57
65
  get outNodes() {
@@ -59,6 +67,10 @@ export class NodeContainer {
59
67
  }
60
68
 
61
69
 
70
+ /**
71
+ * NOTE: this method allocates memory internally
72
+ * @returns {Edge<N>[]}
73
+ */
62
74
  get outEdges() {
63
75
  /**
64
76
  *
@@ -71,6 +83,10 @@ export class NodeContainer {
71
83
  return result;
72
84
  }
73
85
 
86
+ /**
87
+ * NOTE: this method allocates memory internally
88
+ * @returns {Edge<N>[]}
89
+ */
74
90
  get inEdges() {
75
91
  /**
76
92
  *