www.pudn.com > routeplan_mainmenu.rar > AStar.h
#ifndef ASTAR_H #define ASTAR_H #include "WayPoint.h" #includestruct SASNode { int x; int y; bool bIsOpen; bool bIsClose; int ParentIndex; float H;//预计到目标点的距离 float G;//沿路径从起始点到当前点的移动耗费 float F;//G+H int NeighborCount; int Neighbor[10];//最多可以有10个邻居 float NeighborDistance[10];//到每个邻居的距离 }; class CAStar { public: CAStar(); bool FindPath(int FromIndex,int ToIndex, CWayPoint *pWayPoint); void InitNodeByWayPoint(CWayPoint *pWayPoint); virtual ~CAStar(); int PathPointCount; std::vector PathList; private: SASNode *pASNode; //int PathPointCount;//找到的路径上的路点数 int NodeCount; std::vector OpenList; //std::vector PathList; }; #endif