astar 注释

This commit is contained in:
yhh
2020-07-09 16:36:42 +08:00
parent a80bb4b6f3
commit 877fc4c9bf
10 changed files with 153 additions and 3 deletions

View File

@@ -1,5 +1,22 @@
/**
* graph的接口可以提供给AstarPathfinder.search方法
*/
interface IAstarGraph<T> {
/**
* getNeighbors方法应该返回从传入的节点可以到达的任何相邻节点
* @param node
*/
getNeighbors(node: T): Array<T>;
/**
* 计算从从from到to的成本
* @param from
* @param to
*/
cost(from: T, to: T): number;
/**
* 计算从node到to的启发式。参见WeightedGridGraph了解常用的Manhatten方法。
* @param node
* @param goal
*/
heuristic(node: T, goal: T);
}