generated from karl/cpp-template
Change std::max_element to min_element
We were using max_element twice
This commit is contained in:
parent
2ce6b06e54
commit
2105e2619e
5
kdtree.h
5
kdtree.h
@ -74,7 +74,7 @@ class KDTree {
|
||||
// Get extent along this axis
|
||||
auto comparator = get_point_comparator(it_axis);
|
||||
|
||||
Point *min = *std::max_element(points.begin(), points.end(), comparator);
|
||||
Point *min = *std::min_element(points.begin(), points.end(), comparator);
|
||||
Point *max = *std::max_element(points.begin(), points.end(), comparator);
|
||||
|
||||
float extent = max->coordinates[it_axis] - min->coordinates[it_axis];
|
||||
@ -112,7 +112,8 @@ class KDTree {
|
||||
|
||||
str += std::string(depth, '-') + std::to_string(point->coordinates[0]) + ", " +
|
||||
std::to_string(point->coordinates[1]) + ", " +
|
||||
std::to_string(point->coordinates[2]) + "\n";
|
||||
std::to_string(point->coordinates[2]) + " with axis " + std::to_string(node->axis) +
|
||||
"\n";
|
||||
|
||||
to_string_recurse(str, node->left, depth + 1);
|
||||
to_string_recurse(str, node->right, depth + 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user