insane
This commit is contained in:
parent
2425729a72
commit
b4927aba4c
@ -25,15 +25,14 @@ ostream& operator<<(ostream &os, KdTree::Point const &point) {
|
|||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KdTree::Node::Node(Point const &position, vtkIdType id): position{position}, id{id} {}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void KdTree::fill(std::vector<Tuple> &points) {
|
void KdTree::fill(std::vector<Tuple> &points) {
|
||||||
nodes.resize(points.size());
|
nodes.reserve(points.size());
|
||||||
|
for(std::size_t i = 0; i < points.size(); ++i)
|
||||||
for(std::size_t i = 0; i < points.size(); ++i) {
|
nodes.push_back({points[i].first, points[i].second});
|
||||||
nodes[i].position = points[i].first;
|
|
||||||
nodes[i].index = points[i].second;
|
|
||||||
}
|
|
||||||
|
|
||||||
root = fillRec(0, points.size(), 0);
|
root = fillRec(0, points.size(), 0);
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,10 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
struct Node {
|
struct Node {
|
||||||
|
Node(Point const &position, vtkIdType id);
|
||||||
|
|
||||||
Point position;
|
Point position;
|
||||||
vtkIdType index;
|
vtkIdType id;
|
||||||
|
|
||||||
Node *leftChild;
|
Node *leftChild;
|
||||||
Node *rightChild;
|
Node *rightChild;
|
||||||
|
Loading…
Reference in New Issue
Block a user