44 LeafPreparationFunctor prepareLeafTraversal,
45 DescentDistanceThresholdFunctor descentDistanceThreshold,
46 SkipIndexFunctor skipFunctor,
47 ProcessNeighborFunctor processNeighborFunctor
50 const auto& nodes =
m_kdtree->nodes();
51 const auto& points =
m_kdtree->points();
53 if (nodes.empty() || points.empty() ||
m_kdtree->sample_count() == 0)
59 const auto& node = nodes[qnode.index];
61 if(qnode.squared_distance < descentDistanceThreshold())
66 IndexType start = node.leaf_start();
67 IndexType end = node.leaf_start() + node.leaf_size();
68 prepareLeafTraversal(start, end);
69 for(IndexType i=start; i<end; ++i)
71 IndexType idx =
m_kdtree->pointFromSample(i);
72 if(skipFunctor(idx))
continue;
74 Scalar d = (point - points[idx].pos()).squaredNorm();
76 if(d < descentDistanceThreshold())
78 if( processNeighborFunctor( idx, i, d ))
return false;
85 Scalar newOff = point[node.inner_split_dim()] - node.inner_split_value();
89 m_stack.top().index = node.inner_first_child_id();
90 qnode.index = node.inner_first_child_id()+1;
94 m_stack.top().index = node.inner_first_child_id()+1;
95 qnode.index = node.inner_first_child_id();
97 m_stack.top().squared_distance = qnode.squared_distance;
98 qnode.squared_distance = newOff*newOff;