tp@0: function dirsoundok = EDB1directsound(eddatafile,S,R,visplanesfroms,visplanesfromr) tp@0: % EDB1directsound - Checks if the direct sound is valid. tp@0: % Checks if the direct sound path from a number of source tp@0: % points to a number of receiver points are obstructed by any planes. tp@0: % tp@0: % Input parameters: tp@0: % eddatafile The name of the file that contains all edge related data. tp@0: % This file will be loaded. tp@0: % S, R, visplanesfroms, visplanesfromr tp@0: % Data that should have been passed directly from the tp@0: % srdatafile. tp@0: % tp@0: % Global parameter: tp@0: % SHOWTEXT See EDB1mainISES tp@0: % tp@0: % Output parameter: tp@0: % dirsoundok 1 or 0, telling if the sound path is unobstructed or not. 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) 20030929 tp@0: % tp@0: % Uses the function EDB1chkISvisible tp@0: % tp@0: % dirsoundok = EDB1directsound(eddatafile,S,R,visplanesfroms,visplanesfromr); tp@0: tp@0: global SHOWTEXT tp@0: tp@0: eval(['load ',eddatafile]) tp@0: tp@0: [ncorners,slask] = size(corners); tp@0: [nplanes,ncornersperplane] = size(planecorners); tp@0: tp@0: %---------------------------------------------------------- tp@0: % Check if the direct sound is obscured tp@0: % tp@0: % Pick out the planes that are possible. Only potentially obstructing planes are necessary to check. tp@0: % Planes that are seen by the source or by the receiver, but not both tp@0: % are potentially obstructing. tp@0: tp@0: planesareseen = full( (double(visplanesfroms)==0 | double(visplanesfromr)==0) & (double(visplanesfroms)+double(visplanesfromr)~=0) ); tp@0: planestocheck = find(planesareseen.*canplaneobstruct.'); tp@0: nplanestocheck = length(planestocheck); tp@0: onesvec = ones(nplanestocheck,1); tp@0: tp@0: [hitplanes,reflpoints,edgehits,edgehitpoints,cornerhits,cornerhitpoints] = EDB1chkISvisible(S(onesvec,:),R(onesvec,:),planeeqs(planestocheck,4),planenvecs(planestocheck,:),minvals(planestocheck,:),... tp@0: maxvals(planestocheck,:),planecorners(planestocheck,:),corners,ncornersperplanevec(planestocheck)); tp@0: tp@0: if isempty(hitplanes) tp@0: dirsoundok = 1; tp@0: if SHOWTEXT >= 3 tp@0: disp(' direct sound OK') tp@0: end tp@0: else tp@0: dirsoundok = 0; tp@0: if SHOWTEXT >= 3 tp@0: disp(' direct sound obscured') tp@0: if SHOWTEXT >= 4, tp@0: printvec = int2str(planestocheck(hitplanes(1))); tp@0: for iiprint = 2:length(hitplanes); tp@0: printvec = [printvec,' ',int2str(planestocheck(hitplanes(iiprint)))]; tp@0: end tp@0: disp([' by:']) tp@0: disp([' ',printvec]) tp@0: end tp@0: end tp@0: end