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' AlwaysBreakBeforeMultilineStrings: 'true'
IndentWidth: '4' IndentWidth: '4'
ColumnLimit: 100 ColumnLimit: 100
... ...

View File

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