% POLYPLOT - 2-D Polygon plot % % Usage: hh = polyplot(pts,varargin) % % Arguments: pts - the 3xn or 2xn vertices of a polygon % varargin- variable inputs for plot options, eg. 'ro:' % see PLOT for more details % % Returns: hh - a vector of handles to the displayed triangles % % Author: % Tzu Yen Wong % wongt AT csse DOT uwa DOT edu DOT au % Department of Computer Science & Software Engineering % The University of Western Australia % % Date: March 2006 % % Example: % pts = rand(2,6); % polyplot(pts,'ro:') % % See also TRIPLOT, INPOLYGON function hh = polyplot(pts,varargin) sze = size(pts); if sze(1)>sze(2), pts = pts'; end x = [pts(1,:) pts(1,1)]; y = [pts(2,:) pts(2,1)]; h = plot(x,y,varargin{:}); if nargout == 1, hh = h; end