Warning, /utils/matlab/cs_grid/bk_line/clean_bk_line.m is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
28aaff1409 Jean*0001 function [ncut,icut,xcut,ycut,misfit,xyfit]=clean_bk_line( ...
0002 nf1,nf2,nc,ydim,yl,dylat,xMid,xx1,xx2,yy2, ...
0003 savI,savJ,savF,isav,jsav,xsav,nMx6t)
323aa12fe2 Jean*0004
0005 %- define "segments" = continuous part of the line : --> i,x,y_cut(:,1:2,:)
0006
28aaff1409 Jean*0007 ncut=zeros(6,1); icut=zeros(nc,6,6); xcut=zeros(nc,4,6); ycut=zeros(nc,4,6);
323aa12fe2 Jean*0008
0009 %- cut unused part of the line :
0010 for n=nf1:nf2, if nMx6t(n) > 1,
0011 iEnd=nMx6t(n); is=iEnd+1 ; ie=0;
0012 for i=2:iEnd,
0013 if savF(i-1,n) ~= 0, ie=i ; is=min(is,i-1); end
0014 if ie ~= 0 & ( savF(i-1,n) == 0 | i == iEnd ) ,
0015 ncut(n)=ncut(n)+1 ; in=ncut(n);
0016 icut(in,1,n)=is ; icut(in,2,n)=ie ;
0017 xcut(in,1,n)=xsav(is,n) ;
0018 ycut(in,1,n)=yy2(isav(is,n),jsav(is,n),n) ;
0019 xcut(in,2,n)=xsav(ie,n) ;
0020 ycut(in,2,n)=yy2(isav(ie,n),jsav(ie,n),n) ;
0021 is=iEnd+1 ; ie=0;
0022 end
0023 end
0024 end; end ;
0025
0026 %========================================================================
0027 %- detect fork and try to remove 1 branche : fill in icut(:,3:4,:)
0028
28aaff1409 Jean*0029 misfit=0; xyfit = 0;
323aa12fe2 Jean*0030 for n=nf1:nf2,
0031 for in=1:ncut(n),
0032 %-------------------------------------------------------------------------
0033 if icut(in,4,n) == 0,
0034 xyfit = 0;
0035 xnloc=xcut(in,2,n) ;
0036 ynloc=ycut(in,2,n) ;
0037
0038 %- check if segment ncut(n) stop somewhere in an other segment
0039 for p=nf1:nf2, if p ~= n, jj=0;
0040 for ip=1:ncut(p), if jj == 0 & xnloc > xcut(ip,1,p) & xnloc < xcut(ip,2,p),
0041 JJ=find(xsav(:,p) == xnloc) ;
0042 for j=1:length(JJ),
0043 yploc=yy2(isav(JJ(j),p),jsav(JJ(j),p),p);
0044 if ynloc == yploc & savF(JJ(j),p) ~= 0, jj=JJ(j) ; end
0045 end
0046 if jj ~= 0,
0047 yploc=yy2(isav(jj,p),jsav(jj,p),p);
0048 ypm1=yy2(isav(jj-1,p),jsav(jj-1,p),p);
0049 ynm1=yy2(isav(icut(in,2,n)-1,n),jsav(icut(in,2,n)-1,n),n);
0050 if abs(ypm1-yl) >= abs(ynm1-yl) & ...
0051 ( rem(isav(jj-1,p),nc) == 1 | rem(jsav(jj-1,p),nc) == 1 ),
0052 if icut(in,4,n) == 0, icut(in,4,n) = icut(in,2,n); xyfit=xyfit-1;
0053 else
0054 misfit=misfit+1; fprintf(['Multiple C n,in= %i %i ;', ...
0055 ' Stop : icut_2,4,xcut,ycut= %i %i %8.3f %8.3f \n'], ...
0056 n,in,icut(in,2,n),icut(in,4,n),xnloc,ynloc);
0057 fprintf(' in: p,ip,jj,icut= %i %i %i %i %i %8.3f %8.3f \n',...
0058 p,ip,jj,icut(ip,1,p),icut(ip,2,p),xcut(ip,1,p),xcut(ip,2,p) );
0059 end
0060 %----------------------
0061 ie = jj-1 ; is=icut(ip,3,p); if is == 0, is=icut(ip,1,p); end
0062 flag=0;
0063 if is < ie, yloc=zeros(1+ie-is,1) ;
0064 for i=is:ie, yloc(1+i-is)=yy2(isav(i,p),jsav(i,p),p)-yl;
0065 if rem(isav(i,p),nc) ~= 1 & rem(jsav(i,p),nc) ~= 1, flag=1 ; end
0066 end
0067 if min(yloc)*max(yloc) < 0, flag=1; end;
0068 end
0069 if flag == 1,
0070 %-- cut the segment (p,ip) in 2 parts :
0071 ip2=ncut(p)+1; icut(ip2,:,p)=icut(ip,:,p);
0072 xcut(ip2,:,p)=xcut(ip,:,p); ycut(ip2,:,p)=ycut(ip,:,p);
0073 icut(ip2,2,p)=ie ; icut(ip2,4,p)=0 ;
0074 xcut(ip2,2,p)=xsav(ie,p) ; ycut(ip2,2,p)=ypm1 ;
0075 icut(ip,1,p)=jj ; icut(ip,3,p)=jj ;
0076 xcut(ip,1,p)=xnloc; ycut(ip,1,p)=ynloc ;
0077 ncut(p)=ip2; xyfit=xyfit-1;
0078 if ydim == 1, fprintf([' p= %i ; cut_3 ip= %i in %3i %8.3f %8.3f', ...
0079 ' ; + add ip= %i \n'],p,ip,jj,xnloc,ynloc,ip2); end;
0080 %---
0081 elseif icut(ip,3,p) == 0, icut(ip,3,p) = jj; xyfit=xyfit-1;
0082 else
0083 misfit=misfit+1; fprintf(['Multiple C n,in= %i %i ;', ...
0084 ' stop : icut,xcut,ycut= %i %8.3f %8.3f \n'], ...
0085 n,in,icut(in,2,n),xnloc,ynloc);
0086 fprintf([' in: p,ip,jj,icut_312= %i %i %i %i %i %i', ...
0087 ' %8.3f %8.3f \n'], p,ip,jj, ...
0088 icut(ip,3,p),icut(ip,1,p),icut(ip,2,p),xcut(ip,1,p),xcut(ip,2,p) );
0089 end
0090 %----------------------
0091 end
0092 end
0093
0094 end; end; %-- for ip , if xnloc
0095 end; end; %-- for p , if p ~= n ,
0096 if ydim == 1 & xyfit ~= -2,
0097 fprintf(['n= %i fit= %i ; stop at: in,i,j= %i %2i %2i ;', ...
0098 ' X,Y= %8.3f %8.3f \n'], ...
0099 n,xyfit, in,isav(icut(in,2,n),n),jsav(icut(in,2,n),n),xnloc,ynloc);
0100 end;
0101
0102 end %-- if icut(in,4,n) == 0
0103 %-------------------------------------------------------------------------
0104
0105 %-------------------------------------------------------------------------
0106 if icut(in,3,n) == 0,
0107 xyfit = 0;
0108 xnloc=xcut(in,1,n) ;
0109 ynloc=ycut(in,1,n) ;
0110
0111 %- check that segment ncut(n) start somewhere in an other segment
0112 for p=nf1:nf2, if p ~= n, jj=0;
0113 for ip=1:ncut(p), if jj == 0 & xnloc > xcut(ip,1,p) & xnloc < xcut(ip,2,p),
0114 JJ=find(xsav(:,p) == xnloc) ;
0115 for j=1:length(JJ),
0116 yploc=yy2(isav(JJ(j),p),jsav(JJ(j),p),p);
0117 if ynloc == yploc & savF(JJ(j)-1,p) ~= 0, jj=JJ(j) ; end
0118 end
0119 if jj ~= 0,
0120 yploc=yy2(isav(jj,p),jsav(jj,p),p);
0121 ypp1=yy2(isav(jj+1,p),jsav(jj+1,p),p);
0122 ynp1=yy2(isav(icut(in,1,n)+1,n),jsav(icut(in,1,n)+1,n),n);
0123 if abs(ypp1-yl) >= abs(ynp1-yl) & ...
0124 ( rem(isav(jj+1,p),nc) == 1 | rem(jsav(jj+1,p),nc) == 1 ),
0125 if icut(in,3,n) == 0, icut(in,3,n) = icut(in,1,n); xyfit=xyfit-1;
0126 else
0127 misfit=misfit+1; fprintf(['Multiple C n,in= %i %i ;', ...
0128 ' Start : icut_1,3,xcut,ycut= %i %i %8.3f %8.3f \n'], ...
0129 n,in,icut(in,1,n),icut(in,3,n),xnloc,ynloc);
0130 fprintf(' in: p,ip,jj,icut= %i %i %i %i %i %8.3f %8.3f \n',...
0131 p,ip,jj,icut(ip,1,p),icut(ip,2,p),xcut(ip,1,p),xcut(ip,2,p) );
0132 end
0133 %----------------------
0134 is = jj+1 ; ie=icut(ip,4,p); if ie == 0, ie=icut(ip,2,p); end
0135 flag=0;
0136 if is < ie, yloc=zeros(1+ie-is,1) ;
0137 for i=is:ie, yloc(1+i-is)=yy2(isav(i,p),jsav(i,p),p)-yl;
0138 if rem(isav(i,p),nc) ~= 1 & rem(jsav(i,p),nc) ~= 1, flag=1 ; end
0139 end
0140 if min(yloc)*max(yloc) < 0, flag=1; end;
0141 end
0142 if flag == 1,
0143 %-- cut the segment (p,ip) in 2 parts :
0144 ip2=ncut(p)+1; icut(ip2,:,p)=icut(ip,:,p);
0145 xcut(ip2,:,p)=xcut(ip,:,p); ycut(ip2,:,p)=ycut(ip,:,p);
0146 icut(ip2,1,p)=is ; icut(ip2,3,p)=0 ;
0147 xcut(ip2,1,p)=xsav(is,p) ; ycut(ip2,1,p)=ypp1 ;
0148 icut(ip,2,p)=jj ; icut(ip,4,p)=jj ;
0149 xcut(ip,2,p)=xnloc; ycut(ip,2,p)=ynloc ;
0150 ncut(p)=ip2; xyfit=xyfit-1;
0151 if ydim == 1, fprintf([' p= %i ; cut_4 ip= %i in %3i %8.3f %8.3f', ...
0152 ' ; + add ip= %i \n'],p,ip,jj,xnloc,ynloc,ip2); end;
0153 %---
0154 elseif icut(ip,4,p) == 0, icut(ip,4,p) = jj; xyfit=xyfit-1;
0155 else
0156 misfit=misfit+1; fprintf(['Multiple C n,in= %i %i ;', ...
0157 ' start : icut,xcut,ycut= %i %8.3f %8.3f \n'], ...
0158 n,in,icut(in,1,n),xnloc,ynloc);
0159 fprintf([' in: p,ip,jj,icut_412= %i %i %i %i %i %i', ...
0160 ' %8.3f %8.3f \n'], p,ip,jj, ...
0161 icut(ip,4,p),icut(ip,1,p),icut(ip,2,p),xcut(ip,1,p),xcut(ip,2,p) );
0162 end
0163 %----------------------
0164 end
0165 end
0166
0167 end ; end; %-- for ip , if xnloc
0168 end; end; %-- for p , if p ~= n ,
0169 if ydim == 1 & xyfit ~= -2,
0170 fprintf(['n= %i fit= %i ; start at: in,i,j= %i %2i %2i ;', ...
0171 ' X,Y= %8.3f %8.3f \n'], ...
0172 n,xyfit, in,isav(icut(in,1,n),n),jsav(icut(in,1,n),n),xnloc,ynloc);
0173 end
0174
0175 end %-- if icut(in,3,n) == 0
0176 %-------------------------------------------------------------------------
0177
0178 end; end ; %- for n, for in=1:ncut(n)
0179
28aaff1409 Jean*0180 if misfit > 0, error(['misfit (',int2str(misfit),') in starting point']) ; end
323aa12fe2 Jean*0181
0182 %=========================================================================
0183
0184 %- check if segments are conected :
0185 % --> icut(:,3:4,:) & icut(:,5,:)= index of the next segment
0186
0187 for n=nf1:nf2, for in=1:ncut(n),
0188 %- fill in x,y_cut(3,4) :
0189 if icut(in,3,n) ~= 0, xcut(in,3,n)=xsav(icut(in,3,n),n);
0190 ycut(in,3,n)=yy2(isav(icut(in,3,n),n),jsav(icut(in,3,n),n),n); end
0191 if icut(in,4,n) ~= 0, xcut(in,4,n)=xsav(icut(in,4,n),n);
0192 ycut(in,4,n)=yy2(isav(icut(in,4,n),n),jsav(icut(in,4,n),n),n); end
0193
0194 if ydim == 0,
0195 fprintf(' n,in ; icut,xcut,ycut(1 -> 4) :\n');
0196 fprintf('n,in= %i %i',n,in);
0197 fprintf(' ; %3i %7.2f %7.2f',icut(in,1,n),xcut(in,1,n),ycut(in,1,n));
0198 fprintf(' ; %3i %7.2f %7.2f',icut(in,2,n),xcut(in,2,n),ycut(in,2,n));
0199 fprintf('\n'); fprintf(' ---> ');
0200 fprintf(' ; %3i %7.2f %7.2f',icut(in,3,n),xcut(in,3,n),ycut(in,3,n));
0201 fprintf(' ; %3i %7.2f %7.2f',icut(in,4,n),xcut(in,4,n),ycut(in,4,n));
0202 fprintf(' |=> %i %3i ',rem(icut(in,5,n),7),fix(icut(in,5,n)/7));
0203 fprintf('\n');
0204 end;
0205 end; end ; %- for n, for in=1:ncut(n)
0206
0207
0208 misfit=0;
0209 for n=nf1:nf2,
0210 for in=1:ncut(n),
0211 %-------------------------------------------------------------------------
0212
0213 if icut(in,5,n) == 0,
0214 xyfit = 0;
0215 ie=4 ; if icut(in,4,n) == 0, ie=2; end;
0216 xnloc=xcut(in,ie,n) ; ynloc=ycut(in,ie,n) ;
0217
0218 %- check that segment ncut(n) stop where some segment ncut(p) start
0219 for p=nf1:nf2,
0220 for ip=1:ncut(p),
0221 is=3 ; if icut(ip,3,p) == 0, is=1; end
0222 xploc=xcut(ip,is,p) ; yploc=ycut(ip,is,p) ;
0223 ddx = xploc - xnloc + 360 ; ddx=rem(ddx,360) ;
0224 if ddx == 0 & ynloc == yploc,
0225 if icut(in,5,n) == 0, icut(in,5,n)=p+ip*7 ;
0226 else
0227 misfit=misfit+1; fprintf(['Double C n,in,ie= %i %i %i;', ...
0228 ' Stop : icut_5: %i %2i ; p,ip,is= %i %i %i \n'],...
0229 n,in,ie,rem(icut(in,5,n),7),fix(icut(in,5,n)/7),p,ip,is);
0230 end
0231 if ie == 4 & is == 3, xyfit=xyfit+2;
0232 elseif ie == 2 & is == 1, xyfit=xyfit+2;
0233 icut(in,4,n) = icut(in,2,n);
0234 icut(ip,3,p) = icut(ip,1,p);
0235 else
0236 misfit=misfit+1; fprintf(['strange C n,in,ie= %i %i %i;', ...
0237 ' Stop : icut,xcut,ycut= %i %8.3f %8.3f ;', ...
0238 ' p,ip,is,icut= %i %i %i %i \n'],...
0239 n,in,ie,icut(in,ie,n),xnloc,ynloc,p,ip,is,icut(ip,is,p) );
0240 end
0241 end
0242 end; end; %-- for p , for ip
0243 if ydim == 1 & xyfit ~= 2,
0244 fprintf(['n= %i fit= %i ; Stop at: in,ie,i,j= %i %i %i %i ;', ...
0245 ' X,Y= %8.3f %8.3f \n'], ...
0246 n,xyfit, in,ie,isav(icut(in,ie,n),n),jsav(icut(in,ie,n),n),xnloc,ynloc);
0247 end
0248
0249 end; %-- if icut(in,4,n) == 0
0250 %-------------------------------------------------------------------------
0251
0252 end; end ; %- for n, for in=1:ncut(n)
0253
28aaff1409 Jean*0254 if misfit > 0, error(['misfit (',int2str(misfit),') in ending point']) ; end
323aa12fe2 Jean*0255
0256 %-- this part is not necessary :
0257 misfit=0;
0258 for n=nf1:nf2,
0259 for in=1:ncut(n),
0260 %-------------------------------------------------------------------------
0261
0262 if icut(in,3,n) == 0,
0263 xyfit = 0; is=1;
0264 xnloc=xcut(in,is,n) ; ynloc=ycut(in,is,n) ;
0265
0266 %- check that segment ncut(n) start where some segment ncut(p) stop
0267 for p=nf1:nf2,
0268 for ip=1:ncut(p),
0269 ie=4 ; if icut(ip,4,p) == 0, ie=2; end
0270 xploc=xcut(ip,ie,p) ; yploc=ycut(ip,ie,p) ;
0271 ddx = xploc - xnloc + 360 ; ddx=rem(ddx,360) ;
0272 if ddx == 0 & ynloc == yploc,
0273 ipp=icut(ip,5,p);
0274 if ipp == 0, icut(ip,5,p)=n+in*7 ;
0275 elseif n+in*7 ~= ipp ,
0276 misfit=misfit+1; fprintf(['Double C n,in,is= %i %i %i;', ...
0277 ' Start : p,ip,ie= %i %i %i ; icut_5: %i %2i\n'],...
0278 n,in,is,p,ip,ie,rem(ipp,7),fix(ipp/7));
0279 end
0280 if is == 3 & ie == 4, xyfit=xyfit+2;
0281 elseif is == 1 & ie == 2, xyfit=xyfit+2;
0282 icut(in,3,n) = icut(in,1,n);
0283 icut(ip,4,p) = icut(ip,2,p);
0284 else
0285 misfit=misfit+1; fprintf(['strange C n,in,is= %i %i %i;', ...
0286 ' Start : icut,xcut,ycut= %i %8.3f %8.3f ;', ...
0287 ' p,ip,ie,icut= %i %i %i %i \n'],...
0288 n,in,is,icut(in,is,n),xnloc,ynloc,p,ip,ie,icut(ip,ie,p) );
0289 end
0290 end
0291 end; end; %-- for p , for ip
0292 if ydim == 1 & xyfit ~= 2,
0293 fprintf(['n= %i fit= %i ; Start at: in,is,i,j= %i %i %i %i ;', ...
0294 ' X,Y= %8.3f %8.3f \n'], ...
0295 n,xyfit, in,is,isav(icut(in,is,n),n),jsav(icut(in,is,n),n),xnloc,ynloc);
0296 end;
0297
0298 end; %-- if icut(in,.3,n) == 0
0299 %-------------------------------------------------------------------------
0300
0301 end; end ; %- for n, for in=1:ncut(n)
0302
28aaff1409 Jean*0303 if misfit > 0, error(['misfit (',int2str(misfit),') in connection']) ; end
323aa12fe2 Jean*0304
0305 %=========================================================================
0306
0307 %-------------------------------------------------------------------------
0308 %-- Clean up the segment list :
0309 for n=nf1:nf2, for in=1:ncut(n),
0310
0311 %- fill in x,y_cut(3,4) :
0312 if icut(in,3,n) ~= 0, xcut(in,3,n)=xsav(icut(in,3,n),n);
0313 ycut(in,3,n)=yy2(isav(icut(in,3,n),n),jsav(icut(in,3,n),n),n); end
0314 if icut(in,4,n) ~= 0, xcut(in,4,n)=xsav(icut(in,4,n),n);
0315 ycut(in,4,n)=yy2(isav(icut(in,4,n),n),jsav(icut(in,4,n),n),n); end
0316
0317 if ydim == 1,
0318 fprintf(' n,in ; icut,xcut,ycut(1 -> 4) :\n');
0319 fprintf('n,in= %i %i',n,in);
0320 fprintf(' ; %3i %7.2f %7.2f',icut(in,1,n),xcut(in,1,n),ycut(in,1,n));
0321 fprintf(' ; %3i %7.2f %7.2f',icut(in,2,n),xcut(in,2,n),ycut(in,2,n));
0322 fprintf('\n'); fprintf(' ---> ');
0323 fprintf(' ; %3i %7.2f %7.2f',icut(in,3,n),xcut(in,3,n),ycut(in,3,n));
0324 fprintf(' ; %3i %7.2f %7.2f',icut(in,4,n),xcut(in,4,n),ycut(in,4,n));
0325 fprintf(' |=> %i %3i ',rem(icut(in,5,n),7),fix(icut(in,5,n)/7));
0326 fprintf('\n');
0327 end
0328
0329 %-------------------------
0330 if icut(in,6,n) == 0,
0331
0332 flag=0; xcirc = 0; ipp=n+7*in;
0333 while ipp > 0,
0334 p=rem(ipp,7); ip=fix(ipp/7);
0335 is=icut(ip,3,p); if is == 0, is=icut(ip,1,p); end
0336 ie=icut(ip,4,p); if ie == 0, ie=icut(ip,2,p); end
0337 for i=is:ie,
0338 if rem(isav(i,p),nc) ~= 1 & rem(jsav(i,p),nc) ~= 1, flag=1 ; end
0339 end
0340 xcirc = xcirc + xsav(ie,p) - xsav(is,p) ;
0341 ipp = icut(ip,5,p) ; if xcirc >= 360, ipp=0; end
0342 end ; ippEnd = icut(ip,5,p) ;
0343
0344 %-- if some valid Pts but a) not full circle or b) not connected: ==> misfit
0345 if flag == 1 & ( xcirc < 360 | icut(in,5,n) == 0 ),
0346 misfit=misfit+1;
0347 fprintf('yl= %8.3f ; WARNING: not full circle: %12.6f \n',yl,xcirc);
0348 ipp=n+7*in;
0349 while ipp > 0,
0350 p=rem(ipp,7); ip=fix(ipp/7);
0351 is=3; if icut(ip,3,p) == 0, is=1; end
0352 ie=4; if icut(ip,4,p) == 0, ie=2; end
0353 fprintf('p,ip= %i %i (is,e=%i,%i)',p,ip,is,ie);
0354 fprintf(' ; %3i %7.2f %7.2f',icut(ip,is,p),xcut(ip,is,p),ycut(ip,is,p));
0355 fprintf(' ; %3i %7.2f %7.2f',icut(ip,ie,p),xcut(ip,ie,p),ycut(ip,ie,p));
0356 fprintf(' (%i) |=> %i %3i\n',icut(ip,6,p), ...
0357 rem(icut(in,5,n),7),fix(icut(in,5,n)/7) );
0358 ipp = icut(ip,5,p) ;
0359 end
0360 %-- if make a full circle => tag all the segments
0361 elseif xcirc >= 360,
0362 ipp=n+7*in;
0363 while ( ipp > 0 & ipp ~= ippEnd),
0364 p=rem(ipp,7); ip=fix(ipp/7); icut(ip,6,p)=flag;
0365 ipp = icut(ip,5,p) ;
0366 end
0367 %-- if only on the edge (flag=0) & not making a full circle ==> remove segment
0368 elseif flag == 0,
0369 ipp=n+7*in;
0370 while ( ipp > 0 ),
0371 p=rem(ipp,7); ip=fix(ipp/7); icut(ip,6,p)=-1;
0372 % icut(ip,3,p)=-2; icut(ip,4,p)=-1;
0373 ipp = icut(ip,5,p) ;
0374 end
0375 %--
0376 end
0377
0378 end %-- if icut(in,6,n) = 0
0379 %-------------------------
0380 %if icut(in,3,n) == 0 & icut(in,4,n) == 0,
0381 % flag=0;
0382 % for i=icut(in,1,n):icut(in,2,n),
0383 % if rem(isav(i,n),nc) ~= 1 & rem(jsav(i,n),nc) ~= 1, flag=1 ; end
0384 % end
0385 %-- remove disconected segments ; or WARNING if not empty
0386 % if flag == 0, icut(in,3,n)=-2; icut(in,4,n)=-1;
0387 % else misfit=misfit+1;
0388 % fprintf('yl= %8.3f ; WARNING: found Isolated segment:\n',yl);
0389 % fprintf('n,in= %i %i',n,in);
0390 % fprintf(' ; %3i %7.2f %7.2f',icut(in,1,n),xcut(in,1,n),ycut(in,1,n));
0391 % fprintf(' ; %3i %7.2f %7.2f',icut(in,2,n),xcut(in,2,n),ycut(in,2,n));
0392 % fprintf('\n');
0393 % end
0394 %elseif icut(in,3,n) == 0, misfit=misfit+1;
0395 % fprintf('yl= %8.3f ; WARNING: isolated start :\n',yl);
0396 % fprintf('n,in= %i %i',n,in);
0397 % fprintf(' ; %3i %7.2f %7.2f',icut(in,1,n),xcut(in,1,n),ycut(in,1,n));
0398 % fprintf(' ; %3i %7.2f %7.2f',icut(in,4,n),xcut(in,4,n),ycut(in,4,n));
0399 % fprintf('\n');
0400 %elseif icut(in,4,n) == 0, misfit=misfit+1;
0401 % fprintf('yl= %8.3f ; WARNING: isolated end :\n',yl);
0402 % fprintf('n,in= %i %i',n,in);
0403 % fprintf(' ; %3i %7.2f %7.2f',icut(in,3,n),xcut(in,3,n),ycut(in,3,n));
0404 % fprintf(' ; %3i %7.2f %7.2f',icut(in,2,n),xcut(in,2,n),ycut(in,2,n));
0405 % fprintf('\n');
0406 %end
0407 %if icut(in,3,n) == 0, icut(in,3,n) = icut(in,1,n) ;
0408 % xcut(in,3,n)=xcut(in,1,n); ycut(in,3,n)=ycut(in,1,n) ;
0409 %end
0410 %if icut(in,4,n) == 0, icut(in,4,n) = icut(in,2,n) ;
0411 % xcut(in,4,n)=xcut(in,2,n); ycut(in,4,n)=ycut(in,2,n) ;
0412 %end
0413
0414 end; end;
0415 %-------------------------------------------------------------------------
0416
0417 return