2D waypoint pathfinding: combinations of WPs to go from curLocation to targetLocation

后端 未结 3 1747
忘掉有多难
忘掉有多难 2021-01-15 02:42

Please take a moment to understand my situation. If it is not comprehendable, please tell me in a comment.

I have an ArrayList of Waypoints. These waypoints are not

3条回答
  •  迷失自我
    2021-01-15 03:19

    Well the easiest to implement would probably be creating an ArrayList of paths, which would be in turn an ArrayList of waypoints, that contains ALL possible paths, then using a recursive function to return whether each path is Valid or not given the starting and finishing point values, and the max distance, and if a path is not valid remove it from the list. The next step would be going through each of the paths that is left and ordering them from shortest total distance to shortest. This would be the brute force method of getting what you want, so the least efficient one possible. When I get home tonight I will repost if some one already hasn't with a more efficient method for doing this in java.

    Edit: if the brute force method is too much, the list of waypoints will have to be sorted some how, the best way is probably to sort them initially based on distance from the starting point.

提交回复
热议问题