Skip to content

Commit 81cd02b

Browse files
authored
Merge pull request #270 from lucabart97/nanoflann_faster_searchLevel
nanoflann: faster check in searchLevel
2 parents 5714a06 + 2e27210 commit 81cd02b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

include/nanoflann.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,8 +1887,9 @@ class KDTreeSingleIndexAdaptor
18871887
DistanceType mindist, distance_vector_t& dists,
18881888
const float epsError) const
18891889
{
1890-
/* If this is a leaf node, then do check and return. */
1891-
if ((node->child1 == nullptr) && (node->child2 == nullptr))
1890+
// If this is a leaf node, then do check and return.
1891+
// If they are equal, both pointers are nullptr.
1892+
if (node->child1 == node->child2)
18921893
{
18931894
DistanceType worst_dist = result_set.worstDist();
18941895
for (Offset i = node->node_type.lr.left;
@@ -2314,8 +2315,9 @@ class KDTreeSingleIndexDynamicAdaptor_
23142315
DistanceType mindist, distance_vector_t& dists,
23152316
const float epsError) const
23162317
{
2317-
/* If this is a leaf node, then do check and return. */
2318-
if ((node->child1 == nullptr) && (node->child2 == nullptr))
2318+
// If this is a leaf node, then do check and return.
2319+
// If they are equal, both pointers are nullptr.
2320+
if (node->child1 == node->child2)
23192321
{
23202322
DistanceType worst_dist = result_set.worstDist();
23212323
for (Offset i = node->node_type.lr.left;

0 commit comments

Comments
 (0)