tp@0: function c = EDB1cross(a,b) tp@0: % EDB1cross - Stripped down version of Matlab's built in function cross. 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: % c = EDB1cross(a,b) tp@0: tp@0: %CROSS Vector cross product. tp@0: % C = CROSS(A,B) returns the cross product of the vectors tp@0: % A and B. That is, C = A x B. A and B must be 3 element tp@0: % vectors. tp@0: % tp@0: % C = CROSS(A,B) returns the cross product of A and B along the tp@0: % first dimension of length 3. tp@0: % tp@0: tp@0: % Clay M. Thompson tp@0: % updated 12-21-94, Denise Chen tp@0: % Copyright 1984-2002 The MathWorks, Inc. tp@0: % $Revision: 5.18 $ $Date: 2002/04/09 00:29:46 $ tp@0: tp@0: % Special case: A and B are vectors tp@0: %rowvec = 0; tp@0: %if ndims(a)==2 & ndims(b)==2 tp@0: % if size(a,1)==1, a = a(:); rowvec = 1; end tp@0: % if size(b,1)==1, b = b(:); rowvec = 1; end tp@0: %end; tp@0: tp@0: % Calculate cross product tp@0: c = [a(2,:).*b(3,:)-a(3,:).*b(2,:) tp@0: a(3,:).*b(1,:)-a(1,:).*b(3,:) tp@0: a(1,:).*b(2,:)-a(2,:).*b(1,:)]; tp@0: c = reshape(c,size(a));