median of all distances to line working