Home > matGeom > polygons2d > signatureToPolygon.m

signatureToPolygon

PURPOSE ^

SIGNATURETOPOLYGON Reconstruct a polygon from its polar signature.

SYNOPSIS ^

function poly = signatureToPolygon(signature, varargin)

DESCRIPTION ^

SIGNATURETOPOLYGON Reconstruct a polygon from its polar signature.

   POLY = signatureToPolygon(SIGNATURE)
   POLY = signatureToPolygon(SIGNATURE, ANGLES)

   Example
   signatureToPolygon

   See also
     polygonSignature

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function poly = signatureToPolygon(signature, varargin)
0002 %SIGNATURETOPOLYGON Reconstruct a polygon from its polar signature.
0003 %
0004 %   POLY = signatureToPolygon(SIGNATURE)
0005 %   POLY = signatureToPolygon(SIGNATURE, ANGLES)
0006 %
0007 %   Example
0008 %   signatureToPolygon
0009 %
0010 %   See also
0011 %     polygonSignature
0012 
0013 % ------
0014 % Author: David Legland
0015 % E-mail: david.legland@inrae.fr
0016 % Created: 2015-04-28, using Matlab 8.4.0.150421 (R2014b)
0017 % Copyright 2015-2024 INRA - Cepia Software Platform
0018 
0019 nAngles = length(signature);
0020 
0021 % compute default signature
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))); %#ok<SPERR>
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

Generated on Thu 21-Nov-2024 11:30:22 by m2html © 2003-2022