Based on the implementation of jamie and engkin I have reimplemented the routine using floating point variables and a Priorityqueue instead of a list.
I have also implemented the routine to work with BGRABitmap using TPointF.
I have allowed myself to include the license (ISC) just like the original project.
jamie, I have put your data as co-author of the routine (I think they are correct, if not, correct me).
engkin, I can give you credit in the file but I need your real data.
P.S. I have tested it in a real map project and it works fine.
The project now depends on BGRABitmap, but the dependency can be removed by commenting out the definition
{$ define IMPLEMENT_TPOINTF}