function Err = residual_LXY( T, Data )
%DIST Calculates distances to the linear mapping
[m,n] = size(Data);
sm = m-2;
X = [Data(1:sm,:); ones(1,n)];
Y = Data(sm+1:m,:);
Y_p = T * X;
W = (Y - Y_p);
Err = W(1,:).^2 +  W(2,:).^2;
end