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

Substituted 'repmat' command.

parent de3a7526
No related branches found
No related tags found
No related merge requests found
...@@ -31,13 +31,13 @@ ...@@ -31,13 +31,13 @@
function projUV = gtGeoPointProjectionsOnDetector(labXYZ,projvecs,labgeo) function projUV = gtGeoPointProjectionsOnDetector(labXYZ,projvecs,labgeo)
% Multiplication factor for projection vector % Multiplication factor for projection vector
mf = (((labgeo.detorig-labXYZ)*labgeo.detnorm')./(projvecs*labgeo.detnorm')); mf = (((labgeo.detorig - labXYZ) * labgeo.detnorm') ./ (projvecs * labgeo.detnorm'));
% Projected points in Lab coordinates X,Y,Z % Projected points in Lab coordinates X,Y,Z
projXYZ = repmat(labXYZ,size(projvecs,1),1) + repmat(mf,1,3).*projvecs ; projXYZ = labXYZ(ones(size(projvecs,1),1),:) + [mf mf mf].*projvecs ;
% Projected points in Scintillator coordinates U,V % Projected points in Scintillator coordinates U,V
projUV = (projXYZ-repmat(labgeo.detorig,size(projvecs,1),1))*... projUV = (projXYZ - labgeo.detorig(ones(size(projvecs,1),1),:))*...
[labgeo.detdiru'/labgeo.pixelsizeu, labgeo.detdirv'/labgeo.pixelsizev]; [labgeo.detdiru'/labgeo.pixelsizeu, labgeo.detdirv'/labgeo.pixelsizev];
% Check if out of detector U,V range or projection is away from detector % Check if out of detector U,V range or projection is away from detector
......
...@@ -82,17 +82,17 @@ tanp(5:6,:) = gtMathsCircleTangents(spdirvtop,topcenter,labgeo.samenvrad,labgeo. ...@@ -82,17 +82,17 @@ tanp(5:6,:) = gtMathsCircleTangents(spdirvtop,topcenter,labgeo.samenvrad,labgeo.
tanp(7:8,:) = gtMathsCircleTangents(spdirvbot,botcenter,labgeo.samenvrad,labgeo.rotdir); tanp(7:8,:) = gtMathsCircleTangents(spdirvbot,botcenter,labgeo.samenvrad,labgeo.rotdir);
% project the tangent points onto the pseudo detector from the spot: % project the tangent points onto the pseudo detector from the spot:
tanpproj(1,:) = gtMathsProjectPointsOnPlane(tanp(1,:),tanp(1,:)-spXYZ,detorigmirr,detnormmirr); tanpproj(1,:) = gtMathsProjectPointsOnPlane(tanp(1,:), tanp(1,:)-spXYZ, detorigmirr, detnormmirr);
tanpproj(2,:) = gtMathsProjectPointsOnPlane(tanp(2,:),tanp(2,:)-spXYZ,detorigmirr,detnormmirr); tanpproj(2,:) = gtMathsProjectPointsOnPlane(tanp(2,:), tanp(2,:)-spXYZ, detorigmirr, detnormmirr);
tanpproj(3,:) = gtMathsProjectPointsOnPlane(tanp(3,:),tanp(3,:)-spXYZ,detorigmirr,detnormmirr); tanpproj(3,:) = gtMathsProjectPointsOnPlane(tanp(3,:), tanp(3,:)-spXYZ, detorigmirr, detnormmirr);
tanpproj(4,:) = gtMathsProjectPointsOnPlane(tanp(4,:),tanp(4,:)-spXYZ,detorigmirr,detnormmirr); tanpproj(4,:) = gtMathsProjectPointsOnPlane(tanp(4,:), tanp(4,:)-spXYZ, detorigmirr, detnormmirr);
tanpproj(5,:) = gtMathsProjectPointsOnPlane(tanp(5,:),tanp(5,:)-spXYZ,detorigmirr,detnormmirr); tanpproj(5,:) = gtMathsProjectPointsOnPlane(tanp(5,:), tanp(5,:)-spXYZ, detorigmirr, detnormmirr);
tanpproj(6,:) = gtMathsProjectPointsOnPlane(tanp(6,:),tanp(6,:)-spXYZ,detorigmirr,detnormmirr); tanpproj(6,:) = gtMathsProjectPointsOnPlane(tanp(6,:), tanp(6,:)-spXYZ, detorigmirr, detnormmirr);
tanpproj(7,:) = gtMathsProjectPointsOnPlane(tanp(7,:),tanp(7,:)-spXYZ,detorigmirr,detnormmirr); tanpproj(7,:) = gtMathsProjectPointsOnPlane(tanp(7,:), tanp(7,:)-spXYZ, detorigmirr, detnormmirr);
tanpproj(8,:) = gtMathsProjectPointsOnPlane(tanp(8,:),tanp(8,:)-spXYZ,detorigmirr,detnormmirr); tanpproj(8,:) = gtMathsProjectPointsOnPlane(tanp(8,:), tanp(8,:)-spXYZ, detorigmirr, detnormmirr);
% transform the tangent points Lab coordinates into the pseudo detector coordinates: % transform the tangent points Lab coordinates into the pseudo detector coordinates:
tanpprojvec = tanpproj - repmat(detorigmirr,8,1) ; tanpprojvec = tanpproj - detorigmirr(ones(8,1),:);
tanpprojU = (tanpprojvec*detdirumirr')/labgeo.pixelsizeu; tanpprojU = (tanpprojvec*detdirumirr')/labgeo.pixelsizeu;
tanpprojV = (tanpprojvec*detdirvmirr')/labgeo.pixelsizev; tanpprojV = (tanpprojvec*detdirvmirr')/labgeo.pixelsizev;
......
...@@ -2,28 +2,34 @@ ...@@ -2,28 +2,34 @@
% FUNCTION scattvec = gtGeoScattVecFromDiffVec(diffvec,beamdir) % FUNCTION scattvec = gtGeoScattVecFromDiffVec(diffvec,beamdir)
% %
% Given a set of diffraction vectors with their Lab coordinates X,Y,Z and % Given a set of diffraction vectors with their Lab coordinates X,Y,Z and
% the incoming beam direction, the function returns the corresponding % the incoming beam direction, the function returns the Lab coordinates
% unit scattering vectors (plane normals). % of the corresponding unit scattering vectors (plane normals)
% The diffraction vectors indicate the direction of the diffracted beam % The diffraction vectors indicate the direction of the diffracted beam
% paths. The scattering vectors are computed as: diffvec - beamdir . % paths. The scattering vectors are computed as: diffvec - beamdir .
% %
% INPUT diffvec - Lab coordinates X,Y,Z of a set of diffraction vectors (n,3) % INPUT diffvec - Lab coordinates X,Y,Z of a set of diffraction vectors;
% unit vectors! (n,3)
% beamdir - Lab coordinates X,Y,Z of the incoming beam direction; % beamdir - Lab coordinates X,Y,Z of the incoming beam direction;
% unit vector (1,3) % unit vector! (1,3)
% %
% OUTPUT scattvec - Lab coordinates of the normalised scattering vectors; % OUTPUT scattvec - Lab coordinates of the normalised scattering vectors;
% (n,3) % unit vectors (n,3)
% %
% !!! it probably doesn't matter if it's the Lab, but has to be the same
% reference for all
function scattvec = gtGeoScattVecFromDiffVec(diffvec,beamdir) function scattvec = gtGeoScattVecFromDiffVec(diffvec,beamdir)
% Scattering vectors % Scattering vectors
scattvec = diffvec - repmat(beamdir,size(diffvec,1),1); scattvec = diffvec - beamdir(ones(size(diffvec,1),1),:);
% Normalise scattvec-s: % Normalise scattvec-s:
snorm = sqrt(scattvec(:,1).^2 + scattvec(:,2).^2 + scattvec(:,3).^2) ; snorm = sqrt(scattvec(:,1).^2 + scattvec(:,2).^2 + scattvec(:,3).^2) ;
scattvec(:,1) = scattvec(:,1)./snorm ; scattvec(:,1) = scattvec(:,1)./snorm ;
scattvec(:,2) = scattvec(:,2)./snorm ; scattvec(:,2) = scattvec(:,2)./snorm ;
scattvec(:,3) = scattvec(:,3)./snorm ; scattvec(:,3) = scattvec(:,3)./snorm ;
end
\ 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