Skip to content

Commit

Permalink
Add naive partitioning algorithm for comparison.
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonCampolattaro committed Jun 23, 2020
1 parent 015fe9e commit 7fd1aaa
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 5 deletions.
47 changes: 46 additions & 1 deletion Octree/include/CGAL/Octree.h
Expand Up @@ -141,7 +141,7 @@ namespace CGAL {
m_side_per_depth.push_back(m_bbox_side / (FT) (1 << i));

// Initialize a queue of nodes that need to be refined
std::queue<Node*> todo;
std::queue<Node *> todo;
todo.push(&m_root);

// Process items in the queue until it's consumed fully
Expand Down Expand Up @@ -260,6 +260,51 @@ namespace CGAL {
return partitions;
}

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

auto partitions = std::array<Range_iterator, 9>();

partitions[0] = begin;
partitions[1] = std::partition(partitions[0], end,
[&](const Range_type &a) -> bool {
auto p = get(m_points_map, a);
return (p[0] < point[0] && p[1] < point[1] && p[2] < point[2]);
});
partitions[2] = std::partition(partitions[1], end,
[&](const Range_type &a) -> bool {
auto p = get(m_points_map, a);
return (p[0] < point[0] && p[1] < point[1] && p[2] >= point[2]);
});
partitions[3] = std::partition(partitions[2], end,
[&](const Range_type &a) -> bool {
auto p = get(m_points_map, a);
return (p[0] < point[0] && p[1] >= point[1] && p[2] < point[2]);
});
partitions[4] = std::partition(partitions[3], end,
[&](const Range_type &a) -> bool {
auto p = get(m_points_map, a);
return (p[0] < point[0] && p[1] >= point[1] && p[2] >= point[2]);
});
partitions[5] = std::partition(partitions[4], end,
[&](const Range_type &a) -> bool {
auto p = get(m_points_map, a);
return (p[0] >= point[0] && p[1] < point[1] && p[2] < point[2]);
});
partitions[6] = std::partition(partitions[5], end,
[&](const Range_type &a) -> bool {
auto p = get(m_points_map, a);
return (p[0] >= point[0] && p[1] < point[1] && p[2] >= point[2]);
});
partitions[7] = std::partition(partitions[6], end,
[&](const Range_type &a) -> bool {
auto p = get(m_points_map, a);
return (p[0] >= point[0] && p[1] >= point[1] && p[2] < point[2]);
});
partitions[8] = end;

return partitions;
}

void reassign_points(Node &node) {

Point center = compute_barycenter_position(node);
Expand Down
4 changes: 0 additions & 4 deletions Octree/include/CGAL/Octree/Octree_node.h
Expand Up @@ -31,10 +31,6 @@
#include <CGAL/Search_traits_3.h>
#include <CGAL/Search_traits_adapter.h>

/*
* These headers were not included here originally
* Adding them was necessary to make this header self sufficient
*/
#include <boost/function.hpp>
#include <boost/bind.hpp>
#include <iostream>
Expand Down

0 comments on commit 7fd1aaa

Please sign in to comment.