Added distToSegment and distToSegmentSquared