Skip to content

Commit

Permalink
Add number_of_points method to Node
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonCampolattaro committed Jul 17, 2020
1 parent 21c6d6b commit 97af9a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion Octree/include/CGAL/Octree/Node.h
Expand Up @@ -235,7 +235,15 @@ class Node {
* \return
*/
bool is_empty() const {
return m_points.end() == m_points.begin();
return m_points.empty();
}

/*!
* \brief Count the points contained by this node
* \return
*/
std::size_t number_of_points() const {
return std::distance(m_points.begin(), m_points.end());
}

/// @}
Expand Down
4 changes: 2 additions & 2 deletions Octree/include/CGAL/Octree/Split_criterion.h
Expand Up @@ -22,7 +22,7 @@ struct Bucket_size {

template<class Node>
bool operator()(const Node &n) const {
return (n.num_points() > m_bucket_size);
return (n.number_of_points() > m_bucket_size);
}
};

Expand Down Expand Up @@ -53,7 +53,7 @@ struct Max_depth_or_bucket_size {

template<class Node>
bool operator()(const Node &n) const {
size_t num_points = std::distance(n.points().begin(), n.points().end());
size_t num_points = n.number_of_points();
size_t depth = n.depth();
return (num_points > m_bucket_size && depth < m_max_depth);
}
Expand Down

0 comments on commit 97af9a0

Please sign in to comment.