annotate private/EDB1directsound.m @ 18:2d5f50205527 jabuilder_int tip

Escape the trailing backslash as well
author Chris Cannam
date Tue, 30 Sep 2014 16:23:00 +0100
parents 90220f7249fc
children
rev   line source
tp@0 1 function dirsoundok = EDB1directsound(eddatafile,S,R,visplanesfroms,visplanesfromr)
tp@0 2 % EDB1directsound - Checks if the direct sound is valid.
tp@0 3 % Checks if the direct sound path from a number of source
tp@0 4 % points to a number of receiver points are obstructed by any planes.
tp@0 5 %
tp@0 6 % Input parameters:
tp@0 7 % eddatafile The name of the file that contains all edge related data.
tp@0 8 % This file will be loaded.
tp@0 9 % S, R, visplanesfroms, visplanesfromr
tp@0 10 % Data that should have been passed directly from the
tp@0 11 % srdatafile.
tp@0 12 %
tp@0 13 % Global parameter:
tp@0 14 % SHOWTEXT See EDB1mainISES
tp@0 15 %
tp@0 16 % Output parameter:
tp@0 17 % dirsoundok 1 or 0, telling if the sound path is unobstructed or not.
tp@0 18 %
tp@0 19 % ----------------------------------------------------------------------------------------------
tp@0 20 % This file is part of the Edge Diffraction Toolbox by Peter Svensson.
tp@0 21 %
tp@0 22 % The Edge Diffraction Toolbox is free software: you can redistribute it and/or modify
tp@0 23 % it under the terms of the GNU General Public License as published by the Free Software
tp@0 24 % Foundation, either version 3 of the License, or (at your option) any later version.
tp@0 25 %
tp@0 26 % The Edge Diffraction Toolbox is distributed in the hope that it will be useful,
tp@0 27 % but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
tp@0 28 % FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
tp@0 29 %
tp@0 30 % You should have received a copy of the GNU General Public License along with the
tp@0 31 % Edge Diffraction Toolbox. If not, see <http://www.gnu.org/licenses/>.
tp@0 32 % ----------------------------------------------------------------------------------------------
tp@0 33 % Peter Svensson (svensson@iet.ntnu.no) 20030929
tp@0 34 %
tp@0 35 % Uses the function EDB1chkISvisible
tp@0 36 %
tp@0 37 % dirsoundok = EDB1directsound(eddatafile,S,R,visplanesfroms,visplanesfromr);
tp@0 38
tp@0 39 global SHOWTEXT
tp@0 40
tp@0 41 eval(['load ',eddatafile])
tp@0 42
tp@0 43 [ncorners,slask] = size(corners);
tp@0 44 [nplanes,ncornersperplane] = size(planecorners);
tp@0 45
tp@0 46 %----------------------------------------------------------
tp@0 47 % Check if the direct sound is obscured
tp@0 48 %
tp@0 49 % Pick out the planes that are possible. Only potentially obstructing planes are necessary to check.
tp@0 50 % Planes that are seen by the source or by the receiver, but not both
tp@0 51 % are potentially obstructing.
tp@0 52
tp@0 53 planesareseen = full( (double(visplanesfroms)==0 | double(visplanesfromr)==0) & (double(visplanesfroms)+double(visplanesfromr)~=0) );
tp@0 54 planestocheck = find(planesareseen.*canplaneobstruct.');
tp@0 55 nplanestocheck = length(planestocheck);
tp@0 56 onesvec = ones(nplanestocheck,1);
tp@0 57
tp@0 58 [hitplanes,reflpoints,edgehits,edgehitpoints,cornerhits,cornerhitpoints] = EDB1chkISvisible(S(onesvec,:),R(onesvec,:),planeeqs(planestocheck,4),planenvecs(planestocheck,:),minvals(planestocheck,:),...
tp@0 59 maxvals(planestocheck,:),planecorners(planestocheck,:),corners,ncornersperplanevec(planestocheck));
tp@0 60
tp@0 61 if isempty(hitplanes)
tp@0 62 dirsoundok = 1;
tp@0 63 if SHOWTEXT >= 3
tp@0 64 disp(' direct sound OK')
tp@0 65 end
tp@0 66 else
tp@0 67 dirsoundok = 0;
tp@0 68 if SHOWTEXT >= 3
tp@0 69 disp(' direct sound obscured')
tp@0 70 if SHOWTEXT >= 4,
tp@0 71 printvec = int2str(planestocheck(hitplanes(1)));
tp@0 72 for iiprint = 2:length(hitplanes);
tp@0 73 printvec = [printvec,' ',int2str(planestocheck(hitplanes(iiprint)))];
tp@0 74 end
tp@0 75 disp([' by:'])
tp@0 76 disp([' ',printvec])
tp@0 77 end
tp@0 78 end
tp@0 79 end