| | |
| | | //对这个结点遍历,看是否有目标结点出现 |
| | | for (NavigateNode node : neighbour_node) { |
| | | // G + H + E (对启发函数增加去拐点方案calcNodeExtraCost) |
| | | int gCost = calcNodeCost(current_node, node) * calcNodeExtraCost(current_node, node, end); |
| | | int gCost = calcNodeCost(current_node, node) + calcNodeExtraCost(current_node, node, end); |
| | | if (node.getX() == end.getX() && node.getY() == end.getY()) {//找到目标结点就返回 |
| | | //init_node操作把这个邻居结点的父节点设置为当前结点 |
| | | //并且计算出G, F, H等值 |
| | |
| | | |
| | | // 拐向主轨道的点 |
| | | if (map[nextNode.getX()][nextNode.getY()] == 3) { |
| | | //------------------三凯独特判断------------------// |
| | | if (nextNode.getX() == 15) { |
| | | return 2;//影响算法,不要在15排这个主轨道换向 |
| | | } |
| | | //------------------三凯独特判断------------------// |
| | | |
| | | return 0; |
| | | } |
| | | |