Line connection calculations.