Skip to content

Commit

Permalink
Fix iteration over node children
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonCampolattaro committed Jul 14, 2020
1 parent a8820a4 commit a0f27e0
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions Octree/include/CGAL/Octree.h
Expand Up @@ -428,10 +428,38 @@ class Octree {
reassign_points(node, node.value().begin(), node.value().end(), center);
}

void nearest_k_neighbours_recursive_simple(const Point &p, std::vector<Point> &out, const Node &node,
FT largest_distance) const {
FT nearest_k_neighbours_recursive_simple(const Point &p, std::vector<Point> &out, const Node &node,
FT search_bounds_radius_squared) const {

FT largest_radius_squared_found = search_bounds_radius_squared;

// Check whether we've reached the bottom of the tree
if (node.is_leaf()) {

// Base case: the node has no children

} else {

// If the node has children

// Search each of them
for (int index = 0; index < 8; ++index) {
auto &n = node[index];

// Check whether this node is capable of containing closer points
// TODO: Maybe I should write a function for determining the distance between a node and a point?
// FIXME: For now, this checks every child (which degenerates to the brute force method)
if (true /*TODO: Replace this with the equation*/) {

// Recursive case
largest_radius_squared_found =
nearest_k_neighbours_recursive_simple(p, out, n, largest_radius_squared_found);

}
}
}
out.push_back(p);
return largest_radius_squared_found;
}

// TODO: It might be possible to fold this into the non-recursive function signature
Expand Down

0 comments on commit a0f27e0

Please sign in to comment.