tp@0
|
1 function EDB1plotpath(eddatafile,reflpathsfile,plotoptions)
|
tp@0
|
2 % EDB1plotpath - Plots a model which is given in an eddatafile
|
tp@0
|
3 % and one or more of the paths in an edreflpathsfile.
|
tp@0
|
4 %
|
tp@0
|
5 % Input parameters:
|
tp@0
|
6 % eddatafile The input file.
|
tp@0
|
7 % reflpathsfile The file with reflpaths.
|
tp@0
|
8 % plotoptions The row in the reflpathsfile that should be plotted.
|
tp@0
|
9 %
|
tp@0
|
10 % Sources and receivers are taken from an sdatafile and an rdatafile, the file name of
|
tp@0
|
11 % which is assumed to be similar to the eddatafile.
|
tp@0
|
12 %
|
tp@0
|
13 % Uses functions EDB1strpend, EDB1myvalueinput
|
tp@0
|
14 %
|
tp@0
|
15 % ----------------------------------------------------------------------------------------------
|
tp@0
|
16 % This file is part of the Edge Diffraction Toolbox by Peter Svensson.
|
tp@0
|
17 %
|
tp@0
|
18 % The Edge Diffraction Toolbox is free software: you can redistribute it and/or modify
|
tp@0
|
19 % it under the terms of the GNU General Public License as published by the Free Software
|
tp@0
|
20 % Foundation, either version 3 of the License, or (at your option) any later version.
|
tp@0
|
21 %
|
tp@0
|
22 % The Edge Diffraction Toolbox is distributed in the hope that it will be useful,
|
tp@0
|
23 % but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
tp@0
|
24 % FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
tp@0
|
25 %
|
tp@0
|
26 % You should have received a copy of the GNU General Public License along with the
|
tp@0
|
27 % Edge Diffraction Toolbox. If not, see <http://www.gnu.org/licenses/>.
|
tp@0
|
28 % ----------------------------------------------------------------------------------------------
|
tp@0
|
29 % Peter Svensson (svensson@iet.ntnu.no) 20090708
|
tp@0
|
30 %
|
tp@0
|
31 % EDB1plotpath(eddatafile,reflpathsfile,plotoptions);
|
tp@0
|
32
|
tp@0
|
33 %--------------------------------------------------------------
|
tp@0
|
34 % Read the input files
|
tp@0
|
35
|
tp@0
|
36 [eddatafilepath,eddatafile,fileext] = fileparts(eddatafile);
|
tp@0
|
37 eddatafile = [eddatafile,fileext];
|
tp@0
|
38 Filestem = EDB1strpend(eddatafile,'_eddata');
|
tp@0
|
39
|
tp@0
|
40 [reflpathsfilepath,reflpathsfile,fileext] = fileparts(reflpathsfile);
|
tp@0
|
41 reflpathsfile = [reflpathsfile,fileext];
|
tp@0
|
42
|
tp@0
|
43 if ~isempty(eddatafilepath)
|
tp@0
|
44 eval(['load ',eddatafilepath,filesep,eddatafile])
|
tp@0
|
45 else
|
tp@0
|
46 eval(['load ',eddatafile])
|
tp@0
|
47 end
|
tp@0
|
48
|
tp@0
|
49 if ~isempty(reflpathsfilepath)
|
tp@0
|
50 eval(['load ',reflpathsfilepath,filesep,reflpathsfile])
|
tp@0
|
51 else
|
tp@0
|
52 eval(['load ',reflpathsfile])
|
tp@0
|
53 end
|
tp@0
|
54
|
tp@0
|
55 plotsources = 1;
|
tp@0
|
56 plotreceivers = 1;
|
tp@0
|
57
|
tp@0
|
58 %--------------------------------------------------------------
|
tp@0
|
59
|
tp@0
|
60 ncornersperplanevec = double(ncornersperplanevec);
|
tp@0
|
61 if plotsources
|
tp@0
|
62 sdatafile = [eddatafilepath,Filestem,'_sdata.mat'];
|
tp@0
|
63 if exist(sdatafile) == 2
|
tp@0
|
64 eval(['load ',sdatafile])
|
tp@0
|
65 else
|
tp@0
|
66 error(['ERROR: The sdata file named ',sdatafile,' could not be opened'])
|
tp@0
|
67 end
|
tp@0
|
68 end
|
tp@0
|
69 if plotreceivers
|
tp@0
|
70 rdatafile = [eddatafilepath,Filestem,'_rdata.mat'];
|
tp@0
|
71 if exist(rdatafile) == 2
|
tp@0
|
72 eval(['load ',rdatafile])
|
tp@0
|
73 else
|
tp@0
|
74 error(['ERROR: The rdata file named ',rdatafile,' could not be opened'])
|
tp@0
|
75 end
|
tp@0
|
76 end
|
tp@0
|
77
|
tp@0
|
78 %--------------------------------------------------------------
|
tp@0
|
79
|
tp@0
|
80 [ncorners,slask] = size(corners);
|
tp@0
|
81 [nedges,slask] = size(edgecorners);
|
tp@0
|
82 [nplanes,slask] = size(planenvecs);
|
tp@0
|
83
|
tp@0
|
84 planelist = 1:nplanes;
|
tp@0
|
85
|
tp@0
|
86 % viewpos = EDB1myvalueinput('From which point do you want to watch the model? (x y z, or az el, with spaces inbetween) ',-1);
|
tp@0
|
87 viewpos = [1 0 0];
|
tp@0
|
88 axis equal
|
tp@0
|
89
|
tp@0
|
90 hold off
|
tp@0
|
91 for ii = 1:nedges
|
tp@0
|
92 co1 = edgecorners(ii,1);
|
tp@0
|
93 co2 = edgecorners(ii,2);
|
tp@0
|
94 iv = [co1;co2];
|
tp@0
|
95 plot3(corners(iv,1),corners(iv,2),corners(iv,3))
|
tp@0
|
96 if ii ==1
|
tp@0
|
97 view(viewpos)
|
tp@0
|
98 hold
|
tp@0
|
99 end
|
tp@0
|
100 end
|
tp@0
|
101
|
tp@0
|
102 if plotsources == 1
|
tp@0
|
103 plot3(sources(:,1),sources(:,2),sources(:,3),'*');
|
tp@0
|
104 end
|
tp@0
|
105
|
tp@0
|
106 if plotreceivers == 1
|
tp@0
|
107 plot3(receivers(:,1),receivers(:,2),receivers(:,3),'ro');
|
tp@0
|
108 end
|
tp@0
|
109
|
tp@0
|
110 %---------------------------------------------------------------
|
tp@0
|
111 % Plot the path
|
tp@0
|
112
|
tp@0
|
113 pathtype = pathtypevec(plotoptions,:)
|
tp@0
|
114 reflpath = reflpaths(plotoptions,:)
|
tp@0
|
115 norder =sum(pathtype ~= 0);
|
tp@0
|
116 nspecorder = sum(pathtype == 115);
|
tp@0
|
117 speccols = find(pathtype == 115);
|
tp@0
|
118 diffcols = find(pathtype == 100);
|
tp@0
|
119
|
tp@0
|
120
|
tp@0
|
121 x1 = sources(1,1);
|
tp@0
|
122 y1 = sources(1,2);
|
tp@0
|
123 z1 = sources(1,3);
|
tp@0
|
124
|
tp@0
|
125 for ii = 1:nspecorder+1
|
tp@0
|
126 x2 = specextradata(plotoptions,1+3*(ii-1));
|
tp@0
|
127 y2 = specextradata(plotoptions,2+3*(ii-1));
|
tp@0
|
128 z2 = specextradata(plotoptions,3+3*(ii-1));
|
tp@0
|
129 plot3(x2,y2,z2,'o')
|
tp@0
|
130 line([x1;x2],[y1;y2],[z1;z2]);
|
tp@0
|
131 x1 = x2;
|
tp@0
|
132 y1 = y2;
|
tp@0
|
133 z1 = z2;
|
tp@0
|
134 end
|
tp@0
|
135
|
tp@0
|
136 x2 = receivers(1,1);
|
tp@0
|
137 y2 = receivers(1,2);
|
tp@0
|
138 z2 = receivers(1,3);
|
tp@0
|
139 line([x1;x2],[y1;y2],[z1;z2]);
|
tp@0
|
140
|
tp@0
|
141 % Print the involved plane numbers
|
tp@0
|
142
|
tp@0
|
143 reflplanes = reflpath(speccols);
|
tp@0
|
144
|
tp@0
|
145 for ii = reflplanes
|
tp@0
|
146 midpoint = mean(corners(planecorners(ii,1:ncornersperplanevec(ii)),:));
|
tp@0
|
147 endpoint = midpoint + planenvecs(ii,:);
|
tp@0
|
148 text(endpoint(1),endpoint(2),endpoint(3),int2str(ii));
|
tp@0
|
149 end
|
tp@0
|
150
|
tp@0
|
151 % Print the involved edge numbers
|
tp@0
|
152
|
tp@0
|
153 if ~isempty(diffcols)
|
tp@0
|
154 diffedges = reflpath(diffcols);
|
tp@0
|
155 for ii = diffedges
|
tp@0
|
156 midpoint = mean(corners(edgecorners(ii,1:2),:));
|
tp@0
|
157 text(midpoint(1),midpoint(2),midpoint(3),int2str(ii));
|
tp@0
|
158 co1 = edgecorners(ii,1);
|
tp@0
|
159 co2 = edgecorners(ii,2);
|
tp@0
|
160 iv = [co1;co2];
|
tp@0
|
161 h = plot3(corners(iv,1),corners(iv,2),corners(iv,3));
|
tp@0
|
162 set(h,'LineWidth',3)
|
tp@0
|
163
|
tp@0
|
164
|
tp@0
|
165 end
|
tp@0
|
166
|
tp@0
|
167 end
|