You should rephrase the comment and *maybe* rename the function because I am not sure if I am understanding what this is supposed to do.
Basically you assume that ```pnt``` has a distance < epsilon to a polyline ```p``` and you want to return the distance from ```pnt``` projected onto ```p``` to the beginning of ```p```?