distance of point to line,and set route for connections