function [vk, rk, theta, phi, pk3 ,cc]=estimation(pk1,pk2,dt,tf)

assert(size(pk1,2)==size(pk2,2),'Size mismatch')

dtheta=tf(3);

%Get CC
[cc, r]=centerFromPointsAndAlpha(pk1(:,1),pk2(:,1),dtheta);

vk=zeros(1,size(pk1,2));
% vki=zeros(2,size(pk1,2));
theta=zeros(1,size(pk1,2));
pk3=zeros(2,size(pk1,2));
phi=zeros(1,size(pk1,2));
rk=zeros(1,size(pk1,2));

xi=pk1(1,end);
yi=pk1(2,end);

% rReal=sqrt( (cc(1)-xi)^2 + (cc(2)-yi)^2 );
% abs(dtheta)
if abs(dtheta)<0.5*pi/180
    linear=true;
else
    linear=false;
end

for k=1:size(pk1,2)
    xi=pk1(1,k);
    yi=pk1(2,k);
    
    xf=pk2(1,k);
    yf=pk2(2,k);

    theta(k)=atan2(yf-yi,xf-xi);
    
    if linear
        rk(k)=inf;
        s=sqrt((xf-xi)*(xf-xi)+(yf-yi)*(yf-yi));
        
        pk3(1,k)=xf+(xf-xi);
        pk3(2,k)=yf+(yf-yi);
    else
        rk(k)=sqrt( (cc(1)-xi)^2 + (cc(2)-yi)^2 );
        s=rk(k)*abs(dtheta);
        
        pk3(1,k)=cc(1)+rk(k)*cos(atan2(yf-cc(2),xf-cc(1))+dtheta);
        pk3(2,k)=cc(2)+rk(k)*sin(atan2(yf-cc(2),xf-cc(1))+dtheta);
    end
    
    
    vk(k)=s/dt;
end




