Fitting a line to a set of points