Skip to content

Commit

Permalink
Add criterion.h, where tree building oracle functors will be added
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonCampolattaro committed Jun 19, 2020
1 parent 9a69b22 commit 40ac8d9
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
1 change: 1 addition & 0 deletions Octree/include/CGAL/Octree.h
Expand Up @@ -28,6 +28,7 @@
//#include <CGAL/license/Implicit_surface_reconstruction_3.h>

#include <CGAL/Octree/Octree_node.h>
#include <CGAL/Octree/Criterion.h>

#include <CGAL/bounding_box.h>
#include <boost/iterator/transform_iterator.hpp>
Expand Down
62 changes: 62 additions & 0 deletions Octree/include/CGAL/Octree/Criterion.h
@@ -0,0 +1,62 @@

#ifndef OCTREE_CRITERION_H
#define OCTREE_CRITERION_H

#include <CGAL/Octree/Octree_node.h>

/*
typedef Octree_node<Kernel, PointRange> Node;
// Possible criterions
struct Stop_at_max_depth {
std::size_t max_depth;
Stop_at_max_depth(const std::size_t &max_depth) : max_depth(max_depth) {}
bool operator()(const Node &n) const {
return n.depth() == max_depth; // not sure you can know that from node only,
// otherwise your criterion could also take a
// reference to the full octree as parameter
}
};
struct Stop_at_max_number_of_points {
std::size_t max_nb_points;
Stop_at_max_number_of_points(const std::size_t &max_nb_points)
: max_nb_points(max_nb_points) {}
bool operator()(const Node &n) const {
return n.number_of_points() // internally, the node can use std::distance(begin, end)
< max_nb_points;
}
};
// Just for an example using outside info (like a normal map)
// The normals remain unknown to the octree but are used for construction
struct Stop_at_normal_deviation {
Normal_map normal_map;
FT max_dev;
Stop_at_normal_deviation(Normal_map normal_map,
FT max_dev)
: normal_map(normal_map), max_dev(max_dev) {}
bool operator()(const Node &n) const {
FT dev = 0;
for (Iterator it = n.begin(); it != n.end(); ++it)
dev += compute_deviation(get(normal_map, *it)); // whatever compute_deviation is :)
// if your node defines begin() and end(), you can also use a C++11 loop:
// for (const Range_type& r : n)
// dev += compute_deviation(get (normal_map, r));
return dev < max_dev;
}
};
*/

#endif //OCTREE_CRITERION_H

0 comments on commit 40ac8d9

Please sign in to comment.