50 LeafPreparationFunctor prepareLeafTraversal,
51 DescentDistanceThresholdFunctor descentDistanceThreshold,
52 SkipIndexFunctor skipFunctor,
53 ProcessNeighborFunctor processNeighborFunctor
56 const auto& nodes =
m_kdtree->nodes();
57 const auto& points =
m_kdtree->points();
59 if (nodes.empty() || points.empty() ||
m_kdtree->sample_count() == 0)
65 const auto& node = nodes[qnode.index];
67 if(qnode.squared_distance < descentDistanceThreshold())
72 IndexType start = node.leaf_start();
73 IndexType end = node.leaf_start() + node.leaf_size();
74 prepareLeafTraversal(start, end);
75 for(IndexType i=start; i<end; ++i)
77 IndexType idx =
m_kdtree->pointFromSample(i);
78 if(skipFunctor(idx))
continue;
80 Scalar d = (point - points[idx].pos()).squaredNorm();
82 if(d < descentDistanceThreshold())
84 if( processNeighborFunctor( idx, i, d ))
return false;
91 Scalar newOff = point[node.inner_split_dim()] - node.inner_split_value();
95 m_stack.top().index = node.inner_first_child_id();
96 qnode.index = node.inner_first_child_id()+1;
100 m_stack.top().index = node.inner_first_child_id()+1;
101 qnode.index = node.inner_first_child_id();
103 m_stack.top().squared_distance = qnode.squared_distance;
104 qnode.squared_distance = newOff*newOff;