added functions to compute distance to line and point