Skip to content
Snippets Groups Projects
Commit de3a7526 authored by Peter Reischig's avatar Peter Reischig Committed by Nicola Vigano
Browse files

Minor change in theta calculation in gtGeo

parent d898f7c2
No related branches found
No related tags found
No related merge requests found
......@@ -35,8 +35,8 @@ labAXYZ = gtGeoDet2Lab(detAUV,labgeo,0);
% Diffraction vectors from labXYZ to point A:
diffvec = labAXYZ - labBXYZ;
% Normalise diffvec-s:
dnorm = sqrt(diffvec(:,1).^2+diffvec(:,2).^2+diffvec(:,3).^2) ;
% Normalise diffvec-s (seems the fastest way for nx3 vectors):
dnorm = sqrt(diffvec(:,1).^2 + diffvec(:,2).^2 + diffvec(:,3).^2) ;
diffvec(:,1) = diffvec(:,1)./dnorm ;
diffvec(:,2) = diffvec(:,2)./dnorm ;
......@@ -46,9 +46,8 @@ diffvec(:,3) = diffvec(:,3)./dnorm ;
if nargout == 3
% Use the dot products of beamdir and diffvec to get theta
beamdir = repmat(labgeo.beamdir,size(diffvec,1),1);
theta = 0.5*acosd(dot(beamdir,diffvec,2));
theta = 0.5*acosd(diffvec*labgeo.beamdir');
end
......@@ -36,17 +36,17 @@
function [diffvec,labA,theta] = gtGeoDiffVecInLabPair(detUVA,detUVB,labgeo)
% Coordinate transformation from Detector to Lab
labA = gtGeoDet2Lab(detUVA,labgeo,0);
labB = gtGeoDet2Lab(detUVB,labgeo,0);
labA = gtGeoDet2Lab(detUVA, labgeo, 0);
labB = gtGeoDet2Lab(detUVB, labgeo, 0);
% Mirror B-s on the rotation axis while staying in the same LAB reference:
labBmirr = gtMathsMirrorPointsOnAxis(labB,labgeo.rotpos,labgeo.rotdir);
labBmirr = gtMathsMirrorPointsOnAxis(labB, labgeo.rotpos, labgeo.rotdir);
% Diffraction vectors for spot A are on the path from B mirrored to spot A:
diffvec = labA - labBmirr;
% Normalise diffvec-s:
dnorm = sqrt(diffvec(:,1).^2+diffvec(:,2).^2+diffvec(:,3).^2) ;
% Normalise diffvec-s (seems the fastest way for nx3 vectors):
dnorm = sqrt(diffvec(:,1).^2 + diffvec(:,2).^2 + diffvec(:,3).^2) ;
diffvec(:,1) = diffvec(:,1)./dnorm ;
diffvec(:,2) = diffvec(:,2)./dnorm ;
......@@ -56,7 +56,6 @@ diffvec(:,3) = diffvec(:,3)./dnorm ;
if nargout == 3
% Use the dot products of beamdir and diffvec to get theta
beamdir = repmat(labgeo.beamdir,size(diffvec,1),1);
theta = 0.5*acosd(dot(beamdir,diffvec,2));
theta = 0.5*acosd(diffvec*labgeo.beamdir');
end
......@@ -16,7 +16,6 @@
function thetas = gtGeoThetaFromDiffVec(diffvec,labgeo)
% Use the dot products of beamdir and diffvec to get theta
beamdir = repmat(labgeo.beamdir,size(diffvec,1),1);
thetas = 0.5*acosd(diffvec*labgeo.beamdir');
thetas = 0.5*acosd(dot(beamdir,diffvec,2));
end % of function
\ No newline at end of file
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