@rxflow/manhattan 0.0.1-alpha.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.
Files changed (140) hide show
  1. package/README.md +35 -0
  2. package/cjs/geometry/Line.d.ts +21 -0
  3. package/cjs/geometry/Line.d.ts.map +1 -0
  4. package/cjs/geometry/Line.js +88 -0
  5. package/cjs/geometry/Point.d.ts +49 -0
  6. package/cjs/geometry/Point.d.ts.map +1 -0
  7. package/cjs/geometry/Point.js +94 -0
  8. package/cjs/geometry/Rectangle.d.ts +41 -0
  9. package/cjs/geometry/Rectangle.d.ts.map +1 -0
  10. package/cjs/geometry/Rectangle.js +65 -0
  11. package/cjs/geometry/index.d.ts +4 -0
  12. package/cjs/geometry/index.d.ts.map +1 -0
  13. package/cjs/geometry/index.js +26 -0
  14. package/cjs/getManHattanPath.d.ts +60 -0
  15. package/cjs/getManHattanPath.d.ts.map +1 -0
  16. package/cjs/getManHattanPath.js +285 -0
  17. package/cjs/index.d.ts +16 -0
  18. package/cjs/index.d.ts.map +1 -0
  19. package/cjs/index.js +117 -0
  20. package/cjs/obstacle/ObstacleMap.d.ts +28 -0
  21. package/cjs/obstacle/ObstacleMap.d.ts.map +1 -0
  22. package/cjs/obstacle/ObstacleMap.js +171 -0
  23. package/cjs/obstacle/index.d.ts +2 -0
  24. package/cjs/obstacle/index.d.ts.map +1 -0
  25. package/cjs/obstacle/index.js +12 -0
  26. package/cjs/options/defaults.d.ts +16 -0
  27. package/cjs/options/defaults.d.ts.map +1 -0
  28. package/cjs/options/defaults.js +39 -0
  29. package/cjs/options/index.d.ts +4 -0
  30. package/cjs/options/index.d.ts.map +1 -0
  31. package/cjs/options/index.js +38 -0
  32. package/cjs/options/resolver.d.ts +10 -0
  33. package/cjs/options/resolver.d.ts.map +1 -0
  34. package/cjs/options/resolver.js +118 -0
  35. package/cjs/options/types.d.ts +156 -0
  36. package/cjs/options/types.d.ts.map +1 -0
  37. package/cjs/options/types.js +5 -0
  38. package/cjs/pathfinder/SortedSet.d.ts +35 -0
  39. package/cjs/pathfinder/SortedSet.d.ts.map +1 -0
  40. package/cjs/pathfinder/SortedSet.js +95 -0
  41. package/cjs/pathfinder/findRoute.d.ts +8 -0
  42. package/cjs/pathfinder/findRoute.d.ts.map +1 -0
  43. package/cjs/pathfinder/findRoute.js +156 -0
  44. package/cjs/pathfinder/index.d.ts +3 -0
  45. package/cjs/pathfinder/index.d.ts.map +1 -0
  46. package/cjs/pathfinder/index.js +19 -0
  47. package/cjs/svg/index.d.ts +2 -0
  48. package/cjs/svg/index.d.ts.map +1 -0
  49. package/cjs/svg/index.js +18 -0
  50. package/cjs/svg/pathConverter.d.ts +10 -0
  51. package/cjs/svg/pathConverter.d.ts.map +1 -0
  52. package/cjs/svg/pathConverter.js +105 -0
  53. package/cjs/utils/direction.d.ts +24 -0
  54. package/cjs/utils/direction.d.ts.map +1 -0
  55. package/cjs/utils/direction.js +54 -0
  56. package/cjs/utils/grid.d.ts +26 -0
  57. package/cjs/utils/grid.d.ts.map +1 -0
  58. package/cjs/utils/grid.js +78 -0
  59. package/cjs/utils/index.d.ts +6 -0
  60. package/cjs/utils/index.d.ts.map +1 -0
  61. package/cjs/utils/index.js +60 -0
  62. package/cjs/utils/node.d.ts +27 -0
  63. package/cjs/utils/node.d.ts.map +1 -0
  64. package/cjs/utils/node.js +36 -0
  65. package/cjs/utils/rect.d.ts +9 -0
  66. package/cjs/utils/rect.d.ts.map +1 -0
  67. package/cjs/utils/rect.js +103 -0
  68. package/cjs/utils/route.d.ts +19 -0
  69. package/cjs/utils/route.d.ts.map +1 -0
  70. package/cjs/utils/route.js +76 -0
  71. package/esm/geometry/Line.d.ts +21 -0
  72. package/esm/geometry/Line.d.ts.map +1 -0
  73. package/esm/geometry/Line.js +96 -0
  74. package/esm/geometry/Point.d.ts +49 -0
  75. package/esm/geometry/Point.d.ts.map +1 -0
  76. package/esm/geometry/Point.js +117 -0
  77. package/esm/geometry/Rectangle.d.ts +41 -0
  78. package/esm/geometry/Rectangle.d.ts.map +1 -0
  79. package/esm/geometry/Rectangle.js +81 -0
  80. package/esm/geometry/index.d.ts +4 -0
  81. package/esm/geometry/index.d.ts.map +1 -0
  82. package/esm/geometry/index.js +3 -0
  83. package/esm/getManHattanPath.d.ts +60 -0
  84. package/esm/getManHattanPath.d.ts.map +1 -0
  85. package/esm/getManHattanPath.js +291 -0
  86. package/esm/index.d.ts +16 -0
  87. package/esm/index.d.ts.map +1 -0
  88. package/esm/index.js +24 -0
  89. package/esm/obstacle/ObstacleMap.d.ts +28 -0
  90. package/esm/obstacle/ObstacleMap.d.ts.map +1 -0
  91. package/esm/obstacle/ObstacleMap.js +183 -0
  92. package/esm/obstacle/index.d.ts +2 -0
  93. package/esm/obstacle/index.d.ts.map +1 -0
  94. package/esm/obstacle/index.js +1 -0
  95. package/esm/options/defaults.d.ts +16 -0
  96. package/esm/options/defaults.d.ts.map +1 -0
  97. package/esm/options/defaults.js +33 -0
  98. package/esm/options/index.d.ts +4 -0
  99. package/esm/options/index.d.ts.map +1 -0
  100. package/esm/options/index.js +3 -0
  101. package/esm/options/resolver.d.ts +10 -0
  102. package/esm/options/resolver.d.ts.map +1 -0
  103. package/esm/options/resolver.js +114 -0
  104. package/esm/options/types.d.ts +156 -0
  105. package/esm/options/types.d.ts.map +1 -0
  106. package/esm/options/types.js +1 -0
  107. package/esm/pathfinder/SortedSet.d.ts +35 -0
  108. package/esm/pathfinder/SortedSet.d.ts.map +1 -0
  109. package/esm/pathfinder/SortedSet.js +110 -0
  110. package/esm/pathfinder/findRoute.d.ts +8 -0
  111. package/esm/pathfinder/findRoute.d.ts.map +1 -0
  112. package/esm/pathfinder/findRoute.js +189 -0
  113. package/esm/pathfinder/index.d.ts +3 -0
  114. package/esm/pathfinder/index.d.ts.map +1 -0
  115. package/esm/pathfinder/index.js +2 -0
  116. package/esm/svg/index.d.ts +2 -0
  117. package/esm/svg/index.d.ts.map +1 -0
  118. package/esm/svg/index.js +1 -0
  119. package/esm/svg/pathConverter.d.ts +10 -0
  120. package/esm/svg/pathConverter.d.ts.map +1 -0
  121. package/esm/svg/pathConverter.js +107 -0
  122. package/esm/utils/direction.d.ts +24 -0
  123. package/esm/utils/direction.d.ts.map +1 -0
  124. package/esm/utils/direction.js +46 -0
  125. package/esm/utils/grid.d.ts +26 -0
  126. package/esm/utils/grid.d.ts.map +1 -0
  127. package/esm/utils/grid.js +70 -0
  128. package/esm/utils/index.d.ts +6 -0
  129. package/esm/utils/index.d.ts.map +1 -0
  130. package/esm/utils/index.js +5 -0
  131. package/esm/utils/node.d.ts +27 -0
  132. package/esm/utils/node.d.ts.map +1 -0
  133. package/esm/utils/node.js +30 -0
  134. package/esm/utils/rect.d.ts +9 -0
  135. package/esm/utils/rect.d.ts.map +1 -0
  136. package/esm/utils/rect.js +121 -0
  137. package/esm/utils/route.d.ts +19 -0
  138. package/esm/utils/route.d.ts.map +1 -0
  139. package/esm/utils/route.js +80 -0
  140. package/package.json +43 -0
