Line-segment formula