Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public float estimate(Node startNode, Node endNode) {
- int startIndex = startNode.getIndex();
- int endIndex = endNode.getIndex();
- int startY = startIndex / MapManager.mapWidth;
- int startX = startIndex % MapManager.mapWidth;
- int endY = endIndex / MapManager.mapWidth;
- int endX = endIndex % MapManager.mapWidth;
- float distance = (float)Math.sqrt(Math.pow(endX - startX, 2) + Math.pow(endY - startY, 2));
- return distance;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement