digitsensitive / astar-typescript

A* search algorithm in TypeScript
MIT License
87 stars 18 forks source link

Allow diagonal but more weight #17

Open spassvogel opened 3 years ago

spassvogel commented 3 years ago

Hi there I noticed that the path taken when allowing for diagonals is not always the most 'natural' route. Take the following example:

image

It makes more sense for a person to walk like this.

image

I think there should be a cost involved in taking a diagonal path. What are your thoughts about this? Would you accept a PR along these lines?

relevant: https://stackoverflow.com/questions/845626/how-do-i-find-the-most-naturally-direct-route-using-a-star-a

dpaola2 commented 3 years ago

Just chiming in to say I agree and have noticed the same behavior.