function D = ProjectionQuality(XY,XYproj,A) % The "quality" of the computed projected point % denoted by E(x,y) in the article Dx = A(1)*XYproj(:,1)+A(2)*XYproj(:,2)+A(4); Dy = A(2)*XYproj(:,1)+A(3)*XYproj(:,2)+A(5); E0 = XYproj(:,1).*(Dx + A(4)) + XYproj(:,2).*(Dy + A(5)) + A(6); E1 = Dy.*(XY(:,1)-XYproj(:,1)) - Dx.*(XY(:,2)-XYproj(:,2)); D = abs(E0) + abs(E1); end