Skip to content

Commit

Permalink
Add non-const adjacent method
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonCampolattaro committed Aug 13, 2020
1 parent 225473e commit be38237
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions Octree/include/CGAL/Octree.h
Expand Up @@ -279,6 +279,7 @@ class Octree {
// Collect all the leaf nodes
std::queue<Node *> leaf_nodes;
for (auto &leaf : traverse(Traversal::Leaves())) {
// TODO: I'd like to find a better (safer) way of doing this
leaf_nodes.push(const_cast<Node *>(&leaf));
}

Expand Down
8 changes: 8 additions & 0 deletions Octree/include/CGAL/Octree/Node.h
Expand Up @@ -361,10 +361,18 @@ class Node {
return !operator==(rhs);
}

Self *adjacent(Direction direction) {
return adjacent(std::bitset<3>(static_cast<int>(direction)));
}

const Self *adjacent(Direction direction) const {
return adjacent(std::bitset<3>(static_cast<int>(direction)));
}

Self *adjacent(std::bitset<3> direction) {
return const_cast<Self *>(const_cast<const Self *>(this)->adjacent(direction));
}

const Self *adjacent(std::bitset<3> direction) const {

// Direction: LEFT RIGHT DOWN UP BACK FRONT
Expand Down

0 comments on commit be38237

Please sign in to comment.