I just finished writing the code a couple hours ago, so I don't have any detailed explanation at the moment. However, it is open source, so you can always check the code: https://github.com/SCLeoX/non-grid-path-finder.
I will admit though, it is not super readable, because it really lacks a lot of comments/documentation.