Changeset 1112 for trunk/src/phys_XYZ.m


Ignore:
Timestamp:
Jan 26, 2022, 7:37:21 PM (2 years ago)
Author:
sommeria
Message:

set_slice separated from geometrey_calib

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/phys_XYZ.m

    r1111 r1112  
    3333%=======================================================================
    3434
    35 function [Xphys,Yphys,Zphys]=phys_XYZ(Calib,X,Y,Zindex)
     35function [Xphys,Yphys,Zphys]=phys_XYZ(Calib,Slice,X,Y,Zindex)
    3636%------------------------------------------------------------------------
    3737testangle=0;% =1 if the illumination plane is tilted with respect to the horizontal plane Xphys Yphys
    3838test_refraction=0;% =1 if the considered points are viewed through an horizontal interface (located at z=Calib.InterfaceCoord(3)')
    3939Zphys=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])
     40if isempty(Slice)
     41    Slice=Calib;%old convention < 2022
     42end
     43if 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])
    4245        testangle=1;
    43         norm_plane=angle2normal(Calib.SliceAngle(Zindex,:));% coordinates UVMAT-httpsof the unit vector normal to the current illumination plane
     46        norm_plane=angle2normal(Slice.SliceAngle(Zindex,:));% coordinates UVMAT-httpsof the unit vector normal to the current illumination plane
    4447    end
    45     Z0=Calib.SliceCoord(Zindex,3);%horizontal plane z=cte
     48    Z0=Slice.SliceCoord(Zindex,3);%horizontal plane z=cte
    4649    Z0virt=Z0;
    47     if isfield(Calib,'InterfaceCoord') && isfield(Calib,'RefractionIndex')
    48         H=Calib.InterfaceCoord(3);% z position of the water surface
     50    if isfield(Slice,'InterfaceCoord') && isfield(Slice,'RefractionIndex')
     51        H=Slice.InterfaceCoord(3);% z position of the water surface
    4952        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)
    5154            test_refraction=1;
    5255        end
     
    8689        b=-norm_plane(2)/norm_plane(3);
    8790        if test_refraction
    88             avirt=a/Calib.RefractionIndex;
    89             bvirt=b/Calib.RefractionIndex;
     91            avirt=a/Slice.RefractionIndex;
     92            bvirt=b/Slice.RefractionIndex;
    9093        else
    9194            avirt=a;
    9295            bvirt=b;
    9396        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)
    9598                               % 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);
    97100        R(1)=R(1)+avirt*R(3);
    98101        R(2)=R(2)+bvirt*R(3);
Note: See TracChangeset for help on using the changeset viewer.