0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 function c = principal_distance_from_F(F)
0021
0022
0023 factor = 1;
0024 K0 = diag([factor,factor,1]);
0025 F = K0*F*K0;
0026
0027
0028 [U,D,V] = svd(F);
0029 a = D(1,1);
0030 b = D(2,2);
0031
0032
0033
0034
0035 a1 = a*U(3,1)*U(3,2)*(1-V(3,1)^2)+b*V(3,1)*V(3,2)*(1-U(3,2)^2);
0036 a0 = U(3,2)*V(3,1)*(a*U(3,1)*V(3,1)+b*U(3,2)*V(3,2));
0037
0038
0039 b1 = a*V(3,1)*V(3,2)*(1-U(3,1)^2)+b*U(3,1)*U(3,2)*(1-V(3,2)^2);
0040 b0 = U(3,1)*V(3,2)*(a*U(3,1)*V(3,1)+b*U(3,2)*V(3,2));
0041
0042
0043 c2 = a^2*(1-U(3,1)^2)*(1-V(3,1)^2)-b^2*(1-U(3,2)^2)*(1-V(3,2)^2);
0044 c1 = a^2*(U(3,1)^2+V(3,1)^2-2*U(3,1)^2*V(3,1)^2)-...
0045 b^2*(U(3,2)^2+V(3,2)^2-2*U(3,2)^2*V(3,2)^2);
0046 c0 = a^2*U(3,1)^2*V(3,1)^2-b^2*U(3,2)^2*V(3,2)^2;
0047
0048 f_squares = roots([c2,c1,c0]);
0049
0050
0051
0052
0053
0054 c = 0;
0055 for i = [1,2]
0056 f2 = f_squares(i);
0057 if isreal(f2) && f2 > 0
0058 if abs(a1*f2+a0) < 10^(-10) && abs(b1*f2+b0) < 10^(-10)
0059 c = sqrt(f2);
0060 end
0061 end
0062 end
0063
0064 c = factor*c;
0065
0066