function [result, outlier] = less_extreme_spread(r)

rsize = size(r);
N = rsize(1);

for i=1:N
   for j=i:N
      distance(i,j) = norm( r(i,:) - r(j,:) );
   end
end

% Find coordinates of the maximum element (imax, jmax). This means that
% the extream spread is between elements imax and jmax.
[max1, imax_arr] = max(distance);
[max2, jmax] = max(max1);
imax = imax_arr(jmax);


% Try leaving out point imax
spread1 = extreme_spread( r((1:N)~=imax, :) );

% Try leaving out point jmax
spread2 = extreme_spread( r((1:N)~=jmax, :) );

if (spread1 < spread2)
   % In this case, imax is the outlier that will be ignored.
   outlier = imax;
   result = spread1;
else
   % In this case, jmax is the outlier.
   outlier = jmax;
   result = spread2;
end