Function distanceToLineSegmentSq