% light wavelength
lambda=670e-9; % 670 nm - red light

% set up mask (source image)

% two vertical slits  mask
Nx_s=101;
Ny_s=11;
img_source=zeros(Ny_s,Nx_s); 
xpos_s=linspace( -5e-4, 5e-4, Nx_s);
ypos_s=linspace( -1.0e-3, 1.0e-3, Ny_s);
% 
slits_gap_size=4e-4;
img_source(:, abs(xpos_s) > slits_gap_size/2 )=1;

% set up target image
Nx_t=101;
Ny_t=101;
img_t=zeros(Ny_t,Nx_t); 
xpos_t=linspace( -1e-1, 1e-1, Nx_t);
ypos_t=linspace( -1e-3, 1e-3, Ny_t);
z_t=1e1;


% generating image of the mask accounting the diffraction
tic; % start timer
img_t=diffracted_image_at_target(img_source, xpos_s, ypos_s, img_t, xpos_t, ypos_t, z_t, lambda);
toc % show evaluation time

% plot source and target images
show_diffraction(img_source, xpos_s, ypos_s, img_t, xpos_t, ypos_t);
