function fillpts(pts,color,varargin)
%   fillpts([p1;p2;...;pn])       % default color green
%   fillpts([p1;p2;...;pn],'r')   % color red 
% plots filled polygon with corner points p1,p2,...,pn
% which must be *row* vectors of length 2 or 3.
%
% Available colors are 'r','g','b','c','m','y','w','k' (black)
% This only works consistently if all points are in the same plane.
d = size(pts,2);
if nargin==1
  color = 'g';
end
if d==2
  fill(pts(:,1),pts(:,2),color,varargin{:});
elseif d==3
  fill3(pts(:,1),pts(:,2),pts(:,3),color,varargin{:});
else
  error('rows must have length 2 or 3')
end



