function [xNew,yNew] = Centralize(x,y)
% Translate polygon defined by vectors
% x,y such that the centroid is on the
% origin. New polygon defined by vectors
% xNew,yNew.

n= length(x);
xNew= zeros(n,1); yNew= zeros(n,1);
xBar= sum(x)/n; yBar= sum(y)/n;
for k = 1:n
xNew(k)= x(k) - xBar;
yNew(k)= y(k) - yBar;
end