comparison private/EDB1plotpath.m @ 0:90220f7249fc

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