function M=LinkOrigins(AA)

org=[0 0 0]';
A=eye(4);

for n=1: size(AA,3)
    A=A*AA(:,:,n);   % coordenadas são dependentes
    org = [org A(1:3,4)];
end
M=org;