function qq=knn(pp,delta,dx)
% 一种比较高效的邻居点识别算法
% pp为坐标 delta是半径 dx是x方向间距
total_node=size(pp,1);
horizon_number=floor(pi*(delta/dx+0.1)^2+1);
qq=zeros(total_node,horizon_number);
for i=1:size(pp,1)
    dis= (abs(pp(:,1)-pp(i,1))<delta)&(abs(pp(:,2)-pp(i,2))<delta);
    dis(i)=1~=1;
    k=find(dis);
    dis2=(sum((pp(k,:)-repmat(pp(i,:),numel(k),1)).^2,2))<delta^2;
    kk=k(dis2);
    counts=numel(kk);
    qq(i,1:counts+1)=[counts,kk'];
end
end