1 %% Copyright (c) 2011 Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
3 %% This program is free software: you can redistribute it and/or modify
4 %% it under the terms of the GNU General Public License as published by
5 %% the Free Software Foundation, either version 3 of the License, or
8 %% This program is distributed in the hope that it will be useful,
9 %% but WITHOUT ANY WARRANTY; without even the implied warranty of
10 %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 %% GNU General Public License for more details.
13 %% You should have received a copy of the GNU General Public License
14 %% along with this program. If not, see <http://www.gnu.org/licenses/>.
17 %% @deftypefn {Function File} {@var{h} = } shapeplot (@var{shape})
18 %% @deftypefnx {Function File} {@var{h} = } shapeplot (@var{shape}, @var{N})
19 %% @deftypefnx {Function File} {@var{h} = } shapeplot (@dots{}, @var{param}, @var{value})
20 %% Pots a 2D shape defined by piecewise smooth polynomials in the current axis.
22 %% @var{pp} is a cell where each elements is a 2-by-(poly_degree+1) matrix
23 %% containing a pair of polynomials.
24 %% @var{N} is the number of points to be used in non-straight edges.
25 %% Additional parameter value pairs are passed to @code{drawPolygon}.
27 %% @seealso{drawPolygon, shape2polygon}
30 function h = shapeplot(shape, varargin)
32 n = cell2mat(cellfun(@(x)curveval(x,rand(1,5)), shape, 'uniformoutput',false));
33 dr = (max(n(:,1))-min(n(:,1)))*(max(n(:,2))-min(n(:,2)))/100;
34 p = shape2polygon(shape,'tol', dr);
35 h = drawPolygon(p,varargin{:});