Path: Math/AStar
% Finds the cost of going from one node to another in a square grid. Diagonal moves are permitted. -------------------------------------------------------------------------- Form: cost = GridTraverseCost( startNode, nextNode, d ) -------------------------------------------------------------------------- ------ Inputs ------ startNode (1,1) Id of start location nextNode (1,1) Id of next location d (1,1) Data structure .n (1,1) Number of nodes ------- Outputs ------- cost (1,:) List of nodes in path --------------------------------------------------------------------------
Back to the Math Module page