function theTern = Tern(theName, x, y, z, c)

% Tern -- Create a TERN object.
%  Tern((x, y, z, c) creates a TERN object to manage
%   the ternary-plot of data (x, y, z) and color c.
%   The figure handle is returned.
 
% Copyright (C) 1996 Dr. Charles R. Denham, ZYDECO.
% All Rights Reserved.
 
% Version of 14-Mar-96 at 09:04:10.41.

if nargin < 1, theName = 'Tern Window'; end
if nargin < 2, x = []; end
if nargin < 3, y = []; end
if nargin < 4, z = []; end
if nargin < 5, c = ''; end

Class('TERN', 'FSW')

if strcmp(theName, 'demo')
   hold off
   theName = 'Tern Demo';
   t = Tern(theName, 10, 3);
   hold on
   TernText('x', 'Sand')
   TernText('y', 'Silt')
   TernText('z', 'Clay')
   TernText('w', 'Gravel')
   hold off
   return
end

if nargin < 2
   t = DoNew('TERN', theName);
  elseif nargin == 2
   t = DoNew('TERN', theName, x);
  elseif nargin == 3
   t = DoNew('TERN', theName, x, y);
  elseif nargin == 4
   t = DoNew('TERN', theName, x, y, z);
  elseif nargin == 5
   t = DoNew('TERN', theName, x, y, z, c);
end

if nargout > 0, theTern = DoGetUI(t); end
