This class takes a keepout map and uses A* (A-star) algorithm to create the path between two points; cost is obtained from the pixel values of keepout map. As a grid cell is rectangular, we will end up with the "staircase" like route, smoothing it is not part of what AStarGrid class should do. We will address it later.
Here is a route produced by a sample "main" function of the class.
First of all, even at its current 10m grid cell, the algorithm is slow. Though this can possibly be optimized. However, the second problem is more serious: that this algorithm does not consider partial driveability. It is only concerned with driveable / not driveable choice. So we can see a line going across the rather steep mountain, instead of going around it.
I will sollve these problems i in Dynamic Size A* Grid Algorithm. As for the current algorithm, it is here for historical reasons only, and will not be used in future.
Here is the code, just keep in mind that it is only here to prepare you for a more complex Dynamic Size A* Grid Algorithm: