@esengine/pathfinding 13.0.0 → 13.2.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.
- package/dist/{KDTree-Bw4Faf2O.d.ts → IIncrementalPathfinding-3qs7e_pO.d.ts} +1 -371
- package/dist/KDTree-2rs2EXvm.d.ts +407 -0
- package/dist/LinearProgram-DyD3pI6v.d.ts +56 -0
- package/dist/avoidance.d.ts +31 -0
- package/dist/avoidance.js +31 -0
- package/dist/avoidance.js.map +1 -0
- package/dist/chunk-JTZP55BJ.js +935 -0
- package/dist/chunk-JTZP55BJ.js.map +1 -0
- package/dist/chunk-KEYTX37K.js +1 -0
- package/dist/chunk-KEYTX37K.js.map +1 -0
- package/dist/chunk-T626JPC7.js +10 -0
- package/dist/chunk-T626JPC7.js.map +1 -0
- package/dist/{chunk-OA7ZZQMH.js → chunk-VNC2YAAL.js} +6 -908
- package/dist/chunk-VNC2YAAL.js.map +1 -0
- package/dist/{chunk-GTFFYRZM.js → chunk-YKA3PWU3.js} +1 -8
- package/dist/{chunk-GTFFYRZM.js.map → chunk-YKA3PWU3.js.map} +1 -1
- package/dist/ecs.d.ts +2 -1
- package/dist/ecs.js +10 -6
- package/dist/ecs.js.map +1 -1
- package/dist/index.d.ts +130 -52
- package/dist/index.js +887 -324
- package/dist/index.js.map +1 -1
- package/dist/nodes.js +4 -2
- package/dist/nodes.js.map +1 -1
- package/package.json +7 -3
- package/dist/chunk-OA7ZZQMH.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { I as IPathfinder, a as IPathfindingMap, b as IPathfindingOptions, c as IPathResult, H as HeuristicFunction, d as IPathNode, e as IPoint, f as IIncrementalPathfinder, g as IIncrementalPathfindingOptions, h as IPathRequest, i as IPathProgress, j as IIncrementalPathResult, k as IPathValidator, l as IPathValidationResult, m as IPathSmoother
|
|
2
|
-
export {
|
|
3
|
-
|
|
1
|
+
import { I as IPathfinder, a as IPathfindingMap, b as IPathfindingOptions, c as IPathResult, H as HeuristicFunction, d as IPathNode, e as IPoint, f as IIncrementalPathfinder, g as IIncrementalPathfindingOptions, h as IPathRequest, i as IPathProgress, j as IIncrementalPathResult, k as IPathValidator, l as IPathValidationResult, m as IPathSmoother } from './IIncrementalPathfinding-3qs7e_pO.js';
|
|
2
|
+
export { D as DEFAULT_PATHFINDING_OPTIONS, t as DEFAULT_REPLANNING_CONFIG, E as EMPTY_PATH_RESULT, u as EMPTY_PROGRESS, s as IReplanningConfig, L as LineOfSightCheck, P as PathfindingState, q as chebyshevDistance, n as createPoint, p as euclideanDistance, o as manhattanDistance, r as octileDistance } from './IIncrementalPathfinding-3qs7e_pO.js';
|
|
3
|
+
export { h as DEFAULT_AGENT_PARAMS, D as DEFAULT_ORCA_CONFIG, a as IAvoidanceAgent, f as INeighborResult, I as IORCALine, d as IORCAResult, e as IORCASolver, c as IORCASolverConfig, b as IObstacle, g as ISpatialIndex, K as KDTree, O as ORCASolver, j as createKDTree, i as createORCASolver } from './KDTree-2rs2EXvm.js';
|
|
4
|
+
export { s as solveORCALinearProgram } from './LinearProgram-DyD3pI6v.js';
|
|
4
5
|
export { IVector2 } from '@esengine/ecs-framework-math';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -1079,13 +1080,15 @@ declare function createJPSPathfinder(map: IPathfindingMap): JPSPathfinder;
|
|
|
1079
1080
|
* 1. 将地图划分为集群 (clusters)
|
|
1080
1081
|
* 2. 在集群边界检测入口点 (entrances)
|
|
1081
1082
|
* 3. 构建抽象图 (abstract graph) 连接入口点
|
|
1082
|
-
* 4.
|
|
1083
|
+
* 4. 预计算集群内入口点之间的真实路径代价
|
|
1084
|
+
* 5. 先在抽象图上寻路,再利用缓存细化为详细路径
|
|
1083
1085
|
*
|
|
1084
1086
|
* @en How it works:
|
|
1085
1087
|
* 1. Divide map into clusters
|
|
1086
1088
|
* 2. Detect entrances at cluster boundaries
|
|
1087
1089
|
* 3. Build abstract graph connecting entrances
|
|
1088
|
-
* 4.
|
|
1090
|
+
* 4. Precompute actual path costs between entrances within clusters
|
|
1091
|
+
* 5. First find path on abstract graph, then refine using cached paths
|
|
1089
1092
|
*/
|
|
1090
1093
|
|
|
1091
1094
|
/**
|
|
@@ -1099,8 +1102,8 @@ interface IHPAConfig {
|
|
|
1099
1102
|
*/
|
|
1100
1103
|
clusterSize: number;
|
|
1101
1104
|
/**
|
|
1102
|
-
* @zh
|
|
1103
|
-
* @en Maximum entrance width (entrances wider than this will be split)
|
|
1105
|
+
* @zh 最大入口宽度(超过此宽度会拆分或使用端点策略)
|
|
1106
|
+
* @en Maximum entrance width (entrances wider than this will be split or use endpoint strategy)
|
|
1104
1107
|
*/
|
|
1105
1108
|
maxEntranceWidth: number;
|
|
1106
1109
|
/**
|
|
@@ -1108,6 +1111,16 @@ interface IHPAConfig {
|
|
|
1108
1111
|
* @en Whether to enable internal path caching
|
|
1109
1112
|
*/
|
|
1110
1113
|
cacheInternalPaths: boolean;
|
|
1114
|
+
/**
|
|
1115
|
+
* @zh 入口策略:'middle' 在中间放节点,'end' 在宽入口两端各放节点
|
|
1116
|
+
* @en Entrance strategy: 'middle' places node at center, 'end' places nodes at both ends for wide entrances
|
|
1117
|
+
*/
|
|
1118
|
+
entranceStrategy?: 'middle' | 'end';
|
|
1119
|
+
/**
|
|
1120
|
+
* @zh 是否延迟计算 intra-edges(大幅加速预处理,首次查询时计算真实路径)
|
|
1121
|
+
* @en Whether to lazily compute intra-edges (greatly speeds up preprocessing, computes actual paths on first query)
|
|
1122
|
+
*/
|
|
1123
|
+
lazyIntraEdges?: boolean;
|
|
1111
1124
|
}
|
|
1112
1125
|
/**
|
|
1113
1126
|
* @zh 默认 HPA* 配置
|
|
@@ -1136,24 +1149,24 @@ declare const DEFAULT_HPA_CONFIG: IHPAConfig;
|
|
|
1136
1149
|
declare class HPAPathfinder implements IPathfinder {
|
|
1137
1150
|
private readonly map;
|
|
1138
1151
|
private readonly config;
|
|
1139
|
-
private readonly
|
|
1140
|
-
private readonly
|
|
1152
|
+
private readonly mapWidth;
|
|
1153
|
+
private readonly mapHeight;
|
|
1141
1154
|
private clusters;
|
|
1142
|
-
private entrances;
|
|
1143
|
-
private abstractNodes;
|
|
1144
1155
|
private clusterGrid;
|
|
1145
|
-
private
|
|
1156
|
+
private clustersX;
|
|
1157
|
+
private clustersY;
|
|
1158
|
+
private abstractNodes;
|
|
1159
|
+
private nodesByCluster;
|
|
1146
1160
|
private nextNodeId;
|
|
1147
|
-
private
|
|
1148
|
-
private localPathfinder;
|
|
1161
|
+
private entranceCount;
|
|
1162
|
+
private readonly localPathfinder;
|
|
1163
|
+
private readonly pathCache;
|
|
1164
|
+
private mapVersion;
|
|
1149
1165
|
private preprocessed;
|
|
1150
1166
|
constructor(map: IPathfindingMap, config?: Partial<IHPAConfig>);
|
|
1151
1167
|
/**
|
|
1152
1168
|
* @zh 预处理地图(构建抽象图)
|
|
1153
1169
|
* @en Preprocess map (build abstract graph)
|
|
1154
|
-
*
|
|
1155
|
-
* @zh 在地图变化后需要重新调用
|
|
1156
|
-
* @en Need to call again after map changes
|
|
1157
1170
|
*/
|
|
1158
1171
|
preprocess(): void;
|
|
1159
1172
|
/**
|
|
@@ -1182,22 +1195,110 @@ declare class HPAPathfinder implements IPathfinder {
|
|
|
1182
1195
|
cacheSize: number;
|
|
1183
1196
|
};
|
|
1184
1197
|
private getMapBounds;
|
|
1198
|
+
/**
|
|
1199
|
+
* @zh 构建集群
|
|
1200
|
+
* @en Build clusters
|
|
1201
|
+
*/
|
|
1185
1202
|
private buildClusters;
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1203
|
+
/**
|
|
1204
|
+
* @zh 检测入口并创建抽象节点
|
|
1205
|
+
* @en Detect entrances and create abstract nodes
|
|
1206
|
+
*/
|
|
1207
|
+
private buildEntrances;
|
|
1208
|
+
/**
|
|
1209
|
+
* @zh 检测并创建两个相邻集群之间的入口
|
|
1210
|
+
* @en Detect and create entrances between two adjacent clusters
|
|
1211
|
+
*/
|
|
1212
|
+
private detectAndCreateEntrances;
|
|
1213
|
+
/**
|
|
1214
|
+
* @zh 检测边界上的连续可通行区间
|
|
1215
|
+
* @en Detect continuous walkable spans on boundary
|
|
1216
|
+
*/
|
|
1217
|
+
private detectEntranceSpans;
|
|
1218
|
+
/**
|
|
1219
|
+
* @zh 为入口区间创建抽象节点
|
|
1220
|
+
* @en Create abstract nodes for entrance span
|
|
1221
|
+
*/
|
|
1222
|
+
private createEntranceNodes;
|
|
1223
|
+
/**
|
|
1224
|
+
* @zh 创建抽象节点
|
|
1225
|
+
* @en Create abstract node
|
|
1226
|
+
*/
|
|
1190
1227
|
private createAbstractNode;
|
|
1191
|
-
|
|
1228
|
+
/**
|
|
1229
|
+
* @zh 构建所有集群的 intra-edges
|
|
1230
|
+
* @en Build intra-edges for all clusters
|
|
1231
|
+
*/
|
|
1232
|
+
private buildIntraEdges;
|
|
1233
|
+
/**
|
|
1234
|
+
* @zh 构建单个集群的 intra-edges
|
|
1235
|
+
* @en Build intra-edges for single cluster
|
|
1236
|
+
*/
|
|
1237
|
+
private buildClusterIntraEdges;
|
|
1238
|
+
/**
|
|
1239
|
+
* @zh 延迟构建 intra-edges(只用启发式距离)
|
|
1240
|
+
* @en Build lazy intra-edges (using heuristic distance only)
|
|
1241
|
+
*/
|
|
1242
|
+
private buildLazyIntraEdges;
|
|
1243
|
+
/**
|
|
1244
|
+
* @zh 立即构建 intra-edges(计算真实路径)
|
|
1245
|
+
* @en Build eager intra-edges (compute actual paths)
|
|
1246
|
+
*/
|
|
1247
|
+
private buildEagerIntraEdges;
|
|
1248
|
+
/**
|
|
1249
|
+
* @zh 按需计算 intra-edge 的真实路径
|
|
1250
|
+
* @en Compute actual path for intra-edge on demand
|
|
1251
|
+
*/
|
|
1252
|
+
private computeIntraEdgePath;
|
|
1253
|
+
/**
|
|
1254
|
+
* @zh 获取指定位置的集群
|
|
1255
|
+
* @en Get cluster at position
|
|
1256
|
+
*/
|
|
1192
1257
|
private getClusterAt;
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1258
|
+
/**
|
|
1259
|
+
* @zh 获取受影响的集群
|
|
1260
|
+
* @en Get affected clusters
|
|
1261
|
+
*/
|
|
1262
|
+
private getAffectedClusters;
|
|
1263
|
+
/**
|
|
1264
|
+
* @zh 插入临时节点
|
|
1265
|
+
* @en Insert temporary node
|
|
1266
|
+
*/
|
|
1267
|
+
private insertTempNode;
|
|
1268
|
+
/**
|
|
1269
|
+
* @zh 移除临时节点
|
|
1270
|
+
* @en Remove temporary node
|
|
1271
|
+
*/
|
|
1272
|
+
private removeTempNode;
|
|
1273
|
+
/**
|
|
1274
|
+
* @zh 在抽象图上进行 A* 搜索
|
|
1275
|
+
* @en Perform A* search on abstract graph
|
|
1276
|
+
*/
|
|
1277
|
+
private abstractSearch;
|
|
1278
|
+
/**
|
|
1279
|
+
* @zh 重建抽象路径
|
|
1280
|
+
* @en Reconstruct abstract path
|
|
1281
|
+
*/
|
|
1282
|
+
private reconstructPath;
|
|
1283
|
+
/**
|
|
1284
|
+
* @zh 细化抽象路径为具体路径
|
|
1285
|
+
* @en Refine abstract path to concrete path
|
|
1286
|
+
*/
|
|
1197
1287
|
private refinePath;
|
|
1288
|
+
/**
|
|
1289
|
+
* @zh 追加路径(避免重复点)
|
|
1290
|
+
* @en Append path (avoid duplicate points)
|
|
1291
|
+
*/
|
|
1292
|
+
private appendPath;
|
|
1293
|
+
/**
|
|
1294
|
+
* @zh 局部寻路
|
|
1295
|
+
* @en Local pathfinding
|
|
1296
|
+
*/
|
|
1198
1297
|
private findLocalPath;
|
|
1199
|
-
|
|
1200
|
-
|
|
1298
|
+
/**
|
|
1299
|
+
* @zh 启发式函数(Octile 距离)
|
|
1300
|
+
* @en Heuristic function (Octile distance)
|
|
1301
|
+
*/
|
|
1201
1302
|
private heuristic;
|
|
1202
1303
|
}
|
|
1203
1304
|
/**
|
|
@@ -1433,27 +1534,4 @@ declare function createCatmullRomSmoother(segments?: number, tension?: number):
|
|
|
1433
1534
|
*/
|
|
1434
1535
|
declare function createCombinedSmoother(curveSegments?: number, tension?: number): CombinedSmoother;
|
|
1435
1536
|
|
|
1436
|
-
|
|
1437
|
-
* @zh 2D 线性规划求解器
|
|
1438
|
-
* @en 2D Linear Programming Solver
|
|
1439
|
-
*
|
|
1440
|
-
* @zh 用于 ORCA 算法中的速度优化求解
|
|
1441
|
-
* @en Used for velocity optimization in ORCA algorithm
|
|
1442
|
-
*/
|
|
1443
|
-
|
|
1444
|
-
/**
|
|
1445
|
-
* @zh 求解 ORCA 线性规划
|
|
1446
|
-
* @en Solve ORCA Linear Programming
|
|
1447
|
-
*
|
|
1448
|
-
* @zh 综合使用 2D 和 3D 线性规划求解最优速度
|
|
1449
|
-
* @en Use both 2D and 3D LP to solve for optimal velocity
|
|
1450
|
-
*
|
|
1451
|
-
* @param lines - @zh ORCA 约束线列表 @en List of ORCA constraint lines
|
|
1452
|
-
* @param numObstLines - @zh 障碍物约束线数量(优先级更高)@en Number of obstacle lines (higher priority)
|
|
1453
|
-
* @param maxSpeed - @zh 最大速度 @en Maximum speed
|
|
1454
|
-
* @param preferredVelocity - @zh 首选速度 @en Preferred velocity
|
|
1455
|
-
* @returns @zh 计算得到的新速度 @en Computed new velocity
|
|
1456
|
-
*/
|
|
1457
|
-
declare function solveORCALinearProgram(lines: IORCALine[], numObstLines: number, maxSpeed: number, preferredVelocity: IVector2): Vector2;
|
|
1458
|
-
|
|
1459
|
-
export { AStarPathfinder, BinaryHeap, CatmullRomSmoother, CombinedSmoother, DEFAULT_GRID_OPTIONS, DEFAULT_HPA_CONFIG, DEFAULT_PATH_CACHE_CONFIG, DIRECTIONS_4, DIRECTIONS_8, GridMap, GridNode, GridPathfinder, type GridPathfinderMode, HPAPathfinder, HeuristicFunction, type IChangeRegion, type IGridMapOptions, type IGridPathfinderConfig, type IHPAConfig, type IHeapIndexable, IIncrementalPathResult, IIncrementalPathfinder, type IIncrementalPathfinderConfig, IIncrementalPathfindingOptions, type INavPolygon, IORCALine, type IObstacleChange, type IPathCacheConfig, IPathNode, IPathProgress, IPathRequest, IPathResult, IPathSmoother, IPathValidationResult, IPathValidator, IPathfinder, IPathfindingMap, IPathfindingOptions, IPoint, type IPortal, IncrementalAStarPathfinder, IndexedBinaryHeap, JPSPathfinder, LineOfSightSmoother, NavMesh, ObstacleChangeManager, PathCache, PathValidator, bresenhamLineOfSight, createAStarPathfinder, createCatmullRomSmoother, createCombinedSmoother, createGridMap, createGridPathfinder, createHPAPathfinder, createIncrementalAStarPathfinder, createJPSPathfinder, createLineOfSightSmoother, createNavMesh, createObstacleChangeManager, createPathCache, createPathValidator, raycastLineOfSight, solveORCALinearProgram };
|
|
1537
|
+
export { AStarPathfinder, BinaryHeap, CatmullRomSmoother, CombinedSmoother, DEFAULT_GRID_OPTIONS, DEFAULT_HPA_CONFIG, DEFAULT_PATH_CACHE_CONFIG, DIRECTIONS_4, DIRECTIONS_8, GridMap, GridNode, GridPathfinder, type GridPathfinderMode, HPAPathfinder, HeuristicFunction, type IChangeRegion, type IGridMapOptions, type IGridPathfinderConfig, type IHPAConfig, type IHeapIndexable, IIncrementalPathResult, IIncrementalPathfinder, type IIncrementalPathfinderConfig, IIncrementalPathfindingOptions, type INavPolygon, type IObstacleChange, type IPathCacheConfig, IPathNode, IPathProgress, IPathRequest, IPathResult, IPathSmoother, IPathValidationResult, IPathValidator, IPathfinder, IPathfindingMap, IPathfindingOptions, IPoint, type IPortal, IncrementalAStarPathfinder, IndexedBinaryHeap, JPSPathfinder, LineOfSightSmoother, NavMesh, ObstacleChangeManager, PathCache, PathValidator, bresenhamLineOfSight, createAStarPathfinder, createCatmullRomSmoother, createCombinedSmoother, createGridMap, createGridPathfinder, createHPAPathfinder, createIncrementalAStarPathfinder, createJPSPathfinder, createLineOfSightSmoother, createNavMesh, createObstacleChangeManager, createPathCache, createPathValidator, raycastLineOfSight };
|