Use the differences of x coordinates instead of distances.