Added closure to Ray.distanceSqToSegment()

This eliminates unnecessary cloning.