@Joel-Bodenmann Two points: 1. You can decompose the path to get each element and work on those independently. 2. You must contend with lines, polylines, ellipses and Bezier splines.
Closes point on a line is simply a vector projection. Bezier splines are more complex. For an approximation you can get polyline approximation to the remainder using parametric equations, then use the same technique for lines. I am writing a book on this subject.
By the way, I recall seeing an article on the method you propose.
There is a reason why there are almost no usable free implementations out there: Because it's harder than one would think at first sight. Maybe start which Shewchuk's papers to get a first idea of the problem.