* feat(pathfinding): 添加寻路系统模块 实现完整的寻路系统,支持 A* 算法、网格地图、导航网格和路径平滑: A* 寻路算法: - 高效的二叉堆优先队列 - 可配置的启发式权重 - 最大搜索节点限制 - 支持对角移动和穿角避免 网格地图 (GridMap): - 基于二维数组的网格地图 - 支持 4 方向和 8 方向移动 - 可变移动代价 - 从数组或字符串加载地图 导航网格 (NavMesh): - 凸多边形导航网格 - 自动检测相邻多边形 - 漏斗算法路径优化 - 适合复杂地形 路径平滑: - Bresenham 视线检测 - 射线投射视线检测 - 视线简化器 (移除不必要的拐点) - Catmull-Rom 曲线平滑 - 组合平滑器 启发式函数: - 曼哈顿距离 (4方向) - 欧几里得距离 (任意方向) - 切比雪夫距离 (8方向) - 八角距离 (8方向,对角线√2) 蓝图节点 (8个): - FindPath: 基础寻路 - FindPathSmooth: 平滑寻路 - IsWalkable: 检查可通行性 - GetPathLength: 获取路径点数 - GetPathDistance: 获取路径距离 - GetPathPoint: 获取路径点 - MoveAlongPath: 沿路径移动 - HasLineOfSight: 视线检测 * chore: update pnpm-lock.yaml for pathfinding package
31 lines
592 B
TypeScript
31 lines
592 B
TypeScript
/**
|
|
* @zh 寻路核心模块
|
|
* @en Pathfinding Core Module
|
|
*/
|
|
|
|
export type {
|
|
IPoint,
|
|
IPathNode,
|
|
IPathResult,
|
|
IPathfindingMap,
|
|
IPathfinder,
|
|
IPathSmoother,
|
|
IPathfindingOptions,
|
|
HeuristicFunction,
|
|
LineOfSightCheck
|
|
} from './IPathfinding';
|
|
|
|
export {
|
|
createPoint,
|
|
EMPTY_PATH_RESULT,
|
|
DEFAULT_PATHFINDING_OPTIONS,
|
|
manhattanDistance,
|
|
euclideanDistance,
|
|
chebyshevDistance,
|
|
octileDistance
|
|
} from './IPathfinding';
|
|
|
|
export { BinaryHeap } from './BinaryHeap';
|
|
|
|
export { AStarPathfinder, createAStarPathfinder } from './AStarPathfinder';
|