@rxflow/manhattan 0.0.2-alpha.8 → 0.0.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 (157) hide show
  1. package/README.md +214 -10
  2. package/esm/getManHattanPath.js +92 -69
  3. package/esm/obstacle/ObstacleMap.js +218 -99
  4. package/esm/obstacle/QuadTree.js +488 -0
  5. package/esm/options/resolver.js +147 -18
  6. package/esm/pathfinder/PathCache.js +278 -0
  7. package/esm/pathfinder/findRoute.js +98 -44
  8. package/esm/pathfinder/index.js +2 -1
  9. package/esm/svg/pathConverter.js +170 -1
  10. package/esm/utils/AdaptiveStepCalculator.js +252 -0
  11. package/esm/utils/ErrorRecovery.js +499 -0
  12. package/esm/utils/GlobalGrid.js +259 -0
  13. package/esm/utils/PerformanceMonitor.js +360 -0
  14. package/esm/utils/getAnchorPoints.js +0 -4
  15. package/esm/utils/grid.js +18 -13
  16. package/esm/utils/heuristics.js +144 -0
  17. package/esm/utils/index.js +7 -1
  18. package/esm/utils/pathProcessing.js +270 -0
  19. package/esm/utils/pathValidation.js +0 -1
  20. package/esm/utils/rect.js +11 -4
  21. package/esm/utils/route.js +18 -2
  22. package/package.json +10 -2
  23. package/cjs/geometry/Line.d.ts +0 -21
  24. package/cjs/geometry/Line.d.ts.map +0 -1
  25. package/cjs/geometry/Line.js +0 -88
  26. package/cjs/geometry/Point.d.ts +0 -49
  27. package/cjs/geometry/Point.d.ts.map +0 -1
  28. package/cjs/geometry/Point.js +0 -94
  29. package/cjs/geometry/Rectangle.d.ts +0 -41
  30. package/cjs/geometry/Rectangle.d.ts.map +0 -1
  31. package/cjs/geometry/Rectangle.js +0 -65
  32. package/cjs/geometry/collision.d.ts +0 -15
  33. package/cjs/geometry/collision.d.ts.map +0 -1
  34. package/cjs/geometry/collision.js +0 -81
  35. package/cjs/geometry/index.d.ts +0 -5
  36. package/cjs/geometry/index.d.ts.map +0 -1
  37. package/cjs/geometry/index.js +0 -45
  38. package/cjs/getManHattanPath.d.ts +0 -53
  39. package/cjs/getManHattanPath.d.ts.map +0 -1
  40. package/cjs/getManHattanPath.js +0 -418
  41. package/cjs/index.d.ts +0 -16
  42. package/cjs/index.d.ts.map +0 -1
  43. package/cjs/index.js +0 -117
  44. package/cjs/obstacle/ObstacleMap.d.ts +0 -34
  45. package/cjs/obstacle/ObstacleMap.d.ts.map +0 -1
  46. package/cjs/obstacle/ObstacleMap.js +0 -223
  47. package/cjs/obstacle/index.d.ts +0 -2
  48. package/cjs/obstacle/index.d.ts.map +0 -1
  49. package/cjs/obstacle/index.js +0 -12
  50. package/cjs/options/defaults.d.ts +0 -16
  51. package/cjs/options/defaults.d.ts.map +0 -1
  52. package/cjs/options/defaults.js +0 -39
  53. package/cjs/options/index.d.ts +0 -4
  54. package/cjs/options/index.d.ts.map +0 -1
  55. package/cjs/options/index.js +0 -38
  56. package/cjs/options/resolver.d.ts +0 -10
  57. package/cjs/options/resolver.d.ts.map +0 -1
  58. package/cjs/options/resolver.js +0 -120
  59. package/cjs/options/types.d.ts +0 -169
  60. package/cjs/options/types.d.ts.map +0 -1
  61. package/cjs/options/types.js +0 -5
  62. package/cjs/pathfinder/SortedSet.d.ts +0 -35
  63. package/cjs/pathfinder/SortedSet.d.ts.map +0 -1
  64. package/cjs/pathfinder/SortedSet.js +0 -95
  65. package/cjs/pathfinder/findRoute.d.ts +0 -8
  66. package/cjs/pathfinder/findRoute.d.ts.map +0 -1
  67. package/cjs/pathfinder/findRoute.js +0 -330
  68. package/cjs/pathfinder/index.d.ts +0 -3
  69. package/cjs/pathfinder/index.d.ts.map +0 -1
  70. package/cjs/pathfinder/index.js +0 -19
  71. package/cjs/svg/index.d.ts +0 -3
  72. package/cjs/svg/index.d.ts.map +0 -1
  73. package/cjs/svg/index.js +0 -31
  74. package/cjs/svg/pathConverter.d.ts +0 -10
  75. package/cjs/svg/pathConverter.d.ts.map +0 -1
  76. package/cjs/svg/pathConverter.js +0 -116
  77. package/cjs/svg/pathParser.d.ts +0 -11
  78. package/cjs/svg/pathParser.d.ts.map +0 -1
  79. package/cjs/svg/pathParser.js +0 -76
  80. package/cjs/utils/direction.d.ts +0 -24
  81. package/cjs/utils/direction.d.ts.map +0 -1
  82. package/cjs/utils/direction.js +0 -54
  83. package/cjs/utils/getAnchorPoints.d.ts +0 -15
  84. package/cjs/utils/getAnchorPoints.d.ts.map +0 -1
  85. package/cjs/utils/getAnchorPoints.js +0 -75
  86. package/cjs/utils/grid.d.ts +0 -27
  87. package/cjs/utils/grid.d.ts.map +0 -1
  88. package/cjs/utils/grid.js +0 -66
  89. package/cjs/utils/index.d.ts +0 -8
  90. package/cjs/utils/index.d.ts.map +0 -1
  91. package/cjs/utils/index.js +0 -82
  92. package/cjs/utils/node.d.ts +0 -27
  93. package/cjs/utils/node.d.ts.map +0 -1
  94. package/cjs/utils/node.js +0 -36
  95. package/cjs/utils/pathValidation.d.ts +0 -11
  96. package/cjs/utils/pathValidation.d.ts.map +0 -1
  97. package/cjs/utils/pathValidation.js +0 -130
  98. package/cjs/utils/rect.d.ts +0 -9
  99. package/cjs/utils/rect.d.ts.map +0 -1
  100. package/cjs/utils/rect.js +0 -103
  101. package/cjs/utils/route.d.ts +0 -19
  102. package/cjs/utils/route.d.ts.map +0 -1
  103. package/cjs/utils/route.js +0 -76
  104. package/esm/geometry/Line.d.ts +0 -21
  105. package/esm/geometry/Line.d.ts.map +0 -1
  106. package/esm/geometry/Point.d.ts +0 -49
  107. package/esm/geometry/Point.d.ts.map +0 -1
  108. package/esm/geometry/Rectangle.d.ts +0 -41
  109. package/esm/geometry/Rectangle.d.ts.map +0 -1
  110. package/esm/geometry/collision.d.ts +0 -15
  111. package/esm/geometry/collision.d.ts.map +0 -1
  112. package/esm/geometry/index.d.ts +0 -5
  113. package/esm/geometry/index.d.ts.map +0 -1
  114. package/esm/getManHattanPath.d.ts +0 -53
  115. package/esm/getManHattanPath.d.ts.map +0 -1
  116. package/esm/index.d.ts +0 -16
  117. package/esm/index.d.ts.map +0 -1
  118. package/esm/obstacle/ObstacleMap.d.ts +0 -34
  119. package/esm/obstacle/ObstacleMap.d.ts.map +0 -1
  120. package/esm/obstacle/index.d.ts +0 -2
  121. package/esm/obstacle/index.d.ts.map +0 -1
  122. package/esm/options/defaults.d.ts +0 -16
  123. package/esm/options/defaults.d.ts.map +0 -1
  124. package/esm/options/index.d.ts +0 -4
  125. package/esm/options/index.d.ts.map +0 -1
  126. package/esm/options/resolver.d.ts +0 -10
  127. package/esm/options/resolver.d.ts.map +0 -1
  128. package/esm/options/types.d.ts +0 -169
  129. package/esm/options/types.d.ts.map +0 -1
  130. package/esm/pathfinder/SortedSet.d.ts +0 -35
  131. package/esm/pathfinder/SortedSet.d.ts.map +0 -1
  132. package/esm/pathfinder/findRoute.d.ts +0 -8
  133. package/esm/pathfinder/findRoute.d.ts.map +0 -1
  134. package/esm/pathfinder/index.d.ts +0 -3
  135. package/esm/pathfinder/index.d.ts.map +0 -1
  136. package/esm/svg/index.d.ts +0 -3
  137. package/esm/svg/index.d.ts.map +0 -1
  138. package/esm/svg/pathConverter.d.ts +0 -10
  139. package/esm/svg/pathConverter.d.ts.map +0 -1
  140. package/esm/svg/pathParser.d.ts +0 -11
  141. package/esm/svg/pathParser.d.ts.map +0 -1
  142. package/esm/utils/direction.d.ts +0 -24
  143. package/esm/utils/direction.d.ts.map +0 -1
  144. package/esm/utils/getAnchorPoints.d.ts +0 -15
  145. package/esm/utils/getAnchorPoints.d.ts.map +0 -1
  146. package/esm/utils/grid.d.ts +0 -27
  147. package/esm/utils/grid.d.ts.map +0 -1
  148. package/esm/utils/index.d.ts +0 -8
  149. package/esm/utils/index.d.ts.map +0 -1
  150. package/esm/utils/node.d.ts +0 -27
  151. package/esm/utils/node.d.ts.map +0 -1
  152. package/esm/utils/pathValidation.d.ts +0 -11
  153. package/esm/utils/pathValidation.d.ts.map +0 -1
  154. package/esm/utils/rect.d.ts +0 -9
  155. package/esm/utils/rect.d.ts.map +0 -1
  156. package/esm/utils/route.d.ts +0 -19
  157. package/esm/utils/route.d.ts.map +0 -1
