Path Length and Midpoint Calculation