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 ad02b2ca494..4823948d799 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 @@ -299,6 +299,8 @@ public: m_input_iterator_first, m_input_iterator_beyond); m_valid_iterators = true; + + std::cout << *(m_input_iterator_first + 0) << std::endl; } /*! @@ -562,6 +564,8 @@ public: static_cast(m_num_available_points)); while (m_shape_index[first_sample] != -1); + std::cout << *(m_input_iterator_first + 0) << std::endl; + done = drawSamplesFromCellContainingPoint(m_global_octree, get(m_point_pmap, diff --git a/Shape_detection/test/Shape_detection/test_efficient_RANSAC_cone_parameters.cpp b/Shape_detection/test/Shape_detection/test_efficient_RANSAC_cone_parameters.cpp index 9a5c22df23c..bd5dcaea4f6 100644 --- a/Shape_detection/test/Shape_detection/test_efficient_RANSAC_cone_parameters.cpp +++ b/Shape_detection/test/Shape_detection/test_efficient_RANSAC_cone_parameters.cpp @@ -8,7 +8,7 @@ #include #include -template +template bool test_cone_parameters() { // Determined by fair dice roll, guaranteed to be random @@ -18,25 +18,25 @@ bool test_cone_parameters() { const int NB_ROUNDS = 10; const int NB_POINTS = 1000; - typedef typename K::FT FT; - typedef CGAL::Point_with_normal_3 Pwn; - typedef CGAL::Point_3 Point; - typedef CGAL::Vector_3 Vector; - typedef std::vector Pwn_vector; - typedef CGAL::Identity_property_map Point_map; - typedef CGAL::Normal_of_point_with_normal_map Normal_map; + typedef typename K::FT FT; + typedef CGAL::Point_with_normal_3 Pwn; + typedef CGAL::Point_3 Point; + typedef CGAL::Vector_3 Vector; + typedef std::vector Pwn_vector; + typedef CGAL::Identity_property_map Point_map; + typedef CGAL::Normal_of_point_with_normal_map Normal_map; typedef CGAL::Shape_detection::Efficient_RANSAC_traits Traits; - typedef CGAL::Shape_detection::Efficient_RANSAC Efficient_ransac; - typedef CGAL::Shape_detection::Cone Cone; + typedef CGAL::Shape_detection::Efficient_RANSAC Efficient_ransac; + typedef CGAL::Shape_detection::Cone Cone; std::size_t success = 0; - for (int i = 0 ; i < NB_ROUNDS ; i++) { + for (int i = 0; i < NB_ROUNDS; i++) { Pwn_vector points; - // Generate random points on random cone. + // Generate random points on random cone. Vector axis; Point apex; FT angle = 0; @@ -44,11 +44,11 @@ bool test_cone_parameters() { CGAL::Bbox_3 bbox(-10, -10, -10, 10, 10, 10); sample_random_cone(NB_POINTS, apex, axis, angle, mid, - std::back_inserter(points)); + std::back_inserter(points)); - std::cout<< apex << std::endl; + std::cout << std::endl; - // Add outliers in second half of rounds. + // Add outliers in second half of rounds. if (i >= NB_ROUNDS / 2) for (std::size_t j = 0; j < NB_POINTS / 2; j++) points.push_back(random_pwn_in(bbox)); @@ -64,7 +64,7 @@ bool test_cone_parameters() { // the extracted primitives are to be tested. typename Efficient_ransac::Parameters parameters; parameters.probability = 0.05f; - parameters.min_points = NB_POINTS/10; + parameters.min_points = NB_POINTS / 10; parameters.epsilon = 0.002f; parameters.cluster_epsilon = 1.0f; parameters.normal_threshold = 0.9f; @@ -76,7 +76,7 @@ bool test_cone_parameters() { typename Efficient_ransac::Shape_range shapes = ransac.shapes(); - // Check: unique shape detected. + // Check: unique shape detected. if (shapes.size() != 1) continue; @@ -88,13 +88,13 @@ bool test_cone_parameters() { // Check radius and alignment with axis. if (CGAL::abs(angle - cone->angle()) > (FT) 0.02 - || CGAL::abs(CGAL::abs(axis * cone->axis()) - (FT) 1.0) > (FT) 0.02) + || CGAL::abs(CGAL::abs(axis * cone->axis()) - (FT) 1.0) > (FT) 0.02) continue; // Check apex. Point pos = cone->apex(); FT apex_pos_sqlen = traits.compute_squared_length_3_object()( - traits.construct_vector_3_object()(apex, pos)); + traits.construct_vector_3_object()(apex, pos)); if (apex_pos_sqlen > FT(0.0004)) continue; @@ -106,8 +106,7 @@ bool test_cone_parameters() { if (success >= NB_ROUNDS * 0.8) { std::cout << " succeeded" << std::endl; return true; - } - else { + } else { std::cout << " failed" << std::endl; return false; } @@ -119,14 +118,14 @@ int main() { std::cout << "test_cone_parameters> "; if (!test_cone_parameters >()) success = false; - - std::cout << "test_cone_parameters> "; - if (!test_cone_parameters >()) - success = false; - - std::cout << "test_cone_parameters "; - if (!test_cone_parameters()) - success = false; +// +// std::cout << "test_cone_parameters> "; +// if (!test_cone_parameters >()) +// success = false; +// +// std::cout << "test_cone_parameters "; +// if (!test_cone_parameters()) +// success = false; return (success) ? EXIT_SUCCESS : EXIT_FAILURE; }