def calculateTotalCost(path, elevationFn): total_cost= 0 for i in xrange(len(path) - 1): total_cost += costNorm(path[i][0], path[i][1], elevationFn(path[i][0], path[i][1]), path[i + 1][0], path[i + 1][1], elevationFn(path[i + 1][0], path[i + 1][1])) return total_cost
def cost(frm, to): return costNorm(frm.lon, frm.lat, frm.ele, to.lon, to.lat, to.ele)