Octree: add option to compute ideal maximum level w.r.t scale

This commit is contained in:
Simon Giraudot 2017-10-31 12:06:21 +01:00
parent 5601714f2a
commit ce8157242b
1 changed files with 12 additions and 1 deletions

View File

@ -277,11 +277,22 @@ namespace CGAL {
// | 3.| 2.|
// +---+---+
// z max before z min, then y max before y min, then x max before x min
void createTree() {
void createTree(double cluster_epsilon_for_max_level_recomputation = -1.) {
buildBoundingCube();
std::size_t count = 0;
m_max_level = 0;
if (cluster_epsilon_for_max_level_recomputation > 0.)
{
FT bbox_diagonal = (FT) CGAL::sqrt(
(m_bBox.xmax() - m_bBox.xmin()) * (m_bBox.xmax() - m_bBox.xmin())
+ (m_bBox.ymax() - m_bBox.ymin()) * (m_bBox.ymax() - m_bBox.ymin())
+ (m_bBox.zmax() - m_bBox.zmin()) * (m_bBox.zmax() - m_bBox.zmin()));
m_set_max_level = std::size_t (std::log2 (bbox_diagonal
/ cluster_epsilon_for_max_level_recomputation));
}
std::stack<Cell *> stack;
m_root = new Cell(0, this->size() - 1, m_center, 0);
stack.push(m_root);