tp@0
|
1 function [xis] = EDB1findis(xsou,ivec,planeeqs,nsou,onesvec)
|
tp@0
|
2 % EDB1findis - Returns the image source coordinates
|
tp@0
|
3 % Returns the image source coordinates
|
tp@0
|
4 % via mirroring one or N sources in a list of planes.
|
tp@0
|
5 %
|
tp@0
|
6 % Input parameters:
|
tp@0
|
7 % xsou Matrix, [N,3], of the source coordinates.
|
tp@0
|
8 % ivec List, [nplanes,1], of plane numbers that the source
|
tp@0
|
9 % should be mirrored in. If N ~= 1, then nplanes must
|
tp@0
|
10 % be = N.
|
tp@0
|
11 % planeeqs Matrix [nplanes,4] of the plane equations.
|
tp@0
|
12 % nsou The value N.
|
tp@0
|
13 % onesvec A list that should be = [1 1 1].
|
tp@0
|
14 %
|
tp@0
|
15 % Output paramaters:
|
tp@0
|
16 % xis Matrix [N,3] of all image sources to the source(s)
|
tp@0
|
17 % via all the planes specified in ivec and planeeqs.
|
tp@0
|
18 %
|
tp@0
|
19 % Uses no special functions
|
tp@0
|
20 %
|
tp@0
|
21 % ----------------------------------------------------------------------------------------------
|
tp@0
|
22 % This file is part of the Edge Diffraction Toolbox by Peter Svensson.
|
tp@0
|
23 %
|
tp@0
|
24 % The Edge Diffraction Toolbox is free software: you can redistribute it and/or modify
|
tp@0
|
25 % it under the terms of the GNU General Public License as published by the Free Software
|
tp@0
|
26 % Foundation, either version 3 of the License, or (at your option) any later version.
|
tp@0
|
27 %
|
tp@0
|
28 % The Edge Diffraction Toolbox is distributed in the hope that it will be useful,
|
tp@0
|
29 % but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
tp@0
|
30 % FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
tp@0
|
31 %
|
tp@0
|
32 % You should have received a copy of the GNU General Public License along with the
|
tp@0
|
33 % Edge Diffraction Toolbox. If not, see <http://www.gnu.org/licenses/>.
|
tp@0
|
34 % ----------------------------------------------------------------------------------------------
|
tp@0
|
35 % Peter Svensson (svensson@iet.ntnu.no) 20030706
|
tp@0
|
36 %
|
tp@0
|
37 % [xis] = EDB1findis(xsou,ivec,planeeqs,nsou,onesvec);
|
tp@0
|
38
|
tp@0
|
39 if nsou == 1
|
tp@0
|
40 Sbig = xsou(ones(length(ivec),1),:);
|
tp@0
|
41 t = planeeqs(ivec,4) - sum((planeeqs(ivec,1:3).').*(Sbig.')).';
|
tp@0
|
42
|
tp@0
|
43 xis = Sbig + 2*t(:,onesvec).*planeeqs(ivec,1:3);
|
tp@0
|
44 else
|
tp@0
|
45 t = planeeqs(ivec,4) - sum((planeeqs(ivec,1:3).').*(xsou.')).';
|
tp@0
|
46
|
tp@0
|
47 xis = xsou + 2*t(:,onesvec).*planeeqs(ivec,1:3);
|
tp@0
|
48 end
|
tp@0
|
49
|