function c = resect_cost(p,m,w)
     mp = proj(p,w);
      c = norm(m-mp,'fro')^2;
      strcat('c=',num2str(c))
      
      
      
     