function b = dsame(f,dif)
%
% Checks that all directions in f (vector) are within dif of each other
% Returns:   0 if not
%            1 if they are
%   b = dsame(f,dif)
%
dist8 = [0,1,2,3,4,3,2,1;
         1,0,1,2,3,4,3,2;
		 2,1,0,1,2,3,4,3;
		 3,2,1,0,1,2,3,4;
		 4,3,2,1,0,1,2,3;
		 3,4,3,2,1,0,1,2;
		 2,3,4,3,2,1,0,1;
		 1,2,3,4,3,2,1,0];

b = 0;    % initialize to false
dirs = zeros(1,8);    % direction occurrence vector
maxdif = 0;
dirs(f(1)+1) = 1;
