function [ x_trans, y_trans, z_trans ] = origin_translation(x_coord, y_coord, z_coord)
%UNTITLED14 Summary of this function goes here
%   Detailed explanation goes here
    x=reshape(x_coord(:,3,:),size(x_coord,1),size(x_coord,3));
    for i=1:size(x,1)
        ax=mean(find(x(i,:)'>0));
        if ax==floor(ax)
            xcoord(i)=x(ax);
        else
            xcoord(i)=mean([x(i,floor(ax)) x(i,ceil(ax))]);
        end
    end
    
    y=reshape(y_coord(:,3,:),size(y_coord,1),size(y_coord,3));
    for i=1:size(y,1)
        ay=mean(find(y(i,:)'>0));
        if ay==floor(ay)
            ycoord(i)=y(ay);
        else
            ycoord(i)=mean([y(i,floor(ay)) y(i,ceil(ay))]);
        end
    end
    
    z=reshape(z_coord(:,3,:),size(z_coord,1),size(z_coord,3));
    for i=1:size(z,1)
        az=mean(find(z(i,:)'>0));
        if az==floor(az)
            zcoord(i)=z(az);
        else
            zcoord(i)=mean([z(i,floor(az)) z(i,ceil(az))]);
        end
    end
    
    %Subtract
    for i=1:length(zcoord)-1
        x_trans(i)=xcoord(i+1)-xcoord(i);
        y_trans(i)=ycoord(i+1)-ycoord(i);
        z_trans(i)=zcoord(i+1)-zcoord(i);
    end

end

