function tes = delaunay3(x,y,z)
%DELAUNAY3  3-D Delaunay tessellation.
%   T = DELAUNAY3(X,Y,Z) returns a numt-by-4 array T. The entries
%   in each row of T are indices of the points in (X,Y,Z) forming a
%   tetrahedron in the tessellation of (X,Y,Z).
%
%   DELAUNAY3 is based on Qhull. 
%
%   See also QHULL, DELAUNAY, DELAUNAYN, GRIDDATA3, GRIDDATAN, VORONOIN.

%   Copyright 1984-2000 The MathWorks, Inc.
%   $Revision: 1.5 $ $Date: 2000/08/18 19:42:34 $

if nargin ~= 3
  error('DELAUNAY3 requires exactly 3 input arguments.');
end

if prod(size(x)) ~= prod(size(y)) | prod(size(x)) ~= prod(size(z))
  error('X,Y,Z have to be the same size.');
end

% call delaunayn 
tes = delaunayn([x(:) y(:) z(:)]);
