Skip to content

Commit

Permalink
Add index map to both octrees
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonCampolattaro committed Aug 4, 2020
1 parent 2099d72 commit a16a9cd
Showing 1 changed file with 10 additions and 4 deletions.
Expand Up @@ -36,6 +36,7 @@ class Direct_octree : public Octree::Octree<std::vector<std::size_t>, typename T

Traits m_traits;
std::size_t m_offset;
std::vector<std::size_t> &m_index_map;

typedef typename Traits::Input_range::iterator Input_iterator;
typedef typename Traits::Point_map Point_map;
Expand All @@ -47,7 +48,7 @@ class Direct_octree : public Octree::Octree<std::vector<std::size_t>, typename T
const Input_iterator &end,
Point_map &point_map,
std::size_t offset = 0) :
Octree::Octree<std::vector<std::size_t>, typename Traits::Point_map>({}, point_map),
Octree::Octree<std::vector<std::size_t>, typename Traits::Point_map>(m_index_map, point_map),
m_traits(traits),
m_offset(offset) {

Expand All @@ -73,22 +74,25 @@ class Direct_octree : public Octree::Octree<std::vector<std::size_t>, typename T
// TODO: I need to find out what cluster_epsilon is used for
this->refine(maxLevel, bucketSize);
}

std::size_t index(std::size_t i) { return m_index_map[i]; }
};

template<class Traits>
class Indexed_octree : public Octree::Octree<std::vector<std::size_t>, typename Traits::Point_map> {

Traits m_traits;
std::vector<std::size_t> m_index_map;

typedef typename Traits::Input_range::iterator Input_iterator;
typedef typename Traits::Point_map Point_map;

public:

Indexed_octree(const Traits &traits,
const Input_iterator &begin,
const Input_iterator &end,
Point_map &point_map) :
const Input_iterator &begin,
const Input_iterator &end,
Point_map &point_map) :
Octree::Octree<std::vector<std::size_t>, typename Traits::Point_map>({}, point_map),
m_traits(traits) {

Expand All @@ -112,6 +116,8 @@ class Indexed_octree : public Octree::Octree<std::vector<std::size_t>, typename
// TODO: I need to find out what cluster_epsilon is used for
this->refine(maxLevel, bucketSize);
}

std::size_t index(std::size_t i) { return m_index_map[i]; }
};

}
Expand Down

0 comments on commit a16a9cd

Please sign in to comment.