Changeset 1112 for trunk/src/phys_XYZ.m
- Timestamp:
- Jan 26, 2022, 7:37:21 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/phys_XYZ.m
r1111 r1112 33 33 %======================================================================= 34 34 35 function [Xphys,Yphys,Zphys]=phys_XYZ(Calib, X,Y,Zindex)35 function [Xphys,Yphys,Zphys]=phys_XYZ(Calib,Slice,X,Y,Zindex) 36 36 %------------------------------------------------------------------------ 37 37 testangle=0;% =1 if the illumination plane is tilted with respect to the horizontal plane Xphys Yphys 38 38 test_refraction=0;% =1 if the considered points are viewed through an horizontal interface (located at z=Calib.InterfaceCoord(3)') 39 39 Zphys=0; %default output 40 if exist('Zindex','var')&& isequal(Zindex,round(Zindex))&& Zindex>0 && isfield(Calib,'SliceCoord')&&size(Calib.SliceCoord,1)>=Zindex 41 if isfield(Calib, 'SliceAngle') && size(Calib.SliceAngle,1)>=Zindex && ~isequal(Calib.SliceAngle(Zindex,:),[0 0 0]) 40 if isempty(Slice) 41 Slice=Calib;%old convention < 2022 42 end 43 if exist('Zindex','var')&& isequal(Zindex,round(Zindex))&& Zindex>0 && isfield(Slice,'SliceCoord')&&size(Slice.SliceCoord,1)>=Zindex 44 if isfield(Slice, 'SliceAngle') && size(Slice.SliceAngle,1)>=Zindex && ~isequal(Slice.SliceAngle(Zindex,:),[0 0 0]) 42 45 testangle=1; 43 norm_plane=angle2normal( Calib.SliceAngle(Zindex,:));% coordinates UVMAT-httpsof the unit vector normal to the current illumination plane46 norm_plane=angle2normal(Slice.SliceAngle(Zindex,:));% coordinates UVMAT-httpsof the unit vector normal to the current illumination plane 44 47 end 45 Z0= Calib.SliceCoord(Zindex,3);%horizontal plane z=cte48 Z0=Slice.SliceCoord(Zindex,3);%horizontal plane z=cte 46 49 Z0virt=Z0; 47 if isfield( Calib,'InterfaceCoord') && isfield(Calib,'RefractionIndex')48 H= Calib.InterfaceCoord(3);% z position of the water surface50 if isfield(Slice,'InterfaceCoord') && isfield(Slice,'RefractionIndex') 51 H=Slice.InterfaceCoord(3);% z position of the water surface 49 52 if H>Z0 50 Z0virt=H-(H-Z0)/ Calib.RefractionIndex; %corrected z (virtual object)53 Z0virt=H-(H-Z0)/Slice.RefractionIndex; %corrected z (virtual object) 51 54 test_refraction=1; 52 55 end … … 86 89 b=-norm_plane(2)/norm_plane(3); 87 90 if test_refraction 88 avirt=a/ Calib.RefractionIndex;89 bvirt=b/ Calib.RefractionIndex;91 avirt=a/Slice.RefractionIndex; 92 bvirt=b/Slice.RefractionIndex; 90 93 else 91 94 avirt=a; 92 95 bvirt=b; 93 96 end 94 cvirt=Z0virt-avirt* Calib.SliceCoord(Zindex,1)-bvirt*Calib.SliceCoord(Zindex,2);% Z0 = (virtual) z coordinate on the rotation axis (assumed horizontal)97 cvirt=Z0virt-avirt*Slice.SliceCoord(Zindex,1)-bvirt*Slice.SliceCoord(Zindex,2);% Z0 = (virtual) z coordinate on the rotation axis (assumed horizontal) 95 98 % c=z coordinate at (x,y)=(0,0) 96 c=Z0-a* Calib.SliceCoord(Zindex,1)-b*Calib.SliceCoord(Zindex,2);99 c=Z0-a*Slice.SliceCoord(Zindex,1)-b*Slice.SliceCoord(Zindex,2); 97 100 R(1)=R(1)+avirt*R(3); 98 101 R(2)=R(2)+bvirt*R(3);
Note: See TracChangeset
for help on using the changeset viewer.