function i = coplanar (points)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% coplanar.m                      %
% written 3/1/00 by Ben Olding    %
% Checks if 4 given sectors are   %
% in the same half-space          %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

points=sort(points);
a=points(1);
b=points(2);
c=points(3);
d=points(4);

% there are six faces on a cube
i = 0;
if a==1 & b==2 & c==3 & d==4, i=1; end;
if a==1 & b==2 & c==5 & d==6, i=1; end;
if a==1 & b==4 & c==5 & d==8, i=1; end;
if a==2 & b==3 & c==6 & d==7, i=1; end;
if a==3 & b==4 & c==7 & d==8, i=1; end;
if a==5 & b==6 & c==7 & d==8, i=1; end;

