diff --git a/Source/utils/palette_kd_tree.hpp b/Source/utils/palette_kd_tree.hpp index 84308f964..9f6843304 100644 --- a/Source/utils/palette_kd_tree.hpp +++ b/Source/utils/palette_kd_tree.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -323,8 +324,7 @@ private: // To see if we need to check a node's subtree, we compare the distance from the query // to the current best candidate vs the distance to the edge of the half-space represented // by the node. - if (bestDiff == std::numeric_limits::max() - || GetColorDistanceToPlane(node.pivot, coord) < GetColorDistance(values_[best].first, rgb)) { + if (GetColorDistanceToPlane(node.pivot, coord) < bestDiff) { findNearestNeighborVisit(node.child(coord >= node.pivot), rgb, bestDiff, best); } }