@esengine/pathfinding 1.0.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.
@@ -0,0 +1,740 @@
1
+ import { BlueprintNodeTemplate, INodeExecutor, BlueprintNode, ExecutionResult } from '@esengine/blueprint';
2
+
3
+ /**
4
+ * @zh 寻路系统核心接口
5
+ * @en Pathfinding System Core Interfaces
6
+ */
7
+ /**
8
+ * @zh 2D 坐标点
9
+ * @en 2D coordinate point
10
+ */
11
+ interface IPoint {
12
+ readonly x: number;
13
+ readonly y: number;
14
+ }
15
+ /**
16
+ * @zh 创建点
17
+ * @en Create a point
18
+ */
19
+ declare function createPoint(x: number, y: number): IPoint;
20
+ /**
21
+ * @zh 路径节点
22
+ * @en Path node
23
+ */
24
+ interface IPathNode {
25
+ /** @zh 节点唯一标识 @en Unique node identifier */
26
+ readonly id: string | number;
27
+ /** @zh 节点位置 @en Node position */
28
+ readonly position: IPoint;
29
+ /** @zh 移动代价 @en Movement cost */
30
+ readonly cost: number;
31
+ /** @zh 是否可通行 @en Is walkable */
32
+ readonly walkable: boolean;
33
+ }
34
+ /**
35
+ * @zh 路径结果
36
+ * @en Path result
37
+ */
38
+ interface IPathResult {
39
+ /** @zh 是否找到路径 @en Whether path was found */
40
+ readonly found: boolean;
41
+ /** @zh 路径点列表 @en List of path points */
42
+ readonly path: readonly IPoint[];
43
+ /** @zh 路径总代价 @en Total path cost */
44
+ readonly cost: number;
45
+ /** @zh 搜索的节点数 @en Number of nodes searched */
46
+ readonly nodesSearched: number;
47
+ }
48
+ /**
49
+ * @zh 空路径结果
50
+ * @en Empty path result
51
+ */
52
+ declare const EMPTY_PATH_RESULT: IPathResult;
53
+ /**
54
+ * @zh 寻路地图接口
55
+ * @en Pathfinding map interface
56
+ */
57
+ interface IPathfindingMap {
58
+ /**
59
+ * @zh 获取节点的邻居
60
+ * @en Get neighbors of a node
61
+ */
62
+ getNeighbors(node: IPathNode): IPathNode[];
63
+ /**
64
+ * @zh 获取指定位置的节点
65
+ * @en Get node at position
66
+ */
67
+ getNodeAt(x: number, y: number): IPathNode | null;
68
+ /**
69
+ * @zh 计算两点间的启发式距离
70
+ * @en Calculate heuristic distance between two points
71
+ */
72
+ heuristic(a: IPoint, b: IPoint): number;
73
+ /**
74
+ * @zh 计算两个邻居节点间的移动代价
75
+ * @en Calculate movement cost between two neighbor nodes
76
+ */
77
+ getMovementCost(from: IPathNode, to: IPathNode): number;
78
+ /**
79
+ * @zh 检查位置是否可通行
80
+ * @en Check if position is walkable
81
+ */
82
+ isWalkable(x: number, y: number): boolean;
83
+ }
84
+ /**
85
+ * @zh 启发式函数类型
86
+ * @en Heuristic function type
87
+ */
88
+ type HeuristicFunction = (a: IPoint, b: IPoint) => number;
89
+ /**
90
+ * @zh 曼哈顿距离(4方向移动)
91
+ * @en Manhattan distance (4-directional movement)
92
+ */
93
+ declare function manhattanDistance(a: IPoint, b: IPoint): number;
94
+ /**
95
+ * @zh 欧几里得距离(任意方向移动)
96
+ * @en Euclidean distance (any direction movement)
97
+ */
98
+ declare function euclideanDistance(a: IPoint, b: IPoint): number;
99
+ /**
100
+ * @zh 切比雪夫距离(8方向移动)
101
+ * @en Chebyshev distance (8-directional movement)
102
+ */
103
+ declare function chebyshevDistance(a: IPoint, b: IPoint): number;
104
+ /**
105
+ * @zh 八角距离(8方向移动,对角线代价为 √2)
106
+ * @en Octile distance (8-directional, diagonal cost √2)
107
+ */
108
+ declare function octileDistance(a: IPoint, b: IPoint): number;
109
+ /**
110
+ * @zh 寻路配置
111
+ * @en Pathfinding options
112
+ */
113
+ interface IPathfindingOptions {
114
+ /** @zh 最大搜索节点数 @en Maximum nodes to search */
115
+ maxNodes?: number;
116
+ /** @zh 启发式权重 (>1 更快但可能非最优) @en Heuristic weight (>1 faster but may be suboptimal) */
117
+ heuristicWeight?: number;
118
+ /** @zh 是否允许对角移动 @en Allow diagonal movement */
119
+ allowDiagonal?: boolean;
120
+ /** @zh 是否避免穿角 @en Avoid corner cutting */
121
+ avoidCorners?: boolean;
122
+ }
123
+ /**
124
+ * @zh 默认寻路配置
125
+ * @en Default pathfinding options
126
+ */
127
+ declare const DEFAULT_PATHFINDING_OPTIONS: Required<IPathfindingOptions>;
128
+ /**
129
+ * @zh 寻路器接口
130
+ * @en Pathfinder interface
131
+ */
132
+ interface IPathfinder {
133
+ /**
134
+ * @zh 查找路径
135
+ * @en Find path
136
+ */
137
+ findPath(startX: number, startY: number, endX: number, endY: number, options?: IPathfindingOptions): IPathResult;
138
+ /**
139
+ * @zh 清理状态(用于重用)
140
+ * @en Clear state (for reuse)
141
+ */
142
+ clear(): void;
143
+ }
144
+ /**
145
+ * @zh 路径平滑器接口
146
+ * @en Path smoother interface
147
+ */
148
+ interface IPathSmoother {
149
+ /**
150
+ * @zh 平滑路径
151
+ * @en Smooth path
152
+ */
153
+ smooth(path: readonly IPoint[], map: IPathfindingMap): IPoint[];
154
+ }
155
+ /**
156
+ * @zh 视线检测函数类型
157
+ * @en Line of sight check function type
158
+ */
159
+ type LineOfSightCheck = (x1: number, y1: number, x2: number, y2: number, map: IPathfindingMap) => boolean;
160
+
161
+ /**
162
+ * @zh 二叉堆(优先队列)
163
+ * @en Binary Heap (Priority Queue)
164
+ *
165
+ * @zh 用于 A* 算法的高效开放列表
166
+ * @en Efficient open list for A* algorithm
167
+ */
168
+ declare class BinaryHeap<T> {
169
+ private heap;
170
+ private readonly compare;
171
+ /**
172
+ * @zh 创建二叉堆
173
+ * @en Create binary heap
174
+ *
175
+ * @param compare - @zh 比较函数,返回负数表示 a < b @en Compare function, returns negative if a < b
176
+ */
177
+ constructor(compare: (a: T, b: T) => number);
178
+ /**
179
+ * @zh 堆大小
180
+ * @en Heap size
181
+ */
182
+ get size(): number;
183
+ /**
184
+ * @zh 是否为空
185
+ * @en Is empty
186
+ */
187
+ get isEmpty(): boolean;
188
+ /**
189
+ * @zh 插入元素
190
+ * @en Push element
191
+ */
192
+ push(item: T): void;
193
+ /**
194
+ * @zh 弹出最小元素
195
+ * @en Pop minimum element
196
+ */
197
+ pop(): T | undefined;
198
+ /**
199
+ * @zh 查看最小元素(不移除)
200
+ * @en Peek minimum element (without removing)
201
+ */
202
+ peek(): T | undefined;
203
+ /**
204
+ * @zh 更新元素(重新排序)
205
+ * @en Update element (re-sort)
206
+ */
207
+ update(item: T): void;
208
+ /**
209
+ * @zh 检查是否包含元素
210
+ * @en Check if contains element
211
+ */
212
+ contains(item: T): boolean;
213
+ /**
214
+ * @zh 清空堆
215
+ * @en Clear heap
216
+ */
217
+ clear(): void;
218
+ /**
219
+ * @zh 上浮操作
220
+ * @en Bubble up operation
221
+ */
222
+ private bubbleUp;
223
+ /**
224
+ * @zh 下沉操作
225
+ * @en Sink down operation
226
+ */
227
+ private sinkDown;
228
+ }
229
+
230
+ /**
231
+ * @zh A* 寻路算法实现
232
+ * @en A* Pathfinding Algorithm Implementation
233
+ */
234
+
235
+ /**
236
+ * @zh A* 寻路器
237
+ * @en A* Pathfinder
238
+ *
239
+ * @zh 使用 A* 算法在地图上查找最短路径
240
+ * @en Uses A* algorithm to find shortest path on a map
241
+ *
242
+ * @example
243
+ * ```typescript
244
+ * const map = new GridMap(width, height);
245
+ * const pathfinder = new AStarPathfinder(map);
246
+ * const result = pathfinder.findPath(0, 0, 10, 10);
247
+ * if (result.found) {
248
+ * console.log('Path:', result.path);
249
+ * }
250
+ * ```
251
+ */
252
+ declare class AStarPathfinder implements IPathfinder {
253
+ private readonly map;
254
+ private nodeCache;
255
+ private openList;
256
+ constructor(map: IPathfindingMap);
257
+ /**
258
+ * @zh 查找路径
259
+ * @en Find path
260
+ */
261
+ findPath(startX: number, startY: number, endX: number, endY: number, options?: IPathfindingOptions): IPathResult;
262
+ /**
263
+ * @zh 清理状态
264
+ * @en Clear state
265
+ */
266
+ clear(): void;
267
+ /**
268
+ * @zh 获取或创建 A* 节点
269
+ * @en Get or create A* node
270
+ */
271
+ private getOrCreateAStarNode;
272
+ /**
273
+ * @zh 构建路径结果
274
+ * @en Build path result
275
+ */
276
+ private buildPath;
277
+ }
278
+ /**
279
+ * @zh 创建 A* 寻路器
280
+ * @en Create A* pathfinder
281
+ */
282
+ declare function createAStarPathfinder(map: IPathfindingMap): AStarPathfinder;
283
+
284
+ /**
285
+ * @zh 网格地图实现
286
+ * @en Grid Map Implementation
287
+ */
288
+
289
+ /**
290
+ * @zh 网格节点
291
+ * @en Grid node
292
+ */
293
+ declare class GridNode implements IPathNode {
294
+ readonly id: string;
295
+ readonly position: IPoint;
296
+ readonly x: number;
297
+ readonly y: number;
298
+ cost: number;
299
+ walkable: boolean;
300
+ constructor(x: number, y: number, walkable?: boolean, cost?: number);
301
+ }
302
+ /**
303
+ * @zh 4方向偏移 (上下左右)
304
+ * @en 4-directional offsets (up, down, left, right)
305
+ */
306
+ declare const DIRECTIONS_4: readonly [{
307
+ readonly dx: 0;
308
+ readonly dy: -1;
309
+ }, {
310
+ readonly dx: 1;
311
+ readonly dy: 0;
312
+ }, {
313
+ readonly dx: 0;
314
+ readonly dy: 1;
315
+ }, {
316
+ readonly dx: -1;
317
+ readonly dy: 0;
318
+ }];
319
+ /**
320
+ * @zh 8方向偏移 (含对角线)
321
+ * @en 8-directional offsets (including diagonals)
322
+ */
323
+ declare const DIRECTIONS_8: readonly [{
324
+ readonly dx: 0;
325
+ readonly dy: -1;
326
+ }, {
327
+ readonly dx: 1;
328
+ readonly dy: -1;
329
+ }, {
330
+ readonly dx: 1;
331
+ readonly dy: 0;
332
+ }, {
333
+ readonly dx: 1;
334
+ readonly dy: 1;
335
+ }, {
336
+ readonly dx: 0;
337
+ readonly dy: 1;
338
+ }, {
339
+ readonly dx: -1;
340
+ readonly dy: 1;
341
+ }, {
342
+ readonly dx: -1;
343
+ readonly dy: 0;
344
+ }, {
345
+ readonly dx: -1;
346
+ readonly dy: -1;
347
+ }];
348
+ /**
349
+ * @zh 网格地图配置
350
+ * @en Grid map options
351
+ */
352
+ interface IGridMapOptions {
353
+ /** @zh 是否允许对角移动 @en Allow diagonal movement */
354
+ allowDiagonal?: boolean;
355
+ /** @zh 对角移动代价 @en Diagonal movement cost */
356
+ diagonalCost?: number;
357
+ /** @zh 是否避免穿角 @en Avoid corner cutting */
358
+ avoidCorners?: boolean;
359
+ /** @zh 启发式函数 @en Heuristic function */
360
+ heuristic?: HeuristicFunction;
361
+ }
362
+ /**
363
+ * @zh 默认网格地图配置
364
+ * @en Default grid map options
365
+ */
366
+ declare const DEFAULT_GRID_OPTIONS: Required<IGridMapOptions>;
367
+ /**
368
+ * @zh 网格地图
369
+ * @en Grid Map
370
+ *
371
+ * @zh 基于二维数组的网格地图实现,支持4方向和8方向移动
372
+ * @en Grid map implementation based on 2D array, supports 4 and 8 directional movement
373
+ *
374
+ * @example
375
+ * ```typescript
376
+ * // Create a 10x10 grid
377
+ * const grid = new GridMap(10, 10);
378
+ *
379
+ * // Set some cells as obstacles
380
+ * grid.setWalkable(5, 5, false);
381
+ * grid.setWalkable(5, 6, false);
382
+ *
383
+ * // Use with pathfinder
384
+ * const pathfinder = new AStarPathfinder(grid);
385
+ * const result = pathfinder.findPath(0, 0, 9, 9);
386
+ * ```
387
+ */
388
+ declare class GridMap implements IPathfindingMap {
389
+ readonly width: number;
390
+ readonly height: number;
391
+ private readonly nodes;
392
+ private readonly options;
393
+ constructor(width: number, height: number, options?: IGridMapOptions);
394
+ /**
395
+ * @zh 创建网格节点
396
+ * @en Create grid nodes
397
+ */
398
+ private createNodes;
399
+ /**
400
+ * @zh 获取指定位置的节点
401
+ * @en Get node at position
402
+ */
403
+ getNodeAt(x: number, y: number): GridNode | null;
404
+ /**
405
+ * @zh 检查坐标是否在边界内
406
+ * @en Check if coordinates are within bounds
407
+ */
408
+ isInBounds(x: number, y: number): boolean;
409
+ /**
410
+ * @zh 检查位置是否可通行
411
+ * @en Check if position is walkable
412
+ */
413
+ isWalkable(x: number, y: number): boolean;
414
+ /**
415
+ * @zh 设置位置是否可通行
416
+ * @en Set position walkability
417
+ */
418
+ setWalkable(x: number, y: number, walkable: boolean): void;
419
+ /**
420
+ * @zh 设置位置的移动代价
421
+ * @en Set movement cost at position
422
+ */
423
+ setCost(x: number, y: number, cost: number): void;
424
+ /**
425
+ * @zh 获取节点的邻居
426
+ * @en Get neighbors of a node
427
+ */
428
+ getNeighbors(node: IPathNode): GridNode[];
429
+ /**
430
+ * @zh 计算启发式距离
431
+ * @en Calculate heuristic distance
432
+ */
433
+ heuristic(a: IPoint, b: IPoint): number;
434
+ /**
435
+ * @zh 计算移动代价
436
+ * @en Calculate movement cost
437
+ */
438
+ getMovementCost(from: IPathNode, to: IPathNode): number;
439
+ /**
440
+ * @zh 从二维数组加载地图
441
+ * @en Load map from 2D array
442
+ *
443
+ * @param data - @zh 0=可通行,非0=不可通行 @en 0=walkable, non-0=blocked
444
+ */
445
+ loadFromArray(data: number[][]): void;
446
+ /**
447
+ * @zh 从字符串加载地图
448
+ * @en Load map from string
449
+ *
450
+ * @param str - @zh 地图字符串,'.'=可通行,'#'=障碍 @en Map string, '.'=walkable, '#'=blocked
451
+ */
452
+ loadFromString(str: string): void;
453
+ /**
454
+ * @zh 导出为字符串
455
+ * @en Export to string
456
+ */
457
+ toString(): string;
458
+ /**
459
+ * @zh 重置所有节点为可通行
460
+ * @en Reset all nodes to walkable
461
+ */
462
+ reset(): void;
463
+ /**
464
+ * @zh 设置矩形区域的通行性
465
+ * @en Set walkability for a rectangle region
466
+ */
467
+ setRectWalkable(x: number, y: number, width: number, height: number, walkable: boolean): void;
468
+ }
469
+ /**
470
+ * @zh 创建网格地图
471
+ * @en Create grid map
472
+ */
473
+ declare function createGridMap(width: number, height: number, options?: IGridMapOptions): GridMap;
474
+
475
+ /**
476
+ * @zh 导航网格实现
477
+ * @en NavMesh Implementation
478
+ */
479
+
480
+ /**
481
+ * @zh 导航多边形
482
+ * @en Navigation polygon
483
+ */
484
+ interface INavPolygon {
485
+ /** @zh 多边形ID @en Polygon ID */
486
+ readonly id: number;
487
+ /** @zh 顶点列表 @en Vertex list */
488
+ readonly vertices: readonly IPoint[];
489
+ /** @zh 中心点 @en Center point */
490
+ readonly center: IPoint;
491
+ /** @zh 邻居多边形ID @en Neighbor polygon IDs */
492
+ readonly neighbors: readonly number[];
493
+ /** @zh 到邻居的共享边 @en Shared edges to neighbors */
494
+ readonly portals: ReadonlyMap<number, IPortal>;
495
+ }
496
+ /**
497
+ * @zh 入口(两个多边形之间的共享边)
498
+ * @en Portal (shared edge between two polygons)
499
+ */
500
+ interface IPortal {
501
+ /** @zh 边的左端点 @en Left endpoint of edge */
502
+ readonly left: IPoint;
503
+ /** @zh 边的右端点 @en Right endpoint of edge */
504
+ readonly right: IPoint;
505
+ }
506
+ /**
507
+ * @zh 导航网格
508
+ * @en Navigation Mesh
509
+ *
510
+ * @zh 使用凸多边形网格进行高效寻路,适合复杂地形
511
+ * @en Uses convex polygon mesh for efficient pathfinding, suitable for complex terrain
512
+ *
513
+ * @example
514
+ * ```typescript
515
+ * const navmesh = new NavMesh();
516
+ *
517
+ * // Add polygons
518
+ * navmesh.addPolygon([
519
+ * { x: 0, y: 0 }, { x: 10, y: 0 },
520
+ * { x: 10, y: 10 }, { x: 0, y: 10 }
521
+ * ]);
522
+ *
523
+ * // Build connections
524
+ * navmesh.build();
525
+ *
526
+ * // Find path
527
+ * const result = navmesh.findPath(1, 1, 8, 8);
528
+ * ```
529
+ */
530
+ declare class NavMesh implements IPathfindingMap {
531
+ private polygons;
532
+ private nodes;
533
+ private nextId;
534
+ /**
535
+ * @zh 添加导航多边形
536
+ * @en Add navigation polygon
537
+ *
538
+ * @returns @zh 多边形ID @en Polygon ID
539
+ */
540
+ addPolygon(vertices: IPoint[], neighbors?: number[]): number;
541
+ /**
542
+ * @zh 设置两个多边形之间的连接
543
+ * @en Set connection between two polygons
544
+ */
545
+ setConnection(polyA: number, polyB: number, portal: IPortal): void;
546
+ /**
547
+ * @zh 自动检测并建立相邻多边形的连接
548
+ * @en Auto-detect and build connections between adjacent polygons
549
+ */
550
+ build(): void;
551
+ /**
552
+ * @zh 查找两个多边形的共享边
553
+ * @en Find shared edge between two polygons
554
+ */
555
+ private findSharedEdge;
556
+ /**
557
+ * @zh 计算多边形中心
558
+ * @en Calculate polygon center
559
+ */
560
+ private calculateCenter;
561
+ /**
562
+ * @zh 查找包含点的多边形
563
+ * @en Find polygon containing point
564
+ */
565
+ findPolygonAt(x: number, y: number): INavPolygon | null;
566
+ /**
567
+ * @zh 检查点是否在多边形内
568
+ * @en Check if point is inside polygon
569
+ */
570
+ private isPointInPolygon;
571
+ getNodeAt(x: number, y: number): IPathNode | null;
572
+ getNeighbors(node: IPathNode): IPathNode[];
573
+ heuristic(a: IPoint, b: IPoint): number;
574
+ getMovementCost(from: IPathNode, to: IPathNode): number;
575
+ isWalkable(x: number, y: number): boolean;
576
+ /**
577
+ * @zh 在导航网格上寻路
578
+ * @en Find path on navigation mesh
579
+ */
580
+ findPath(startX: number, startY: number, endX: number, endY: number, options?: IPathfindingOptions): IPathResult;
581
+ /**
582
+ * @zh 在多边形图上寻路
583
+ * @en Find path on polygon graph
584
+ */
585
+ private findPolygonPath;
586
+ /**
587
+ * @zh 使用漏斗算法优化路径
588
+ * @en Optimize path using funnel algorithm
589
+ */
590
+ private funnelPath;
591
+ /**
592
+ * @zh 计算三角形面积的两倍(用于判断点的相对位置)
593
+ * @en Calculate twice the triangle area (for point relative position)
594
+ */
595
+ private triArea2;
596
+ /**
597
+ * @zh 计算路径总长度
598
+ * @en Calculate total path length
599
+ */
600
+ private calculatePathLength;
601
+ /**
602
+ * @zh 清空导航网格
603
+ * @en Clear navigation mesh
604
+ */
605
+ clear(): void;
606
+ /**
607
+ * @zh 获取所有多边形
608
+ * @en Get all polygons
609
+ */
610
+ getPolygons(): INavPolygon[];
611
+ /**
612
+ * @zh 获取多边形数量
613
+ * @en Get polygon count
614
+ */
615
+ get polygonCount(): number;
616
+ }
617
+ /**
618
+ * @zh 创建导航网格
619
+ * @en Create navigation mesh
620
+ */
621
+ declare function createNavMesh(): NavMesh;
622
+
623
+ /**
624
+ * @zh 路径平滑算法
625
+ * @en Path Smoothing Algorithms
626
+ */
627
+
628
+ /**
629
+ * @zh 使用 Bresenham 算法检测视线
630
+ * @en Line of sight check using Bresenham algorithm
631
+ */
632
+ declare function bresenhamLineOfSight(x1: number, y1: number, x2: number, y2: number, map: IPathfindingMap): boolean;
633
+ /**
634
+ * @zh 使用射线投射检测视线(更精确)
635
+ * @en Line of sight check using ray casting (more precise)
636
+ */
637
+ declare function raycastLineOfSight(x1: number, y1: number, x2: number, y2: number, map: IPathfindingMap, stepSize?: number): boolean;
638
+ /**
639
+ * @zh 路径简化器 - 移除不必要的拐点
640
+ * @en Path Simplifier - Removes unnecessary waypoints
641
+ *
642
+ * @zh 使用视线检测移除可以直接到达的中间点
643
+ * @en Uses line of sight to remove intermediate points that can be reached directly
644
+ */
645
+ declare class LineOfSightSmoother implements IPathSmoother {
646
+ private readonly lineOfSight;
647
+ constructor(lineOfSight?: typeof bresenhamLineOfSight);
648
+ smooth(path: readonly IPoint[], map: IPathfindingMap): IPoint[];
649
+ }
650
+ /**
651
+ * @zh Catmull-Rom 样条曲线平滑
652
+ * @en Catmull-Rom spline smoothing
653
+ */
654
+ declare class CatmullRomSmoother implements IPathSmoother {
655
+ private readonly segments;
656
+ private readonly tension;
657
+ /**
658
+ * @param segments - @zh 每段之间的插值点数 @en Number of interpolation points per segment
659
+ * @param tension - @zh 张力 (0-1) @en Tension (0-1)
660
+ */
661
+ constructor(segments?: number, tension?: number);
662
+ smooth(path: readonly IPoint[], _map: IPathfindingMap): IPoint[];
663
+ /**
664
+ * @zh Catmull-Rom 插值
665
+ * @en Catmull-Rom interpolation
666
+ */
667
+ private interpolate;
668
+ }
669
+ /**
670
+ * @zh 组合路径平滑器
671
+ * @en Combined path smoother
672
+ *
673
+ * @zh 先简化路径,再用曲线平滑
674
+ * @en First simplify path, then smooth with curves
675
+ */
676
+ declare class CombinedSmoother implements IPathSmoother {
677
+ private readonly simplifier;
678
+ private readonly curveSmoother;
679
+ constructor(curveSegments?: number, tension?: number);
680
+ smooth(path: readonly IPoint[], map: IPathfindingMap): IPoint[];
681
+ }
682
+ /**
683
+ * @zh 创建视线平滑器
684
+ * @en Create line of sight smoother
685
+ */
686
+ declare function createLineOfSightSmoother(lineOfSight?: typeof bresenhamLineOfSight): LineOfSightSmoother;
687
+ /**
688
+ * @zh 创建曲线平滑器
689
+ * @en Create curve smoother
690
+ */
691
+ declare function createCatmullRomSmoother(segments?: number, tension?: number): CatmullRomSmoother;
692
+ /**
693
+ * @zh 创建组合平滑器
694
+ * @en Create combined smoother
695
+ */
696
+ declare function createCombinedSmoother(curveSegments?: number, tension?: number): CombinedSmoother;
697
+
698
+ /**
699
+ * @zh 寻路系统蓝图节点
700
+ * @en Pathfinding System Blueprint Nodes
701
+ */
702
+
703
+ declare const FindPathTemplate: BlueprintNodeTemplate;
704
+ declare class FindPathExecutor implements INodeExecutor {
705
+ execute(node: BlueprintNode, context: unknown): ExecutionResult;
706
+ }
707
+ declare const FindPathSmoothTemplate: BlueprintNodeTemplate;
708
+ declare class FindPathSmoothExecutor implements INodeExecutor {
709
+ execute(node: BlueprintNode, context: unknown): ExecutionResult;
710
+ }
711
+ declare const IsWalkableTemplate: BlueprintNodeTemplate;
712
+ declare class IsWalkableExecutor implements INodeExecutor {
713
+ execute(node: BlueprintNode, context: unknown): ExecutionResult;
714
+ }
715
+ declare const GetPathLengthTemplate: BlueprintNodeTemplate;
716
+ declare class GetPathLengthExecutor implements INodeExecutor {
717
+ execute(node: BlueprintNode, context: unknown): ExecutionResult;
718
+ }
719
+ declare const GetPathDistanceTemplate: BlueprintNodeTemplate;
720
+ declare class GetPathDistanceExecutor implements INodeExecutor {
721
+ execute(node: BlueprintNode, context: unknown): ExecutionResult;
722
+ }
723
+ declare const GetPathPointTemplate: BlueprintNodeTemplate;
724
+ declare class GetPathPointExecutor implements INodeExecutor {
725
+ execute(node: BlueprintNode, context: unknown): ExecutionResult;
726
+ }
727
+ declare const MoveAlongPathTemplate: BlueprintNodeTemplate;
728
+ declare class MoveAlongPathExecutor implements INodeExecutor {
729
+ execute(node: BlueprintNode, context: unknown): ExecutionResult;
730
+ }
731
+ declare const HasLineOfSightTemplate: BlueprintNodeTemplate;
732
+ declare class HasLineOfSightExecutor implements INodeExecutor {
733
+ execute(node: BlueprintNode, context: unknown): ExecutionResult;
734
+ }
735
+ declare const PathfindingNodeDefinitions: {
736
+ templates: BlueprintNodeTemplate[];
737
+ executors: Map<string, INodeExecutor>;
738
+ };
739
+
740
+ export { AStarPathfinder, BinaryHeap, CatmullRomSmoother, CombinedSmoother, DEFAULT_GRID_OPTIONS, DEFAULT_PATHFINDING_OPTIONS, DIRECTIONS_4, DIRECTIONS_8, EMPTY_PATH_RESULT, FindPathExecutor, FindPathSmoothExecutor, FindPathSmoothTemplate, FindPathTemplate, GetPathDistanceExecutor, GetPathDistanceTemplate, GetPathLengthExecutor, GetPathLengthTemplate, GetPathPointExecutor, GetPathPointTemplate, GridMap, GridNode, HasLineOfSightExecutor, HasLineOfSightTemplate, type HeuristicFunction, type IGridMapOptions, type INavPolygon, type IPathNode, type IPathResult, type IPathSmoother, type IPathfinder, type IPathfindingMap, type IPathfindingOptions, type IPoint, type IPortal, IsWalkableExecutor, IsWalkableTemplate, type LineOfSightCheck, LineOfSightSmoother, MoveAlongPathExecutor, MoveAlongPathTemplate, NavMesh, PathfindingNodeDefinitions, bresenhamLineOfSight, chebyshevDistance, createAStarPathfinder, createCatmullRomSmoother, createCombinedSmoother, createGridMap, createLineOfSightSmoother, createNavMesh, createPoint, euclideanDistance, manhattanDistance, octileDistance, raycastLineOfSight };