Calculate the length of the path over the given interval.