Skip to content

AStar #24

@1s0t

Description

@1s0t

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions