Skip to content

Commit

Permalink
Update refine function to remove limits on depth
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonCampolattaro committed Aug 14, 2020
1 parent b31169f commit 32a55ec
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Octree/include/CGAL/Octree.h
Expand Up @@ -214,12 +214,10 @@ class Octree {
m_max_depth_reached = 0;

// Reset the side length map, too
m_side_per_depth.resize(0);
m_side_per_depth.resize(1);

// create a side length map
// TODO: This should not be a fixed value (32)
for (int i = 0; i <= (int) 32; i++)
m_side_per_depth.push_back(m_bbox_side / (FT) (1 << i));
m_side_per_depth.push_back(*(m_side_per_depth.end() - 1) / 2);

// Initialize a queue of nodes that need to be refined
std::queue<Node *> todo;
Expand All @@ -231,7 +229,6 @@ class Octree {
// Get the next element
auto current = todo.front();
todo.pop();
int depth = current->depth();

// Check if this node needs to be processed
if (split_criterion(*current)) {
Expand All @@ -240,7 +237,14 @@ class Octree {
split((*current));

// Check if we've reached a new max depth
m_max_depth_reached = (std::max)(current->depth(), m_max_depth_reached);
if (current->depth() > m_max_depth_reached) {

// Update the max depth
m_max_depth_reached = current->depth();

// Update the side length map
m_side_per_depth.push_back(*(m_side_per_depth.end() - 1) / 2);
}

// Process each of its children
for (int i = 0; i < 8; ++i)
Expand Down

0 comments on commit 32a55ec

Please sign in to comment.