mikolalysenko / l1-path-finder

🗺 Fast path planning for 2D grids
https://mikolalysenko.github.io/l1-path-finder/www
MIT License
484 stars 43 forks source link

How to implement "Clearance-based pathfinding"? #1

Closed sleep2death closed 9 years ago

sleep2death commented 9 years ago

Thanks for the great path-finding library, it's extreme fast and easy to use.Now I'm mixing them into my potential fields system.Is there any Idea about how to implement the "Clearance-based pathfinding" with this algorithm? The reference is here:https://harablog.wordpress.com/category/pathfinding/

mikolalysenko commented 9 years ago

You can just Minkowski sum the map with whatever shape you want to handle clearance. This can be done using any of the mathematical morphology libraries for ndarray. For example:

https://www.npmjs.com/package/ball-morphology

Or:

https://www.npmjs.com/package/ndarray-convolve

sleep2death commented 9 years ago

Appreciate it! I read the Mathematical Morphology algorithm, that will solve the problem, but it also has to create a new 'ndarray' for each size of the unit, Is there a way for l1-path-finder' to do the clearence and do it only once? Thanks again, I've forked this repo, and have a try.