diff --git a/Shape_detection/test/Shape_detection/CMakeLists.txt b/Shape_detection/test/Shape_detection/CMakeLists.txt index 2f4245f2f762..503af515ccfa 100644 --- a/Shape_detection/test/Shape_detection/CMakeLists.txt +++ b/Shape_detection/test/Shape_detection/CMakeLists.txt @@ -49,19 +49,9 @@ if(TARGET CGAL::Eigen3_support) endforeach() set(RANSAC_PROTO_DIR CACHE PATH "") - if(NOT RANSAC_PROTO_DIR STREQUAL "") - add_compile_definitions(-DPOINTSWITHINDEX -DCGAL_TEST_RANSAC_PROTOTYPE) - include_directories(${RANSAC_PROTO_DIR}) - include_directories(${RANSAC_PROTO_DIR}/MiscLib/) - file(GLOB proto_src "${RANSAC_PROTO_DIR}/*.cpp") - file(GLOB proto_misc_src "${RANSAC_PROTO_DIR}/MiscLib/*.cpp") - add_library(libproto STATIC ${proto_src} ${proto_misc_src}) - add_executable(test_validity_sampled_data "test_validity_sampled_data.cpp") - target_link_libraries(test_validity_sampled_data libproto CGAL::CGAL CGAL::Data CGAL::Eigen3_support) - else() - add_executable(test_validity_sampled_data "test_validity_sampled_data.cpp") - target_link_libraries(test_validity_sampled_data CGAL::CGAL CGAL::Data CGAL::Eigen3_support) - endif() + + add_executable(test_validity_sampled_data "test_validity_sampled_data.cpp") + target_link_libraries(test_validity_sampled_data CGAL::CGAL CGAL::Data CGAL::Eigen3_support) cgal_add_test(test_validity_sampled_data) else() message(STATUS "NOTICE: Some tests require Eigen 3.1 (or greater), and will not be compiled.") diff --git a/Shape_detection/test/Shape_detection/test_validity_sampled_data.cpp b/Shape_detection/test/Shape_detection/test_validity_sampled_data.cpp index 8e073a0750a6..6381eda2f673 100644 --- a/Shape_detection/test/Shape_detection/test_validity_sampled_data.cpp +++ b/Shape_detection/test/Shape_detection/test_validity_sampled_data.cpp @@ -4,12 +4,6 @@ #include #include -#ifdef CGAL_TEST_RANSAC_PROTOTYPE -#include -#include -#include -#include -#endif #include #include @@ -179,78 +173,5 @@ void test_copied_point_cloud (const Point_set& original_points, std::size_t nb) // RANSAC should detect at least 75% of shapes. assert (detected_ransac[detected_ransac.size() / 2] > std::size_t(0.75 * ground_truth)); -#ifdef CGAL_TEST_RANSAC_PROTOTYPE - { - CGAL::Real_timer timer; - double timeout = 120.; // 2 minutes timeout - timer.start(); - std::size_t nb_runs = 500; - std::vector detected_ransac; - std::vector times_ransac; - for (std::size_t run = 0; run < nb_runs; ++ run) - { - PointCloud proto_points; - proto_points.reserve (points.size()); - - Point Pt; - for (std::size_t i = 0; i < points.size(); ++i) - { - Pt.pos[0] = static_cast(points[i].first.x()); - Pt.pos[1] = static_cast(points[i].first.y()); - Pt.pos[2] = static_cast(points[i].first.z()); - Pt.normal[0] = static_cast(points[i].second.x()); - Pt.normal[1] = static_cast(points[i].second.y()); - Pt.normal[2] = static_cast(points[i].second.z()); -#ifdef POINTSWITHINDEX - Pt.index = i; -#endif - proto_points.push_back(Pt); - } - - // Manually set bounding box! - Vec3f cbbMin, cbbMax; - cbbMin[0] = static_cast(bbox.xmin()); - cbbMin[1] = static_cast(bbox.ymin()); - cbbMin[2] = static_cast(bbox.zmin()); - cbbMax[0] = static_cast(bbox.xmax()); - cbbMax[1] = static_cast(bbox.ymax()); - cbbMax[2] = static_cast(bbox.zmax()); - proto_points.setBBox(cbbMin, cbbMax); - - // Sets parameters for shape detection. - RansacShapeDetector::Options options; - options.m_epsilon = parameters.epsilon; - options.m_bitmapEpsilon = parameters.cluster_epsilon; - options.m_normalThresh = parameters.normal_threshold; - options.m_probability = parameters.probability; - options.m_minSupport = parameters.min_points; - - CGAL::Real_timer t; - t.start(); - RansacShapeDetector ransac (options); // the detector object - ransac.Add (new PlanePrimitiveShapeConstructor()); - MiscLib::Vector, std::size_t> > shapes; // stores the detected shapes - ransac.Detect (proto_points, 0, proto_points.size(), &shapes); - t.stop(); - - detected_ransac.emplace_back (shapes.size()); - times_ransac.emplace_back (t.time() * 1000); - if (timer.time() > timeout) - { - nb_runs = run + 1; - break; - } - } - - std::sort (detected_ransac.begin(), detected_ransac.end()); - std::sort (times_ransac.begin(), times_ransac.end()); - std::cerr << "RANSAC (proto) = " << detected_ransac[detected_ransac.size() / 2] - << " planes (" << times_ransac[times_ransac.size() / 2] << "ms) (on " - << nb_runs << " runs, planes[" - << detected_ransac.front() << ";" << detected_ransac.back() << "], time[" - << times_ransac.front() << ";" << times_ransac.back() << "])" << std::endl; - } -#endif - std::cerr << std::endl; }