finding midpoint of a line with given interval