Added function projectPointToLine.