function [bx, by, bz] = TernBox(theAxes, nDimensions, theColor)

% TernBox -- Box for TernPlot.
 
% Copyright (C) 1996 Dr. Charles R. Denham, ZYDECO.
% All Rights Reserved.
 
% Version of 12-Sep-96 at 16:59:01.282.

if nargin < 1, theAxes = gca; end
if nargin < 2, nDimensions = 4; end
if nargin < 3, theColor = '-y'; end

x = [1 0 0 1 0 0 0 0];
y = [0 1 0 0 0 1 0 0];
z = [0 0 1 0 0 0 0 1];

if nDimensions < 4
   k = 1:4;
   x = x(k);
   y = y(k);
   z = z(k);
end

if nargout < 2
   axes(theAxes)
   h = TernPlot(x, y, z, theColor);
   if nargout > 0, bx = h; end
  else
   bx = x; by = y; bz = z;
end
