/// <summary> /// 搜索k近邻点 /// </summary> /// <param name="p"></param> /// <param name="k"></param> /// <returns></returns> public List <TreeNode> BBFSearchKNearest(Point p, int k) { var list = new List <BBFData>(); // var pq = new MinPQ(); pq.insert(new PQNode(root, 0)); int t = 0; while (pq.nodes.Count > 0 && t < max_nn_chks) { var expl = pq.pop_min_default().data; expl = Explore2Leaf(expl, p, pq); var bbf = new BBFData(expl, expl.point.Distance(p)); insert(list, k, bbf); t++; } return(list.Select(l => l.data).ToList()); }