add segment-segment distance calculation function