tp@0: function EDB1plotpath(eddatafile,reflpathsfile,plotoptions) tp@0: % EDB1plotpath - Plots a model which is given in an eddatafile tp@0: % and one or more of the paths in an edreflpathsfile. tp@0: % tp@0: % Input parameters: tp@0: % eddatafile The input file. tp@0: % reflpathsfile The file with reflpaths. tp@0: % plotoptions The row in the reflpathsfile that should be plotted. tp@0: % tp@0: % Sources and receivers are taken from an sdatafile and an rdatafile, the file name of tp@0: % which is assumed to be similar to the eddatafile. tp@0: % tp@0: % Uses functions EDB1strpend, EDB1myvalueinput tp@0: % tp@0: % ---------------------------------------------------------------------------------------------- tp@0: % This file is part of the Edge Diffraction Toolbox by Peter Svensson. tp@0: % tp@0: % The Edge Diffraction Toolbox is free software: you can redistribute it and/or modify tp@0: % it under the terms of the GNU General Public License as published by the Free Software tp@0: % Foundation, either version 3 of the License, or (at your option) any later version. tp@0: % tp@0: % The Edge Diffraction Toolbox is distributed in the hope that it will be useful, tp@0: % but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS tp@0: % FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. tp@0: % tp@0: % You should have received a copy of the GNU General Public License along with the tp@0: % Edge Diffraction Toolbox. If not, see . tp@0: % ---------------------------------------------------------------------------------------------- tp@0: % Peter Svensson (svensson@iet.ntnu.no) 20090708 tp@0: % tp@0: % EDB1plotpath(eddatafile,reflpathsfile,plotoptions); tp@0: tp@0: %-------------------------------------------------------------- tp@0: % Read the input files tp@0: tp@0: [eddatafilepath,eddatafile,fileext] = fileparts(eddatafile); tp@0: eddatafile = [eddatafile,fileext]; tp@0: Filestem = EDB1strpend(eddatafile,'_eddata'); tp@0: tp@0: [reflpathsfilepath,reflpathsfile,fileext] = fileparts(reflpathsfile); tp@0: reflpathsfile = [reflpathsfile,fileext]; tp@0: tp@0: if ~isempty(eddatafilepath) tp@0: eval(['load ',eddatafilepath,filesep,eddatafile]) tp@0: else tp@0: eval(['load ',eddatafile]) tp@0: end tp@0: tp@0: if ~isempty(reflpathsfilepath) tp@0: eval(['load ',reflpathsfilepath,filesep,reflpathsfile]) tp@0: else tp@0: eval(['load ',reflpathsfile]) tp@0: end tp@0: tp@0: plotsources = 1; tp@0: plotreceivers = 1; tp@0: tp@0: %-------------------------------------------------------------- tp@0: tp@0: ncornersperplanevec = double(ncornersperplanevec); tp@0: if plotsources tp@0: sdatafile = [eddatafilepath,Filestem,'_sdata.mat']; tp@0: if exist(sdatafile) == 2 tp@0: eval(['load ',sdatafile]) tp@0: else tp@0: error(['ERROR: The sdata file named ',sdatafile,' could not be opened']) tp@0: end tp@0: end tp@0: if plotreceivers tp@0: rdatafile = [eddatafilepath,Filestem,'_rdata.mat']; tp@0: if exist(rdatafile) == 2 tp@0: eval(['load ',rdatafile]) tp@0: else tp@0: error(['ERROR: The rdata file named ',rdatafile,' could not be opened']) tp@0: end tp@0: end tp@0: tp@0: %-------------------------------------------------------------- tp@0: tp@0: [ncorners,slask] = size(corners); tp@0: [nedges,slask] = size(edgecorners); tp@0: [nplanes,slask] = size(planenvecs); tp@0: tp@0: planelist = 1:nplanes; tp@0: tp@0: % viewpos = EDB1myvalueinput('From which point do you want to watch the model? (x y z, or az el, with spaces inbetween) ',-1); tp@0: viewpos = [1 0 0]; tp@0: axis equal tp@0: tp@0: hold off tp@0: for ii = 1:nedges tp@0: co1 = edgecorners(ii,1); tp@0: co2 = edgecorners(ii,2); tp@0: iv = [co1;co2]; tp@0: plot3(corners(iv,1),corners(iv,2),corners(iv,3)) tp@0: if ii ==1 tp@0: view(viewpos) tp@0: hold tp@0: end tp@0: end tp@0: tp@0: if plotsources == 1 tp@0: plot3(sources(:,1),sources(:,2),sources(:,3),'*'); tp@0: end tp@0: tp@0: if plotreceivers == 1 tp@0: plot3(receivers(:,1),receivers(:,2),receivers(:,3),'ro'); tp@0: end tp@0: tp@0: %--------------------------------------------------------------- tp@0: % Plot the path tp@0: tp@0: pathtype = pathtypevec(plotoptions,:) tp@0: reflpath = reflpaths(plotoptions,:) tp@0: norder =sum(pathtype ~= 0); tp@0: nspecorder = sum(pathtype == 115); tp@0: speccols = find(pathtype == 115); tp@0: diffcols = find(pathtype == 100); tp@0: tp@0: tp@0: x1 = sources(1,1); tp@0: y1 = sources(1,2); tp@0: z1 = sources(1,3); tp@0: tp@0: for ii = 1:nspecorder+1 tp@0: x2 = specextradata(plotoptions,1+3*(ii-1)); tp@0: y2 = specextradata(plotoptions,2+3*(ii-1)); tp@0: z2 = specextradata(plotoptions,3+3*(ii-1)); tp@0: plot3(x2,y2,z2,'o') tp@0: line([x1;x2],[y1;y2],[z1;z2]); tp@0: x1 = x2; tp@0: y1 = y2; tp@0: z1 = z2; tp@0: end tp@0: tp@0: x2 = receivers(1,1); tp@0: y2 = receivers(1,2); tp@0: z2 = receivers(1,3); tp@0: line([x1;x2],[y1;y2],[z1;z2]); tp@0: tp@0: % Print the involved plane numbers tp@0: tp@0: reflplanes = reflpath(speccols); tp@0: tp@0: for ii = reflplanes tp@0: midpoint = mean(corners(planecorners(ii,1:ncornersperplanevec(ii)),:)); tp@0: endpoint = midpoint + planenvecs(ii,:); tp@0: text(endpoint(1),endpoint(2),endpoint(3),int2str(ii)); tp@0: end tp@0: tp@0: % Print the involved edge numbers tp@0: tp@0: if ~isempty(diffcols) tp@0: diffedges = reflpath(diffcols); tp@0: for ii = diffedges tp@0: midpoint = mean(corners(edgecorners(ii,1:2),:)); tp@0: text(midpoint(1),midpoint(2),midpoint(3),int2str(ii)); tp@0: co1 = edgecorners(ii,1); tp@0: co2 = edgecorners(ii,2); tp@0: iv = [co1;co2]; tp@0: h = plot3(corners(iv,1),corners(iv,2),corners(iv,3)); tp@0: set(h,'LineWidth',3) tp@0: tp@0: tp@0: end tp@0: tp@0: end