function [t, Q] = pointfit(xi,x);
%
xiq = sum(xi')/length(xi); xiq = xiq';
xq = sum(x')/length(x); xq = xq';
A = x - xq*ones(1,length(x));
B = xi - xiq*ones(1,length(xi));
[u sigma v] = svd(A*B');
Q = v*diag([ones(1,size(v,1)-1) det(v*u')])*u';
t = xiq - Q*xq;

