From d502f7399062fa41c3a01e046b76895b7c0eeaa4 Mon Sep 17 00:00:00 2001 From: Jackson Campolattaro Date: Thu, 23 Jul 2020 11:42:29 -0400 Subject: [PATCH] score and fullScore now take octree arg by pointer --- .../Efficient_RANSAC/Efficient_RANSAC.h | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Efficient_RANSAC.h b/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Efficient_RANSAC.h index aa95bb7f35e..d01e13982fc 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Efficient_RANSAC.h +++ b/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Efficient_RANSAC.h @@ -650,10 +650,16 @@ class Efficient_RANSAC { best_candidate->m_indices.clear(); best_candidate->m_score = - m_global_octree->score(best_candidate, - m_shape_index, - FT(3) * m_options.epsilon, - m_options.normal_threshold); + m_global_octree->score( + best_candidate, + m_shape_index, + FT(3) * m_options.epsilon, + m_options.normal_threshold); +// score(*m_global_octree, +// best_candidate, +// m_shape_index, +// FT(3) * m_options.epsilon, +// m_options.normal_threshold); best_expected = static_cast(best_candidate->m_score); @@ -1012,18 +1018,18 @@ class Efficient_RANSAC { // TODO: Make these work outside the octree! template - std::size_t fullScore(internal::Octree octree, Shape *candidate, + std::size_t fullScore(internal::Octree *octree, Shape *candidate, std::vector &shapeIndex, FT epsilon, FT normal_threshold) { - std::vector indices(octree.m_root->size()); - for (std::size_t i = 0; i < octree.m_root->size(); i++) { - indices[i] = index(octree.m_root->first + i); + std::vector indices(octree->m_root->size()); + for (std::size_t i = 0; i < octree->m_root->size(); i++) { + indices[i] = index(octree->m_root->first + i); } - candidate->cost_function(this->begin() + octree.m_root->first, - this->begin() + octree.m_root->last, + candidate->cost_function(octree->begin() + octree->m_root->first, + octree->begin() + octree->m_root->last, shapeIndex, epsilon, normal_threshold, @@ -1033,7 +1039,7 @@ class Efficient_RANSAC { } template - std::size_t score(internal::Octree octree, Shape *candidate, + std::size_t score(internal::Octree *octree, Shape *candidate, std::vector &shapeIndex, FT epsilon, FT normal_threshold) { @@ -1041,13 +1047,13 @@ class Efficient_RANSAC { typedef typename internal::Octree::Cell Cell; std::stack stack; - stack.push(octree.m_root); + stack.push(octree->m_root); while (!stack.empty()) { Cell *cell = stack.top(); stack.pop(); - FT width = octree.m_width / (1 << (cell->level)); + FT width = octree->m_width / (1 << (cell->level)); FT diag = CGAL::sqrt(FT(3) * width * width) + epsilon; @@ -1062,8 +1068,8 @@ class Efficient_RANSAC { std::vector indices; indices.reserve(cell->size()); for (std::size_t i = 0; i < cell->size(); i++) { - if (shapeIndex[this->index(cell->first + i)] == -1) { - indices.push_back(this->index(cell->first + i)); + if (shapeIndex[octree->index(cell->first + i)] == -1) { + indices.push_back(octree->index(cell->first + i)); } }