function [K_skirtumas TR_kr]=Skirtumai(K,z)
N=length(K);
i=1;
u=1;
while i<N
    d_x=K(i+1,1)-K(i,1);
    d_y=K(i+1,2)-K(i,2);
%     d_x=apvalinimas(K(i+1,1),6)-apvalinimas(K(i,1),6);
%     d_y=apvalinimas(K(i+1,2),6)-apvalinimas(K(i,2),6);
    K_skirtumas(u,:)=[d_x d_y];
    TR_kr(u,:)=[sign(d_x) sign(d_y)];
    i=i+z;
    u=u+1;
end