-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
You have done such an amazing job with this BUT!
you messed up and passed node object instead of nodeid into the getDistance func here
| const gScore = currentNode.g + getDistance(currentNode, neighbor); |
And you also dont need to math.abs d1 and d2 in the distance func because - * - becomes positive :)
pathfinding-visualizer/src/algorithms/astar.tsx
Lines 74 to 78 in 2d1854c
| var d1 = Math.abs(posB.lat - posA.lat); | |
| var d2 = Math.abs(posB.lon - posA.lon); | |
| const dist = Math.sqrt(d1 * d1 + d2 * d2); |
the first error is why your astar provided bad results but with these fixes it is really good.
and there is some issue with the drawing of lines that causes some exception but i didnt go deep into that.
Metadata
Metadata
Assignees
Labels
No labels