Skip to content

Commit

Permalink
Remove recursive refinement method
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonCampolattaro committed Jun 20, 2020
1 parent 72aa220 commit c1b12ad
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 45 deletions.
2 changes: 1 addition & 1 deletion Octree/benchmark/Octree/bench.cpp
Expand Up @@ -40,7 +40,7 @@ std::chrono::duration<double> benchmark(Point_set points) {
auto start = std::chrono::high_resolution_clock::now();

Octree octree(points, point_map);
octree._refine(MAX_DEPTH, BUCKET_SIZE);
octree.refine(MAX_DEPTH, BUCKET_SIZE);

auto end = std::chrono::high_resolution_clock::now();

Expand Down
44 changes: 1 addition & 43 deletions Octree/include/CGAL/Octree.h
Expand Up @@ -129,7 +129,7 @@ namespace CGAL {
m_root.unsplit();
}

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

// create a side length map
for (int i = 0; i <= (int) 10; i++)
Expand Down Expand Up @@ -165,24 +165,6 @@ namespace CGAL {

}

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; }

const Node &root() const { return m_root; }
Expand Down Expand Up @@ -219,30 +201,6 @@ namespace CGAL {
return {bary[0], bary[1], bary[2]};
}

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 this node is the deepest in the tree, record its depth
if (m_max_depth_reached < node.depth()) m_max_depth_reached = node.depth();

// Don't split this node
return;
}

// Create child nodes
node.split();

// Distribute this nodes points among its children
reassign_points(node);

// Repeat this process for all children (recursive)
for (int child_id = 0; child_id < 8; child_id++) {
refine_recurse(node[child_id], dist_to_max_depth - 1, max_pts_num);
}
}

std::array<Range_iterator, 9> partition_around_point(Range_iterator begin, Range_iterator end, Point point) {

auto partitions = std::array<Range_iterator, 9>();
Expand Down
2 changes: 1 addition & 1 deletion Octree/test/Octree/octree_test.cpp
Expand Up @@ -39,7 +39,7 @@ int main(void) {
auto point_map = points.point_map();

Octree octree(points, point_map);
octree._refine(10, 1);
octree.refine(10, 1);

std::cout << octree.root();

Expand Down

0 comments on commit c1b12ad

Please sign in to comment.