@rxflow/manhattan 0.0.2 → 0.0.3

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 (176) hide show
  1. package/cjs/geometry/Line.d.ts +21 -0
  2. package/cjs/geometry/Line.d.ts.map +1 -0
  3. package/cjs/geometry/Line.js +88 -0
  4. package/cjs/geometry/Point.d.ts +49 -0
  5. package/cjs/geometry/Point.d.ts.map +1 -0
  6. package/cjs/geometry/Point.js +94 -0
  7. package/cjs/geometry/Rectangle.d.ts +41 -0
  8. package/cjs/geometry/Rectangle.d.ts.map +1 -0
  9. package/cjs/geometry/Rectangle.js +65 -0
  10. package/cjs/geometry/collision.d.ts +15 -0
  11. package/cjs/geometry/collision.d.ts.map +1 -0
  12. package/cjs/geometry/collision.js +81 -0
  13. package/cjs/geometry/index.d.ts +5 -0
  14. package/cjs/geometry/index.d.ts.map +1 -0
  15. package/cjs/geometry/index.js +45 -0
  16. package/cjs/getManHattanPath.d.ts +53 -0
  17. package/cjs/getManHattanPath.d.ts.map +1 -0
  18. package/cjs/getManHattanPath.js +449 -0
  19. package/cjs/index.d.ts +16 -0
  20. package/cjs/index.d.ts.map +1 -0
  21. package/cjs/index.js +117 -0
  22. package/cjs/obstacle/ObstacleMap.d.ts +66 -0
  23. package/cjs/obstacle/ObstacleMap.d.ts.map +1 -0
  24. package/cjs/obstacle/ObstacleMap.js +328 -0
  25. package/cjs/obstacle/QuadTree.d.ts +119 -0
  26. package/cjs/obstacle/QuadTree.d.ts.map +1 -0
  27. package/cjs/obstacle/QuadTree.js +334 -0
  28. package/cjs/obstacle/index.d.ts +2 -0
  29. package/cjs/obstacle/index.d.ts.map +1 -0
  30. package/cjs/obstacle/index.js +12 -0
  31. package/cjs/options/defaults.d.ts +16 -0
  32. package/cjs/options/defaults.d.ts.map +1 -0
  33. package/cjs/options/defaults.js +39 -0
  34. package/cjs/options/index.d.ts +4 -0
  35. package/cjs/options/index.d.ts.map +1 -0
  36. package/cjs/options/index.js +38 -0
  37. package/cjs/options/resolver.d.ts +10 -0
  38. package/cjs/options/resolver.d.ts.map +1 -0
  39. package/cjs/options/resolver.js +248 -0
  40. package/cjs/options/types.d.ts +210 -0
  41. package/cjs/options/types.d.ts.map +1 -0
  42. package/cjs/options/types.js +5 -0
  43. package/cjs/pathfinder/PathCache.d.ts +92 -0
  44. package/cjs/pathfinder/PathCache.d.ts.map +1 -0
  45. package/cjs/pathfinder/PathCache.js +249 -0
  46. package/cjs/pathfinder/SortedSet.d.ts +35 -0
  47. package/cjs/pathfinder/SortedSet.d.ts.map +1 -0
  48. package/cjs/pathfinder/SortedSet.js +95 -0
  49. package/cjs/pathfinder/findRoute.d.ts +8 -0
  50. package/cjs/pathfinder/findRoute.d.ts.map +1 -0
  51. package/cjs/pathfinder/findRoute.js +395 -0
  52. package/cjs/pathfinder/index.d.ts +4 -0
  53. package/cjs/pathfinder/index.d.ts.map +1 -0
  54. package/cjs/pathfinder/index.js +44 -0
  55. package/cjs/svg/index.d.ts +3 -0
  56. package/cjs/svg/index.d.ts.map +1 -0
  57. package/cjs/svg/index.js +31 -0
  58. package/cjs/svg/pathConverter.d.ts +23 -0
  59. package/cjs/svg/pathConverter.d.ts.map +1 -0
  60. package/cjs/svg/pathConverter.js +285 -0
  61. package/cjs/svg/pathParser.d.ts +11 -0
  62. package/cjs/svg/pathParser.d.ts.map +1 -0
  63. package/cjs/svg/pathParser.js +76 -0
  64. package/cjs/utils/AdaptiveStepCalculator.d.ts +90 -0
  65. package/cjs/utils/AdaptiveStepCalculator.d.ts.map +1 -0
  66. package/cjs/utils/AdaptiveStepCalculator.js +224 -0
  67. package/cjs/utils/ErrorRecovery.d.ts +182 -0
  68. package/cjs/utils/ErrorRecovery.d.ts.map +1 -0
  69. package/cjs/utils/ErrorRecovery.js +413 -0
  70. package/cjs/utils/GlobalGrid.d.ts +99 -0
  71. package/cjs/utils/GlobalGrid.d.ts.map +1 -0
  72. package/cjs/utils/GlobalGrid.js +224 -0
  73. package/cjs/utils/PerformanceMonitor.d.ts +139 -0
  74. package/cjs/utils/PerformanceMonitor.d.ts.map +1 -0
  75. package/cjs/utils/PerformanceMonitor.js +305 -0
  76. package/cjs/utils/direction.d.ts +24 -0
  77. package/cjs/utils/direction.d.ts.map +1 -0
  78. package/cjs/utils/direction.js +54 -0
  79. package/cjs/utils/getAnchorPoints.d.ts +15 -0
  80. package/cjs/utils/getAnchorPoints.d.ts.map +1 -0
  81. package/cjs/utils/getAnchorPoints.js +71 -0
  82. package/cjs/utils/grid.d.ts +42 -0
  83. package/cjs/utils/grid.d.ts.map +1 -0
  84. package/cjs/utils/grid.js +73 -0
  85. package/cjs/utils/heuristics.d.ts +61 -0
  86. package/cjs/utils/heuristics.d.ts.map +1 -0
  87. package/cjs/utils/heuristics.js +141 -0
  88. package/cjs/utils/index.d.ts +14 -0
  89. package/cjs/utils/index.d.ts.map +1 -0
  90. package/cjs/utils/index.js +148 -0
  91. package/cjs/utils/node.d.ts +27 -0
  92. package/cjs/utils/node.d.ts.map +1 -0
  93. package/cjs/utils/node.js +36 -0
  94. package/cjs/utils/pathProcessing.d.ts +45 -0
  95. package/cjs/utils/pathProcessing.d.ts.map +1 -0
  96. package/cjs/utils/pathProcessing.js +270 -0
  97. package/cjs/utils/pathValidation.d.ts +11 -0
  98. package/cjs/utils/pathValidation.d.ts.map +1 -0
  99. package/cjs/utils/pathValidation.js +129 -0
  100. package/cjs/utils/rect.d.ts +9 -0
  101. package/cjs/utils/rect.d.ts.map +1 -0
  102. package/cjs/utils/rect.js +110 -0
  103. package/cjs/utils/route.d.ts +19 -0
  104. package/cjs/utils/route.d.ts.map +1 -0
  105. package/cjs/utils/route.js +92 -0
  106. package/esm/geometry/Line.d.ts +21 -0
  107. package/esm/geometry/Line.d.ts.map +1 -0
  108. package/esm/geometry/Point.d.ts +49 -0
  109. package/esm/geometry/Point.d.ts.map +1 -0
  110. package/esm/geometry/Rectangle.d.ts +41 -0
  111. package/esm/geometry/Rectangle.d.ts.map +1 -0
  112. package/esm/geometry/collision.d.ts +15 -0
  113. package/esm/geometry/collision.d.ts.map +1 -0
  114. package/esm/geometry/index.d.ts +5 -0
  115. package/esm/geometry/index.d.ts.map +1 -0
  116. package/esm/getManHattanPath.d.ts +53 -0
  117. package/esm/getManHattanPath.d.ts.map +1 -0
  118. package/esm/index.d.ts +16 -0
  119. package/esm/index.d.ts.map +1 -0
  120. package/esm/obstacle/ObstacleMap.d.ts +66 -0
  121. package/esm/obstacle/ObstacleMap.d.ts.map +1 -0
  122. package/esm/obstacle/QuadTree.d.ts +119 -0
  123. package/esm/obstacle/QuadTree.d.ts.map +1 -0
  124. package/esm/obstacle/index.d.ts +2 -0
  125. package/esm/obstacle/index.d.ts.map +1 -0
  126. package/esm/options/defaults.d.ts +16 -0
  127. package/esm/options/defaults.d.ts.map +1 -0
  128. package/esm/options/index.d.ts +4 -0
  129. package/esm/options/index.d.ts.map +1 -0
  130. package/esm/options/resolver.d.ts +10 -0
  131. package/esm/options/resolver.d.ts.map +1 -0
  132. package/esm/options/types.d.ts +210 -0
  133. package/esm/options/types.d.ts.map +1 -0
  134. package/esm/pathfinder/PathCache.d.ts +92 -0
  135. package/esm/pathfinder/PathCache.d.ts.map +1 -0
  136. package/esm/pathfinder/SortedSet.d.ts +35 -0
  137. package/esm/pathfinder/SortedSet.d.ts.map +1 -0
  138. package/esm/pathfinder/findRoute.d.ts +8 -0
  139. package/esm/pathfinder/findRoute.d.ts.map +1 -0
  140. package/esm/pathfinder/index.d.ts +4 -0
  141. package/esm/pathfinder/index.d.ts.map +1 -0
  142. package/esm/svg/index.d.ts +3 -0
  143. package/esm/svg/index.d.ts.map +1 -0
  144. package/esm/svg/pathConverter.d.ts +23 -0
  145. package/esm/svg/pathConverter.d.ts.map +1 -0
  146. package/esm/svg/pathParser.d.ts +11 -0
  147. package/esm/svg/pathParser.d.ts.map +1 -0
  148. package/esm/utils/AdaptiveStepCalculator.d.ts +90 -0
  149. package/esm/utils/AdaptiveStepCalculator.d.ts.map +1 -0
  150. package/esm/utils/ErrorRecovery.d.ts +182 -0
  151. package/esm/utils/ErrorRecovery.d.ts.map +1 -0
  152. package/esm/utils/GlobalGrid.d.ts +99 -0
  153. package/esm/utils/GlobalGrid.d.ts.map +1 -0
  154. package/esm/utils/PerformanceMonitor.d.ts +139 -0
  155. package/esm/utils/PerformanceMonitor.d.ts.map +1 -0
  156. package/esm/utils/direction.d.ts +24 -0
  157. package/esm/utils/direction.d.ts.map +1 -0
  158. package/esm/utils/getAnchorPoints.d.ts +15 -0
  159. package/esm/utils/getAnchorPoints.d.ts.map +1 -0
  160. package/esm/utils/grid.d.ts +42 -0
  161. package/esm/utils/grid.d.ts.map +1 -0
  162. package/esm/utils/heuristics.d.ts +61 -0
  163. package/esm/utils/heuristics.d.ts.map +1 -0
  164. package/esm/utils/index.d.ts +14 -0
  165. package/esm/utils/index.d.ts.map +1 -0
  166. package/esm/utils/node.d.ts +27 -0
  167. package/esm/utils/node.d.ts.map +1 -0
  168. package/esm/utils/pathProcessing.d.ts +45 -0
  169. package/esm/utils/pathProcessing.d.ts.map +1 -0
  170. package/esm/utils/pathValidation.d.ts +11 -0
  171. package/esm/utils/pathValidation.d.ts.map +1 -0
  172. package/esm/utils/rect.d.ts +9 -0
  173. package/esm/utils/rect.d.ts.map +1 -0
  174. package/esm/utils/route.d.ts +19 -0
  175. package/esm/utils/route.d.ts.map +1 -0
  176. package/package.json +1 -1
