Skip to content
Snippets Groups Projects
Commit bf1d0e64 authored by Nicola Vigano's avatar Nicola Vigano
Browse files

Small re-formatting

parent 7ec7af6e
No related branches found
No related tags found
No related merge requests found
function dlab = gtFedPredictDiffVecMultiple(pllab, beamdir)
% GTFEDPREDICTDIFFVECMULTIPLE Diffraction vectors from plane normals and
% GTFEDPREDICTDIFFVECMULTIPLE Diffraction vectors from plane normals and
% beam directions in the Lab reference. Vectorised for speed.
%
% dlab = gtFedPredictDiffVecMultiple(pllab, beamdir)
%
% --------------------------------------------------------------
%
% Returns the diffraction vectors for a set of plane normals and beam
% directions. All given in the Lab reference (i.e. turned into the omega
%
% Returns the diffraction vectors for a set of plane normals and beam
% directions. All given in the Lab reference (i.e. turned into the omega
% rotational position). Output 'dlab' is NOT normalised!
%
% INPUT
......@@ -18,37 +18,34 @@ function dlab = gtFedPredictDiffVecMultiple(pllab, beamdir)
% dlab - diffraction vectors (diffracted beam directions);
% NOT normalised! (3xn)
if (size(beamdir, 1) == 3) && (size(beamdir, 2) == 1)
dotpro = 2 * beamdir' * pllab;
dlab = beamdir(:, ones(1, size(pllab, 2))) - dotpro([1 1 1], :) .* pllab;
else
dotpro = 2 * sum(beamdir .* pllab, 1);
dlab = beamdir - dotpro([1 1 1], :) .* pllab;
end
% % Another way could be using sin(theta), but it's inefficient unless
% % the sign is known in advance.
% if isempty(sinth)
% ...
% else
% if size(beamdir,1)==3 && size(beamdir,2)==1
% % Need to consider the plane normal pointing opposite to the beam:
% pllabsign = -sign(beamdir'*pllab);
% pllab = pllabsign([1 1 1],:).*pllab;
%
% % Diffraction vector:
% dlab = 2*sinth([1 1 1],:).*pllab + beamdir(:,ones(1,size(pllab,2))) ;
%
% else
% % Need to consider the plane normal pointing opposite to the beam:
% pllabsign = -sign(sum(beamdir.*pllab,1));
% pllab = pllabsign([1 1 1],:).*pllab;
%
% % Diffraction vector:
% dlab = 2*sinth([1 1 1],:).*pllab + beamdir ;
% end
% end
if (all([size(beamdir, 1), size(beamdir, 2)] == [3, 1]))
dotpro = 2 * beamdir' * pllab;
dlab = beamdir(:, ones(1, size(pllab, 2))) - dotpro([1 1 1], :) .* pllab;
else
dotpro = 2 * sum(beamdir .* pllab, 1);
dlab = beamdir - dotpro([1 1 1], :) .* pllab;
end
end % end of function
\ No newline at end of file
% % Another way could be using sin(theta), but it's inefficient unless
% % the sign is known in advance.
% if isempty(sinth)
% ...
% else
% if size(beamdir,1)==3 && size(beamdir,2)==1
% % Need to consider the plane normal pointing opposite to the beam:
% pllabsign = -sign(beamdir'*pllab);
% pllab = pllabsign([1 1 1],:).*pllab;
%
% % Diffraction vector:
% dlab = 2*sinth([1 1 1],:).*pllab + beamdir(:,ones(1,size(pllab,2))) ;
%
% else
% % Need to consider the plane normal pointing opposite to the beam:
% pllabsign = -sign(sum(beamdir.*pllab,1));
% pllab = pllabsign([1 1 1],:).*pllab;
%
% % Diffraction vector:
% dlab = 2*sinth([1 1 1],:).*pllab + beamdir ;
% end
% end
end
function pl_lab = gtGeoPlLabFromThetaEta(thetas, etas, labgeo)
% FUNCTION pl_lab = gtGeoPlLabFromThetaEta(thetas, etas, labgeo)
% % Here just for reference!
%
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment