0001 function [A,numprofiles,numpoints,closed]=removepoints(A,numprofiles,numpoints,closed,prevplot,root);
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 if numprofiles==0
0012 disp('no profile present')
0013 return
0014 end
0015
0016 hold on
0017 loop=1;
0018
0019
0020 for i=1:numprofiles
0021 plot(A(i).x,A(i).y,'-rs','MarkerSize',10);
0022 end
0023
0024 while loop
0025
0026
0027 if numpoints==0
0028 disp('at least one point are needed')
0029 return
0030 end
0031
0032
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
0039 [profsel indsel]=closestpoint(A,numprofiles,xi,yi);
0040
0041
0042 A(profsel).x(indsel)=[];
0043 A(profsel).y(indsel)=[];
0044
0045
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
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
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
0075 loop=0;
0076 end
0077 end
0078 end