-
Notifications
You must be signed in to change notification settings - Fork 1
/
calcul_ellipse.m
31 lines (26 loc) · 1.02 KB
/
calcul_ellipse.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function [ dX,dY ] = calcul_ellipse( Px,Py,pt,thr)
%calcul_ellipse Calculate the semi-minor axis and the semi-major axis ellipse at the given point
% pt is the double at which the computation takes place
global w;
global pix2metersZ;
Lx = find((2*pi*Px(pt,:))/(pi*feval(w,pt*pix2metersZ)^2) >= thr); % Searching for the value corresponding to the beam diameter
if isempty(Lx) % Taking care of the empty case by returning zeros axis
dX = 0;
dY = 0;
return;
else
Lx1 = Lx(1,1); % Lower bound for the beam diameter
Lx2 = Lx(1,end); % Upper bound for the beam diameter
dX = Lx2 - Lx1; % Beam diameter in pixel
end
Ly = find((2*pi*Px(pt,:))/(pi*feval(w,pt*pix2metersZ)^2) >= thr); % Searching for the value corresponding to the beam diameter
if isempty(Ly) % Taking care of the empty case by returning zeros axis
dX = 0;
dY = 0;
return;
else
Ly1 = Ly(1,1); % Lower bound for the beam diameter
Ly2 = Ly(1,end); % Upper bound for the beam diameter
dY = Ly2 - Ly1; % Beam diameter in pixel
end
end