Skip to content

Commit

Permalink
New refinement method can now produce trees, but doesn't account for …
Browse files Browse the repository at this point in the history
…points near edges
  • Loading branch information
JacksonCampolattaro committed Jun 18, 2020
1 parent 3656eb8 commit 9cb7d85
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions Octree/include/CGAL/Octree.h
Expand Up @@ -155,8 +155,21 @@ namespace CGAL {
m_unit_per_depth.push_back(1 << (m_max_depth_reached - i));
}

void _refine() {
void _refine(size_t max_depth, size_t max_pts_num) {

// Make sure arguments are valid
if (max_depth < 0 || max_pts_num < 1) {
CGAL_TRACE_STREAM << "wrong octree refinement criteria\n";
return;
}

for (int i = 0; i <= (int) max_depth; i++)
m_side_per_depth.push_back(m_bbox_side / (FT) (1 << i));

_refine_recurse(m_root, max_depth, max_pts_num);

for (int i = 0; i <= (int) m_max_depth_reached; i++)
m_unit_per_depth.push_back(1 << (m_max_depth_reached - i));
}

Node &root() { return m_root; }
Expand Down Expand Up @@ -223,7 +236,7 @@ namespace CGAL {
void _refine_recurse(Node &node, size_t dist_to_max_depth, size_t max_pts_num) {

// Check if the depth limit is reached, or if the node isn't filled
if (dist_to_max_depth == 0 || node.num_points() <= max_pts_num) {
if (dist_to_max_depth == 0 || node._num_points() <= max_pts_num) {

// If this node is the deepest in the tree, record its depth
if (m_max_depth_reached < node.depth()) m_max_depth_reached = node.depth();
Expand Down

0 comments on commit 9cb7d85

Please sign in to comment.