@@ -0,0 +1,334 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.QuadTree = void 0;
7
+ exports.createQuadTreeFromRects = createQuadTreeFromRects;
8
+ var _geometry = require("../geometry");
9
+ /**
10
+ * QuadTree implementation for efficient spatial queries
11
+ * Feature: manhattan-optimization
12
+ *
13
+ * A QuadTree is a tree data structure that recursively subdivides 2D space
14
+ * into four quadrants. This enables O(log n) spatial queries instead of O(n).
15
+ */
16
+
17
+ /**
18
+ * Item stored in the QuadTree
19
+ */
20
+
21
+ /**
22
+ * QuadTree configuration
23
+ */
24
+
25
+ /**
26
+ * Default QuadTree configuration
27
+ */
28
+ const DEFAULT_CONFIG = {
29
+ maxItems: 8,
30
+ maxDepth: 8,
31
+ minSize: 10
32
+ };
33
+
34
+ /**
35
+ * QuadTree node for spatial partitioning
36
+ */
37
+ class QuadTree {
38
+ bounds;
39
+ items;
40
+ children;
41
+ depth;
42
+ config;
43
+ constructor(bounds, config = {}, depth = 0) {
44
+ this.bounds = bounds;
45
+ this.items = [];
46
+ this.children = null;
47
+ this.depth = depth;
48
+ this.config = {
49
+ ...DEFAULT_CONFIG,
50
+ ...config
51
+ };
52
+ }
53
+
54
+ /**
55
+ * Insert an item into the QuadTree
56
+ */
57
+ insert(item) {
58
+ // Check if item intersects this node's bounds
59
+ if (!this.intersects(item.bounds)) {
60
+ return false;
61
+ }
62
+
63
+ // If we have children, try to insert into them
64
+ if (this.children !== null) {
65
+ return this.insertIntoChildren(item);
66
+ }
67
+
68
+ // Add to this node
69
+ this.items.push(item);
70
+
71
+ // Check if we need to split
72
+ if (this.shouldSplit()) {
73
+ this.split();
74
+ }
75
+ return true;
76
+ }
77
+
78
+ /**
79
+ * Insert an item with just bounds and data
80
+ */
81
+ insertRect(bounds, data) {
82
+ return this.insert({
83
+ bounds,
84
+ data
85
+ });
86
+ }
87
+
88
+ /**
89
+ * Query all items that intersect with the given bounds
90
+ */
91
+ query(bounds) {
92
+ const results = [];
93
+ this.queryInternal(bounds, results);
94
+ return results;
95
+ }
96
+
97
+ /**
98
+ * Query all items that contain the given point
99
+ */
100
+ queryPoint(point) {
101
+ const results = [];
102
+ this.queryPointInternal(point, results);
103
+ return results;
104
+ }
105
+
106
+ /**
107
+ * Get all items in the tree
108
+ */
109
+ getAllItems() {
110
+ const results = [...this.items];
111
+ if (this.children !== null) {
112
+ for (const child of this.children) {
113
+ results.push(...child.getAllItems());
114
+ }
115
+ }
116
+ return results;
117
+ }
118
+
119
+ /**
120
+ * Clear all items from the tree
121
+ */
122
+ clear() {
123
+ this.items = [];
124
+ this.children = null;
125
+ }
126
+
127
+ /**
128
+ * Get the total number of items in the tree
129
+ */
130
+ get size() {
131
+ let count = this.items.length;
132
+ if (this.children !== null) {
133
+ for (const child of this.children) {
134
+ count += child.size;
135
+ }
136
+ }
137
+ return count;
138
+ }
139
+
140
+ /**
141
+ * Get the depth of the tree
142
+ */
143
+ getMaxDepth() {
144
+ if (this.children === null) {
145
+ return this.depth;
146
+ }
147
+ let maxChildDepth = this.depth;
148
+ for (const child of this.children) {
149
+ maxChildDepth = Math.max(maxChildDepth, child.getMaxDepth());
150
+ }
151
+ return maxChildDepth;
152
+ }
153
+
154
+ /**
155
+ * Internal query implementation
156
+ */
157
+ queryInternal(bounds, results) {
158
+ // Check if query bounds intersects this node
159
+ if (!this.intersects(bounds)) {
160
+ return;
161
+ }
162
+
163
+ // Check items in this node
164
+ for (const item of this.items) {
165
+ if (this.rectanglesIntersect(item.bounds, bounds)) {
166
+ results.push(item);
167
+ }
168
+ }
169
+
170
+ // Query children
171
+ if (this.children !== null) {
172
+ for (const child of this.children) {
173
+ child.queryInternal(bounds, results);
174
+ }
175
+ }
176
+ }
177
+
178
+ /**
179
+ * Internal point query implementation
180
+ */
181
+ queryPointInternal(point, results) {
182
+ // Check if point is within this node's bounds
183
+ if (!this.containsPoint(point)) {
184
+ return;
185
+ }
186
+
187
+ // Check items in this node
188
+ for (const item of this.items) {
189
+ if (item.bounds.containsPoint(point)) {
190
+ results.push(item);
191
+ }
192
+ }
193
+
194
+ // Query children
195
+ if (this.children !== null) {
196
+ for (const child of this.children) {
197
+ child.queryPointInternal(point, results);
198
+ }
199
+ }
200
+ }
201
+
202
+ /**
203
+ * Check if this node should split
204
+ */
205
+ shouldSplit() {
206
+ return this.items.length > this.config.maxItems && this.depth < this.config.maxDepth && this.bounds.width > this.config.minSize * 2 && this.bounds.height > this.config.minSize * 2;
207
+ }
208
+
209
+ /**
210
+ * Split this node into four children
211
+ */
212
+ split() {
213
+ const halfWidth = this.bounds.width / 2;
214
+ const halfHeight = this.bounds.height / 2;
215
+ const x = this.bounds.x;
216
+ const y = this.bounds.y;
217
+ const nextDepth = this.depth + 1;
218
+ this.children = [
219
+ // Top-left
220
+ new QuadTree(new _geometry.Rectangle(x, y, halfWidth, halfHeight), this.config, nextDepth),
221
+ // Top-right
222
+ new QuadTree(new _geometry.Rectangle(x + halfWidth, y, halfWidth, halfHeight), this.config, nextDepth),
223
+ // Bottom-left
224
+ new QuadTree(new _geometry.Rectangle(x, y + halfHeight, halfWidth, halfHeight), this.config, nextDepth),
225
+ // Bottom-right
226
+ new QuadTree(new _geometry.Rectangle(x + halfWidth, y + halfHeight, halfWidth, halfHeight), this.config, nextDepth)];
227
+
228
+ // Redistribute items to children
229
+ const itemsToRedistribute = this.items;
230
+ this.items = [];
231
+ for (const item of itemsToRedistribute) {
232
+ this.insertIntoChildren(item);
233
+ }
234
+ }
235
+
236
+ /**
237
+ * Insert item into appropriate children
238
+ */
239
+ insertIntoChildren(item) {
240
+ if (this.children === null) {
241
+ return false;
242
+ }
243
+ let inserted = false;
244
+ for (const child of this.children) {
245
+ if (child.insert(item)) {
246
+ inserted = true;
247
+ }
248
+ }
249
+
250
+ // If item doesn't fit in any child (spans multiple), keep in this node
251
+ if (!inserted) {
252
+ this.items.push(item);
253
+ inserted = true;
254
+ }
255
+ return inserted;
256
+ }
257
+
258
+ /**
259
+ * Check if a rectangle intersects this node's bounds
260
+ */
261
+ intersects(rect) {
262
+ return this.rectanglesIntersect(this.bounds, rect);
263
+ }
264
+
265
+ /**
266
+ * Check if two rectangles intersect
267
+ */
268
+ rectanglesIntersect(a, b) {
269
+ return !(a.x + a.width <= b.x || b.x + b.width <= a.x || a.y + a.height <= b.y || b.y + b.height <= a.y);
270
+ }
271
+
272
+ /**
273
+ * Check if this node's bounds contain a point
274
+ */
275
+ containsPoint(point) {
276
+ return point.x >= this.bounds.x && point.x <= this.bounds.x + this.bounds.width && point.y >= this.bounds.y && point.y <= this.bounds.y + this.bounds.height;
277
+ }
278
+
279
+ /**
280
+ * Get statistics about the tree
281
+ */
282
+ getStats() {
283
+ const stats = {
284
+ totalItems: 0,
285
+ maxDepth: 0,
286
+ nodeCount: 0,
287
+ itemsPerNode: 0
288
+ };
289
+ this.collectStats(stats);
290
+ stats.itemsPerNode = stats.nodeCount > 0 ? stats.totalItems / stats.nodeCount : 0;
291
+ return stats;
292
+ }
293
+ collectStats(stats) {
294
+ stats.totalItems += this.items.length;
295
+ stats.maxDepth = Math.max(stats.maxDepth, this.depth);
296
+ stats.nodeCount++;
297
+ if (this.children !== null) {
298
+ for (const child of this.children) {
299
+ child.collectStats(stats);
300
+ }
301
+ }
302
+ }
303
+ }
304
+
305
+ /**
306
+ * Create a QuadTree with bounds that cover all given rectangles
307
+ */
308
+ exports.QuadTree = QuadTree;
309
+ function createQuadTreeFromRects(items, config) {
310
+ if (items.length === 0) {
311
+ return new QuadTree(new _geometry.Rectangle(0, 0, 1000, 1000), config);
312
+ }
313
+
314
+ // Calculate bounding box of all items
315
+ let minX = Infinity;
316
+ let minY = Infinity;
317
+ let maxX = -Infinity;
318
+ let maxY = -Infinity;
319
+ for (const item of items) {
320
+ minX = Math.min(minX, item.bounds.x);
321
+ minY = Math.min(minY, item.bounds.y);
322
+ maxX = Math.max(maxX, item.bounds.x + item.bounds.width);
323
+ maxY = Math.max(maxY, item.bounds.y + item.bounds.height);
324
+ }
325
+
326
+ // Add some padding
327
+ const padding = 100;
328
+ const bounds = new _geometry.Rectangle(minX - padding, minY - padding, maxX - minX + padding * 2, maxY - minY + padding * 2);
329
+ const tree = new QuadTree(bounds, config);
330
+ for (const item of items) {
331
+ tree.insert(item);
332
+ }
333
+ return tree;
334
+ }
@@ -0,0 +1,2 @@
1
+ export { ObstacleMap } from './ObstacleMap';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/obstacle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ObstacleMap", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _ObstacleMap.ObstacleMap;
10
+ }
11
+ });
12
+ var _ObstacleMap = require("./ObstacleMap");
@@ -0,0 +1,16 @@
1
+ import { Point } from '../geometry';
2
+ import type { ManhattanRouterOptions } from './types';
3
+ /**
4
+ * Default configuration for Manhattan router
5
+ */
6
+ export declare const defaults: Required<Omit<ManhattanRouterOptions, 'fallbackRoute' | 'sourcePosition' | 'targetPosition' | 'performance' | 'adaptiveStep' | 'debug'>>;
7
+ /**
8
+ * Direction map - maps direction names to unit vectors
9
+ */
10
+ export declare const directionMap: {
11
+ top: Point;
12
+ right: Point;
13
+ bottom: Point;
14
+ left: Point;
15
+ };
16
+ //# sourceMappingURL=defaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/options/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,KAAK,EAAE,sBAAsB,EAAa,MAAM,SAAS,CAAA;AAEhE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,sBAAsB,EAAE,eAAe,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,aAAa,GAAG,cAAc,GAAG,OAAO,CAAC,CAkB7J,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;CAKxB,CAAA"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.directionMap = exports.defaults = void 0;
7
+ var _geometry = require("../geometry");
8
+ /**
9
+ * Default configuration for Manhattan router
10
+ */
11
+ const defaults = exports.defaults = {
12
+ step: 10,
13
+ maxLoopCount: 2000,
14
+ precision: 1,
15
+ maxDirectionChange: 90,
16
+ startDirections: ['top', 'right', 'bottom', 'left'],
17
+ endDirections: ['top', 'right', 'bottom', 'left'],
18
+ excludeNodes: [],
19
+ excludeShapes: [],
20
+ excludeTerminals: [],
21
+ padding: 15,
22
+ borderRadius: 5,
23
+ extensionDistance: 20,
24
+ penalties: {
25
+ 0: 0,
26
+ 45: 5,
27
+ 90: 5
28
+ }
29
+ };
30
+
31
+ /**
32
+ * Direction map - maps direction names to unit vectors
33
+ */
34
+ const directionMap = exports.directionMap = {
35
+ top: new _geometry.Point(0, -1),
36
+ right: new _geometry.Point(1, 0),
37
+ bottom: new _geometry.Point(0, 1),
38
+ left: new _geometry.Point(-1, 0)
39
+ };
@@ -0,0 +1,4 @@
1
+ export * from './types';
2
+ export * from './defaults';
3
+ export * from './resolver';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/options/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _types = require("./types");
7
+ Object.keys(_types).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _types[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _types[key];
14
+ }
15
+ });
16
+ });
17
+ var _defaults = require("./defaults");
18
+ Object.keys(_defaults).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _defaults[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _defaults[key];
25
+ }
26
+ });
27
+ });
28
+ var _resolver = require("./resolver");
29
+ Object.keys(_resolver).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _resolver[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _resolver[key];
36
+ }
37
+ });
38
+ });
@@ -0,0 +1,10 @@
1
+ import type { ManhattanRouterOptions, ResolvedOptions } from './types';
2
+ /**
3
+ * Normalize angle to 0-360 range
4
+ */
5
+ export declare function normalizeAngle(angle: number): number;
6
+ /**
7
+ * Resolve options by merging user options with defaults
8
+ */
9
+ export declare function resolveOptions(options?: ManhattanRouterOptions): ResolvedOptions;
10
+ //# sourceMappingURL=resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/options/resolver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAkC,MAAM,SAAS,CAAA;AAmCtG;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQpD;AAgGD;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,GAAE,sBAA2B,GAAG,eAAe,CA4EpF"}