Fix clang-format

That earlier change introduced an error because YAML sucks
This commit is contained in:
karl 2020-12-28 12:23:23 +01:00
parent e7f18acc7d
commit ece164a660
2 changed files with 66 additions and 68 deletions

View File

@ -9,4 +9,5 @@ AllowShortLoopsOnASingleLine: 'false'
AlwaysBreakBeforeMultilineStrings: 'true'
IndentWidth: '4'
ColumnLimit: 100
...

View File

@ -37,12 +37,12 @@ struct Point {
};
class KDTree {
public:
public:
KDTree(std::vector<Point *> points) { root = build(points, 0); }
~KDTree() = default;
private:
private:
Node *root;
int MAX_DEPTH = 500;
@ -57,9 +57,7 @@ private:
Node *build(std::vector<Point *> points, int depth) {
// Exit conditions
if (points.empty() || depth > MAX_DEPTH) {
return nullptr;
}
if (points.empty() || depth > MAX_DEPTH) { return nullptr; }
// Select axis by choosing the one with maximal extent
float max_extent = 0;
@ -93,8 +91,7 @@ private:
float pivot;
// TODO: This copies. Can we split the vector into two without copying?
std::vector<Point *> left_of_median(points.begin(),
points.begin() + middle);
std::vector<Point *> left_of_median(points.begin(), points.begin() + middle);
std::vector<Point *> right_of_median(points.begin() + middle, points.end());
// Create node, recursively call to construct subtree