package/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # @rxflow/manhattan
2
+
3
+ Manhattan 路由算法,用于 ReactFlow 生成正交路径,支持障碍物避让。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ npm install @rxflow/manhattan
9
+ # or
10
+ pnpm add @rxflow/manhattan
11
+ ```
12
+
13
+ ## 使用
14
+
15
+ ```tsx
16
+ import { getManHattanPath } from '@rxflow/manhattan';
17
+
18
+ const path = getManHattanPath({
19
+ sourceNodeId: 'node-1',
20
+ targetNodeId: 'node-2',
21
+ nodeLookup,
22
+ // ... other options
23
+ });
24
+ ```
25
+
26
+ ## 特性
27
+
28
+ - A* 寻路算法
29
+ - 正交路径生成
30
+ - 障碍物避让
31
+ - 高性能计算
32
+
33
+ ## License
34
+
35
+ MIT
@@ -0,0 +1,21 @@
1
+ import { Point } from './Point';
2
+ import { Rectangle } from './Rectangle';
3
+ /**
4
+ * Line class representing a line segment
5
+ */
6
+ export declare class Line {
7
+ start: Point;
8
+ end: Point;
9
+ constructor(start: Point, end: Point);
10
+ /**
11
+ * Calculate intersection points with a rectangle
12
+ * Returns an array of intersection points
13
+ */
14
+ intersect(rect: Rectangle): Point[];
15
+ /**
16
+ * Calculate intersection point between two line segments
17
+ * Returns null if lines don't intersect
18
+ */
19
+ private lineIntersection;
20
+ }
21
+ //# sourceMappingURL=Line.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Line.d.ts","sourceRoot":"","sources":["../../src/geometry/Line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC;;GAEG;AACH,qBAAa,IAAI;IACf,KAAK,EAAE,KAAK,CAAA;IACZ,GAAG,EAAE,KAAK,CAAA;gBAEE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK;IAKpC;;;OAGG;IACH,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,KAAK,EAAE;IA+BnC;;;OAGG;IACH,OAAO,CAAC,gBAAgB;CA+BzB"}
@@ -0,0 +1,88 @@
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;
@@ -0,0 +1,49 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,94 @@
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;
@@ -0,0 +1,41 @@
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
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,65 @@
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
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;
@@ -0,0 +1,4 @@
1
+ export { Point } from './Point';
2
+ export { Rectangle } from './Rectangle';
3
+ export { Line } from './Line';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,26 @@
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
+ var _Point = require("./Point");
25
+ var _Rectangle = require("./Rectangle");
26
+ var _Line = require("./Line");
@@ -0,0 +1,60 @@
1
+ import type { ManhattanRouterOptions, NodeLookup } from './options';
2
+ /**
3
+ * Parameters for getManHattanPath function
4
+ */
5
+ export interface GetManHattanPathParams {
6
+ /**
7
+ * Source node ID
8
+ */
9
+ sourceNodeId: string;
10
+ /**
11
+ * Target node ID
12
+ */
13
+ targetNodeId: string;
14
+ /**
15
+ * Source anchor position (where the edge starts)
16
+ */
17
+ sourcePosition: {
18
+ x: number;
19
+ y: number;
20
+ };
21
+ /**
22
+ * Target anchor position (where the edge ends)
23
+ */
24
+ targetPosition: {
25
+ x: number;
26
+ y: number;
27
+ };
28
+ /**
29
+ * ReactFlow node lookup map
30
+ */
31
+ nodeLookup: NodeLookup;
32
+ /**
33
+ * Router options
34
+ */
35
+ options?: ManhattanRouterOptions;
36
+ }
37
+ /**
38
+ * Generate Manhattan-routed path for ReactFlow edges
39
+ *
40
+ * @param params - Path generation parameters
41
+ * @returns SVG path string that can be used with ReactFlow's BaseEdge
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const path = getManHattanPath({
46
+ * sourceNodeId: 'node1',
47
+ * targetNodeId: 'node2',
48
+ * sourcePosition: { x: 100, y: 100 },
49
+ * targetPosition: { x: 300, y: 300 },
50
+ * nodeLookup: nodes,
51
+ * options: {
52
+ * step: 10,
53
+ * startDirections: ['bottom'],
54
+ * endDirections: ['top']
55
+ * }
56
+ * })
57
+ * ```
58
+ */
59
+ export declare function getManHattanPath(params: GetManHattanPathParams): string;
60
+ //# sourceMappingURL=getManHattanPath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getManHattanPath.d.ts","sourceRoot":"","sources":["../src/getManHattanPath.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAOnE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,YAAY,EAAE,MAAM,CAAA;IAEpB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAA;IAEpB;;OAEG;IACH,cAAc,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAExC;;OAEG;IACH,cAAc,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAExC;;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,CA4PvE"}