@@ -1,88 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Line = void 0;
7
- var _Point = require("./Point");
8
- /**
9
- * Line class representing a line segment
10
- */
11
- class Line {
12
- start;
13
- end;
14
- constructor(start, end) {
15
- this.start = start;
16
- this.end = end;
17
- }
18
-
19
- /**
20
- * Calculate intersection points with a rectangle
21
- * Returns an array of intersection points
22
- */
23
- intersect(rect) {
24
- const intersections = [];
25
-
26
- // Define rectangle edges
27
- const edges = [
28
- // Top edge
29
- {
30
- p1: new _Point.Point(rect.x, rect.y),
31
- p2: new _Point.Point(rect.x + rect.width, rect.y)
32
- },
33
- // Right edge
34
- {
35
- p1: new _Point.Point(rect.x + rect.width, rect.y),
36
- p2: new _Point.Point(rect.x + rect.width, rect.y + rect.height)
37
- },
38
- // Bottom edge
39
- {
40
- p1: new _Point.Point(rect.x, rect.y + rect.height),
41
- p2: new _Point.Point(rect.x + rect.width, rect.y + rect.height)
42
- },
43
- // Left edge
44
- {
45
- p1: new _Point.Point(rect.x, rect.y),
46
- p2: new _Point.Point(rect.x, rect.y + rect.height)
47
- }];
48
-
49
- // Check intersection with each edge
50
- for (const edge of edges) {
51
- const intersection = this.lineIntersection(this.start, this.end, edge.p1, edge.p2);
52
- if (intersection) {
53
- intersections.push(intersection);
54
- }
55
- }
56
- return intersections;
57
- }
58
-
59
- /**
60
- * Calculate intersection point between two line segments
61
- * Returns null if lines don't intersect
62
- */
63
- lineIntersection(p1, p2, p3, p4) {
64
- const x1 = p1.x,
65
- y1 = p1.y;
66
- const x2 = p2.x,
67
- y2 = p2.y;
68
- const x3 = p3.x,
69
- y3 = p3.y;
70
- const x4 = p4.x,
71
- y4 = p4.y;
72
- const denom = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
73
-
74
- // Lines are parallel
75
- if (Math.abs(denom) < 1e-10) {
76
- return null;
77
- }
78
- const t = ((x1 - x3) * (y3 - y4) - (y1 - y3) * (x3 - x4)) / denom;
79
- const u = -((x1 - x2) * (y1 - y3) - (y1 - y2) * (x1 - x3)) / denom;
80
-
81
- // Check if intersection is within both line segments
82
- if (t >= 0 && t <= 1 && u >= 0 && u <= 1) {
83
- return new _Point.Point(x1 + t * (x2 - x1), y1 + t * (y2 - y1));
84
- }
85
- return null;
86
- }
87
- }
88
- exports.Line = Line;
@@ -1,49 +0,0 @@
1
- /**
2
- * Point class representing a 2D coordinate
3
- */
4
- export declare class Point {
5
- x: number;
6
- y: number;
7
- constructor(x: number, y: number);
8
- /**
9
- * Create a copy of this point
10
- */
11
- clone(): Point;
12
- /**
13
- * Check if this point equals another point
14
- */
15
- equals(other: Point): boolean;
16
- /**
17
- * Translate this point by dx and dy
18
- */
19
- translate(dx: number, dy: number): Point;
20
- /**
21
- * Round coordinates to specified precision
22
- */
23
- round(precision: number): Point;
24
- /**
25
- * Calculate Manhattan distance to another point
26
- */
27
- manhattanDistance(other: Point): number;
28
- /**
29
- * Calculate angle (in degrees) from this point to another point
30
- */
31
- theta(other: Point): number;
32
- /**
33
- * Calculate the difference vector from this point to another
34
- */
35
- diff(other: Point): Point;
36
- /**
37
- * Convert point to string representation
38
- */
39
- toString(): string;
40
- /**
41
- * Snap point to grid
42
- */
43
- snapToGrid(gridSize: number): Point;
44
- /**
45
- * Calculate squared distance to another point (for performance)
46
- */
47
- squaredDistance(other: Point): number;
48
- }
49
- //# sourceMappingURL=Point.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Point.d.ts","sourceRoot":"","sources":["../../src/geometry/Point.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,KAAK;IAChB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;gBAEG,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAKhC;;OAEG;IACH,KAAK,IAAI,KAAK;IAId;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IAI7B;;OAEG;IACH,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,KAAK;IAIxC;;OAEG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK;IAQ/B;;OAEG;IACH,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAIvC;;OAEG;IACH,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAO3B;;OAEG;IACH,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK;IAIzB;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK;IAOnC;;OAEG;IACH,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;CAKtC"}
@@ -1,94 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Point = void 0;
7
- /**
8
- * Point class representing a 2D coordinate
9
- */
10
- class Point {
11
- x;
12
- y;
13
- constructor(x, y) {
14
- this.x = x;
15
- this.y = y;
16
- }
17
-
18
- /**
19
- * Create a copy of this point
20
- */
21
- clone() {
22
- return new Point(this.x, this.y);
23
- }
24
-
25
- /**
26
- * Check if this point equals another point
27
- */
28
- equals(other) {
29
- return this.x === other.x && this.y === other.y;
30
- }
31
-
32
- /**
33
- * Translate this point by dx and dy
34
- */
35
- translate(dx, dy) {
36
- return new Point(this.x + dx, this.y + dy);
37
- }
38
-
39
- /**
40
- * Round coordinates to specified precision
41
- */
42
- round(precision) {
43
- const factor = Math.pow(10, precision);
44
- return new Point(Math.round(this.x * factor) / factor, Math.round(this.y * factor) / factor);
45
- }
46
-
47
- /**
48
- * Calculate Manhattan distance to another point
49
- */
50
- manhattanDistance(other) {
51
- return Math.abs(this.x - other.x) + Math.abs(this.y - other.y);
52
- }
53
-
54
- /**
55
- * Calculate angle (in degrees) from this point to another point
56
- */
57
- theta(other) {
58
- const dx = other.x - this.x;
59
- const dy = other.y - this.y;
60
- const radians = Math.atan2(dy, dx);
61
- return radians * 180 / Math.PI;
62
- }
63
-
64
- /**
65
- * Calculate the difference vector from this point to another
66
- */
67
- diff(other) {
68
- return new Point(other.x - this.x, other.y - this.y);
69
- }
70
-
71
- /**
72
- * Convert point to string representation
73
- */
74
- toString() {
75
- return `${this.x}@${this.y}`;
76
- }
77
-
78
- /**
79
- * Snap point to grid
80
- */
81
- snapToGrid(gridSize) {
82
- return new Point(Math.round(this.x / gridSize) * gridSize, Math.round(this.y / gridSize) * gridSize);
83
- }
84
-
85
- /**
86
- * Calculate squared distance to another point (for performance)
87
- */
88
- squaredDistance(other) {
89
- const dx = other.x - this.x;
90
- const dy = other.y - this.y;
91
- return dx * dx + dy * dy;
92
- }
93
- }
94
- exports.Point = Point;
@@ -1,41 +0,0 @@
1
- import { Point } from './Point';
2
- /**
3
- * Rectangle class representing a bounding box
4
- */
5
- export declare class Rectangle {
6
- x: number;
7
- y: number;
8
- width: number;
9
- height: number;
10
- constructor(x: number, y: number, width: number, height: number);
11
- /**
12
- * Create a copy of this rectangle
13
- */
14
- clone(): Rectangle;
15
- /**
16
- * Get the center point of the rectangle
17
- */
18
- getCenter(): Point;
19
- /**
20
- * Get the origin (top-left) point of the rectangle
21
- */
22
- getOrigin(): Point;
23
- /**
24
- * Get the corner (bottom-right) point of the rectangle
25
- */
26
- getCorner(): Point;
27
- /**
28
- * Check if a point is contained within this rectangle (interior only, excluding edges)
29
- */
30
- containsPoint(point: Point): boolean;
31
- /**
32
- * Move and expand the rectangle by a box offset
33
- */
34
- moveAndExpand(box: {
35
- x: number;
36
- y: number;
37
- width: number;
38
- height: number;
39
- }): Rectangle;
40
- }
41
- //# sourceMappingURL=Rectangle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Rectangle.d.ts","sourceRoot":"","sources":["../../src/geometry/Rectangle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B;;GAEG;AACH,qBAAa,SAAS;IACpB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;gBAEF,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAO/D;;OAEG;IACH,KAAK,IAAI,SAAS;IAIlB;;OAEG;IACH,SAAS,IAAI,KAAK;IAOlB;;OAEG;IACH,SAAS,IAAI,KAAK;IAIlB;;OAEG;IACH,SAAS,IAAI,KAAK;IAIlB;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IASpC;;OAEG;IACH,aAAa,CAAC,GAAG,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS;CAQvF"}
@@ -1,65 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Rectangle = void 0;
7
- var _Point = require("./Point");
8
- /**
9
- * Rectangle class representing a bounding box
10
- */
11
- class Rectangle {
12
- x;
13
- y;
14
- width;
15
- height;
16
- constructor(x, y, width, height) {
17
- this.x = x;
18
- this.y = y;
19
- this.width = width;
20
- this.height = height;
21
- }
22
-
23
- /**
24
- * Create a copy of this rectangle
25
- */
26
- clone() {
27
- return new Rectangle(this.x, this.y, this.width, this.height);
28
- }
29
-
30
- /**
31
- * Get the center point of the rectangle
32
- */
33
- getCenter() {
34
- return new _Point.Point(this.x + this.width / 2, this.y + this.height / 2);
35
- }
36
-
37
- /**
38
- * Get the origin (top-left) point of the rectangle
39
- */
40
- getOrigin() {
41
- return new _Point.Point(this.x, this.y);
42
- }
43
-
44
- /**
45
- * Get the corner (bottom-right) point of the rectangle
46
- */
47
- getCorner() {
48
- return new _Point.Point(this.x + this.width, this.y + this.height);
49
- }
50
-
51
- /**
52
- * Check if a point is contained within this rectangle (interior only, excluding edges)
53
- */
54
- containsPoint(point) {
55
- return point.x > this.x && point.x < this.x + this.width && point.y > this.y && point.y < this.y + this.height;
56
- }
57
-
58
- /**
59
- * Move and expand the rectangle by a box offset
60
- */
61
- moveAndExpand(box) {
62
- return new Rectangle(this.x + box.x, this.y + box.y, this.width + box.width, this.height + box.height);
63
- }
64
- }
65
- exports.Rectangle = Rectangle;
@@ -1,15 +0,0 @@
1
- import { Point } from './Point';
2
- import { Rectangle } from './Rectangle';
3
- /**
4
- * Check if a line segment intersects with a rectangle
5
- */
6
- export declare function lineSegmentIntersectsRect(p1: Point, p2: Point, rect: Rectangle): boolean;
7
- /**
8
- * Check if a line segment crosses through a rectangle (not just touching edges)
9
- */
10
- export declare function lineSegmentCrossesRect(p1: Point, p2: Point, rect: Rectangle): boolean;
11
- /**
12
- * Check if two line segments intersect
13
- */
14
- export declare function lineSegmentsIntersect(p1: Point, p2: Point, p3: Point, p4: Point): boolean;
15
- //# sourceMappingURL=collision.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"collision.d.ts","sourceRoot":"","sources":["../../src/geometry/collision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAwBxF;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAsBrF;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,GAAG,OAAO,CAgBzF"}
@@ -1,81 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.lineSegmentCrossesRect = lineSegmentCrossesRect;
7
- exports.lineSegmentIntersectsRect = lineSegmentIntersectsRect;
8
- exports.lineSegmentsIntersect = lineSegmentsIntersect;
9
- var _Point = require("./Point");
10
- /**
11
- * Check if a line segment intersects with a rectangle
12
- */
13
- function lineSegmentIntersectsRect(p1, p2, rect) {
14
- // Check if either endpoint is inside the rectangle
15
- if (rect.containsPoint(p1) || rect.containsPoint(p2)) {
16
- return true;
17
- }
18
-
19
- // Check if line segment intersects any of the rectangle's edges
20
- const rectPoints = [new _Point.Point(rect.x, rect.y), new _Point.Point(rect.x + rect.width, rect.y), new _Point.Point(rect.x + rect.width, rect.y + rect.height), new _Point.Point(rect.x, rect.y + rect.height)];
21
- for (let i = 0; i < 4; i++) {
22
- const r1 = rectPoints[i];
23
- const r2 = rectPoints[(i + 1) % 4];
24
- if (lineSegmentsIntersect(p1, p2, r1, r2)) {
25
- return true;
26
- }
27
- }
28
- return false;
29
- }
30
-
31
- /**
32
- * Check if a line segment crosses through a rectangle (not just touching edges)
33
- */
34
- function lineSegmentCrossesRect(p1, p2, rect) {
35
- const tolerance = 1;
36
-
37
- // Check if segment passes through the interior of the rectangle
38
- // We sample points along the segment and check if any are strictly inside
39
- const steps = 10;
40
- for (let i = 1; i < steps; i++) {
41
- const t = i / steps;
42
- const x = p1.x + (p2.x - p1.x) * t;
43
- const y = p1.y + (p2.y - p1.y) * t;
44
- if (x > rect.x + tolerance && x < rect.x + rect.width - tolerance && y > rect.y + tolerance && y < rect.y + rect.height - tolerance) {
45
- return true;
46
- }
47
- }
48
- return false;
49
- }
50
-
51
- /**
52
- * Check if two line segments intersect
53
- */
54
- function lineSegmentsIntersect(p1, p2, p3, p4) {
55
- const d1 = direction(p3, p4, p1);
56
- const d2 = direction(p3, p4, p2);
57
- const d3 = direction(p1, p2, p3);
58
- const d4 = direction(p1, p2, p4);
59
- if ((d1 > 0 && d2 < 0 || d1 < 0 && d2 > 0) && (d3 > 0 && d4 < 0 || d3 < 0 && d4 > 0)) {
60
- return true;
61
- }
62
- if (d1 === 0 && onSegment(p3, p1, p4)) return true;
63
- if (d2 === 0 && onSegment(p3, p2, p4)) return true;
64
- if (d3 === 0 && onSegment(p1, p3, p2)) return true;
65
- if (d4 === 0 && onSegment(p1, p4, p2)) return true;
66
- return false;
67
- }
68
-
69
- /**
70
- * Calculate direction of point p3 relative to line p1-p2
71
- */
72
- function direction(p1, p2, p3) {
73
- return (p3.x - p1.x) * (p2.y - p1.y) - (p2.x - p1.x) * (p3.y - p1.y);
74
- }
75
-
76
- /**
77
- * Check if point p2 is on line segment p1-p3
78
- */
79
- function onSegment(p1, p2, p3) {
80
- return p2.x >= Math.min(p1.x, p3.x) && p2.x <= Math.max(p1.x, p3.x) && p2.y >= Math.min(p1.y, p3.y) && p2.y <= Math.max(p1.y, p3.y);
81
- }
@@ -1,5 +0,0 @@
1
- export { Point } from './Point';
2
- export { Rectangle } from './Rectangle';
3
- export { Line } from './Line';
4
- export { lineSegmentIntersectsRect, lineSegmentCrossesRect, lineSegmentsIntersect } from './collision';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/geometry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA"}
@@ -1,45 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Line", {
7
- enumerable: true,
8
- get: function () {
9
- return _Line.Line;
10
- }
11
- });
12
- Object.defineProperty(exports, "Point", {
13
- enumerable: true,
14
- get: function () {
15
- return _Point.Point;
16
- }
17
- });
18
- Object.defineProperty(exports, "Rectangle", {
19
- enumerable: true,
20
- get: function () {
21
- return _Rectangle.Rectangle;
22
- }
23
- });
24
- Object.defineProperty(exports, "lineSegmentCrossesRect", {
25
- enumerable: true,
26
- get: function () {
27
- return _collision.lineSegmentCrossesRect;
28
- }
29
- });
30
- Object.defineProperty(exports, "lineSegmentIntersectsRect", {
31
- enumerable: true,
32
- get: function () {
33
- return _collision.lineSegmentIntersectsRect;
34
- }
35
- });
36
- Object.defineProperty(exports, "lineSegmentsIntersect", {
37
- enumerable: true,
38
- get: function () {
39
- return _collision.lineSegmentsIntersect;
40
- }
41
- });
42
- var _Point = require("./Point");
43
- var _Rectangle = require("./Rectangle");
44
- var _Line = require("./Line");
45
- var _collision = require("./collision");
@@ -1,53 +0,0 @@
1
- import { Position } from '@xyflow/react';
2
- import type { ManhattanRouterOptions, NodeLookup } from './options';
3
- /**
4
- * Parameters for getManHattanPath function
5
- */
6
- export interface GetManHattanPathParams {
7
- /**
8
- * Source node ID
9
- */
10
- sourceNodeId: string;
11
- /**
12
- * Target node ID
13
- */
14
- targetNodeId: string;
15
- sourceX: number;
16
- sourceY: number;
17
- targetX: number;
18
- targetY: number;
19
- sourcePosition: Position;
20
- targetPosition: Position;
21
- /**
22
- * ReactFlow node lookup map
23
- */
24
- nodeLookup: NodeLookup;
25
- /**
26
- * Router options
27
- */
28
- options?: ManhattanRouterOptions;
29
- }
30
- /**
31
- * Generate Manhattan-routed path for ReactFlow edges
32
- *
33
- * @param params - Path generation parameters
34
- * @returns SVG path string that can be used with ReactFlow's BaseEdge
35
- *
36
- * @example
37
- * ```typescript
38
- * const path = getManHattanPath({
39
- * sourceNodeId: 'node1',
40
- * targetNodeId: 'node2',
41
- * sourcePosition: { x: 100, y: 100 },
42
- * targetPosition: { x: 300, y: 300 },
43
- * nodeLookup: nodes,
44
- * options: {
45
- * step: 10,
46
- * startDirections: ['bottom'],
47
- * endDirections: ['top']
48
- * }
49
- * })
50
- * ```
51
- */
52
- export declare function getManHattanPath(params: GetManHattanPathParams): string;
53
- //# sourceMappingURL=getManHattanPath.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getManHattanPath.d.ts","sourceRoot":"","sources":["../src/getManHattanPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,QAAQ,EAAE,MAAM,eAAe,CAAA;AAG3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,UAAU,EAAa,MAAM,WAAW,CAAA;AAM9E;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,YAAY,EAAE,MAAM,CAAA;IAEpB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAEhB,cAAc,EAAE,QAAQ,CAAC;IACzB,cAAc,EAAE,QAAQ,CAAC;IACzB;;OAEG;IACH,UAAU,EAAE,UAAU,CAAA;IAEtB;;OAEG;IACH,OAAO,CAAC,EAAE,sBAAsB,CAAA;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,CAgbvE"}