0001 function poly = signatureToPolygon(signature, varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 nAngles = length(signature);
0020
0021
0022 angleList = linspace(0, 360, nAngles+1);
0023 angleList(end) = [];
0024
0025 if ~isempty(varargin)
0026 angleList = varargin{1};
0027 if length(angleList) ~= nAngles
0028 msg = 'signature and angle list must have same length (here %d and %d)';
0029 error(sprintf(msg, nAngles, length(angleList)));
0030 end
0031 end
0032
0033 poly = zeros(nAngles, 2);
0034 for iAngle = 1:nAngles
0035 angle = angleList(iAngle);
0036
0037 poly(iAngle, :) = signature(iAngle) * [cosd(angle) sind(angle)];
0038 end