removepoints

PURPOSE ^

REMOVEPOINTS - remove a point from a profile

SYNOPSIS ^

function [A,numprofiles,numpoints,closed]=removepoints(A,numprofiles,numpoints,closed,prevplot,root);

DESCRIPTION ^

REMOVEPOINTS - remove a point from a profile

   this script is used by expmaster as an elementary operation
   on an ARGUS profile

   Usage:
      [A,numprofiles,numpoints,closed]=removepoints(A,numprofiles,numpoints,closed,prevplot,root)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [A,numprofiles,numpoints,closed]=removepoints(A,numprofiles,numpoints,closed,prevplot,root);
0002 %REMOVEPOINTS - remove a point from a profile
0003 %
0004 %   this script is used by expmaster as an elementary operation
0005 %   on an ARGUS profile
0006 %
0007 %   Usage:
0008 %      [A,numprofiles,numpoints,closed]=removepoints(A,numprofiles,numpoints,closed,prevplot,root)
0009         
0010     %some checks
0011     if numprofiles==0
0012         disp('no profile present')
0013         return
0014     end
0015 
0016     hold on
0017     loop=1;
0018 
0019     %plot squares
0020     for i=1:numprofiles
0021         plot(A(i).x,A(i).y,'-rs','MarkerSize',10);
0022     end
0023 
0024     while loop
0025 
0026         %check that at least one point is present
0027         if numpoints==0
0028             disp('at least one point are needed')
0029             return
0030         end       
0031 
0032         %select a point to be deleted
0033         title('click on the point to be removed, RETURN to exit','FontSize',14)
0034         [xi,yi] = ginput(1);
0035 
0036         if ~isempty(xi)
0037 
0038             %get the closest point
0039             [profsel indsel]=closestpoint(A,numprofiles,xi,yi);
0040 
0041             %remove point of A
0042             A(profsel).x(indsel)=[];
0043             A(profsel).y(indsel)=[];
0044 
0045             %unclose the domain if only 2 points remaining
0046             if closed(profsel)
0047                 if length(A(profsel).x)==3
0048                     A(profsel).x(end)=[];
0049                     A(profsel).y(end)=[];
0050                     numpoints=numpoints-1;
0051                     closed(profsel)=0;
0052                 end
0053             end
0054 
0055             %remove the last point if the profile is closed and indsel=end or 1
0056             if closed(profsel)
0057                 if indsel==1 
0058                     A(profsel).x(end)=A(profsel).x(1);
0059                     A(profsel).y(end)=A(profsel).y(1);
0060                 elseif indsel==length(A(profsel).x)
0061                     A(profsel).x(1)=A(profsel).x(end);
0062                     A(profsel).y(1)=A(profsel).y(end);
0063                 end
0064             end
0065             numpoints=numpoints-1;
0066 
0067             %plot new profile
0068             undoplots(prevplot);
0069             for i=1:numprofiles
0070                 plot(A(i).x,A(i).y,'-rs','MarkerSize',10);
0071             end
0072 
0073         else
0074             %RETURN-> exit
0075             loop=0;
0076         end
0077     end
0078 end

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003