0001 function [A,numprofiles,numpoints,closed]=addinsideprofile(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 if numpoints<2
0016 disp('at least two points are required')
0017 return
0018 end
0019 hold on
0020 loop=1;
0021
0022
0023 for i=1:numprofiles
0024 plot(A(i).x,A(i).y,'-rs','MarkerSize',10);
0025 end
0026
0027 while loop
0028
0029
0030 title('click on a segment, RETURN to exit','FontSize',14)
0031 [xi,yi] = ginput(1);
0032
0033
0034 if ~isempty(xi)
0035
0036
0037 [profsel indsel]=closestsegment(A,numprofiles,xi,yi);
0038
0039
0040 if indsel==0
0041 disp('at least two points in one profile are required')
0042 return
0043 end
0044
0045
0046 plot([A(profsel).x(indsel) A(profsel).x(indsel+1)],[A(profsel).y(indsel) A(profsel).y(indsel+1)],'b-','MarkerSize',10);
0047
0048
0049 title('click on the new point''s location, RETURN to exit','FontSize',14)
0050 [xi,yi,but] = ginput(1);
0051
0052
0053 if ~isempty(xi)
0054
0055
0056 A(profsel).x=[A(profsel).x(1:indsel,1); xi; A(profsel).x(indsel+1:end,1)];
0057 A(profsel).y=[A(profsel).y(1:indsel,1); yi; A(profsel).y(indsel+1:end,1)];
0058 numpoints=numpoints+1;
0059
0060
0061 undoplots(prevplot);
0062 for i=1:numprofiles
0063 plot(A(i).x,A(i).y,'-rs','MarkerSize',10);
0064 end
0065
0066 else
0067
0068 return
0069 end
0070 else
0071
0072 return
0073 end
0074 end
0075 end