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 | |
---|
1 | function expremovestraightsegments(newfilename,filename,cutoff)
|
---|
2 | %EXPREMOVESTRAIGHTSEGMENTS: remove straight segments connecting contours.
|
---|
3 | %
|
---|
4 | % Usage: expremovestraightsegments('argus.exp',100);
|
---|
5 | %
|
---|
6 | %
|
---|
7 |
|
---|
8 | a=expread(filename,1);
|
---|
9 | newcontours=a(1);
|
---|
10 |
|
---|
11 | for 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
|
---|
28 | end
|
---|
29 | newcontours=newcontours(2:end);
|
---|
30 |
|
---|
31 | expwrite(newcontours,newfilename);
|
---|
Note:
See
TracBrowser
for help on using the repository browser.