Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AStar #24

Open
1s0t opened this issue Sep 24, 2023 · 0 comments
Open

AStar #24

1s0t opened this issue Sep 24, 2023 · 0 comments

Comments

@1s0t
Copy link

1s0t commented Sep 24, 2023

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 :)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant