source: issm/trunk-jpl/src/m/contrib/uci/expremovestraightsegments.m@ 13646

Last change on this file since 13646 was 13646, checked in by Mathieu Morlighem, 12 years ago

CHG: cosmetics, removed multiple blank lines

File size: 672 bytes
Line 
1function expremovestraightsegments(newfilename,filename,cutoff)
2%EXPREMOVESTRAIGHTSEGMENTS: remove straight segments connecting contours.
3%
4% Usage: expremovestraightsegments('argus.exp',100);
5%
6%
7
8a=expread(filename,1);
9newcontours=a(1);
10
11for i=1:length(a),
12 contour=a(i);
13
14 s=sqrt(contour.x.^2+contour.y.^2);
15 d=diff(s);
16
17 pos=find(abs(d)>cutoff);
18 pos=[0;pos;length(contour.x)];
19
20 for j=1:length(pos)-1,
21
22 newcontour=contour;
23 newcontour.x=contour.x(pos(j)+1:pos(j+1));
24 newcontour.y=contour.y(pos(j)+1:pos(j+1));
25 newcontour.nods=length(newcontour.x);
26 newcontours(end+1)=newcontour;
27 end
28end
29newcontours=newcontours(2:end);
30
31expwrite(newcontours,newfilename);
Note: See TracBrowser for help on using the repository browser.