mirror of https://github.com/CGAL/cgal
using the new Shape_detection implementation (instead of the deprecated Shape_detection_3)
This commit is contained in:
parent
fadaee63a8
commit
3b9c73c917
|
|
@ -1206,3 +1206,5 @@ gmon.*
|
|||
/Stream_support/test/Stream_support/cgal_test_with_cmake
|
||||
/*.html
|
||||
/Snap_rounding_2/test/Snap_rounding_2/data/out
|
||||
Polygonal_surface_reconstruction/examples/build*
|
||||
Polygonal_surface_reconstruction/test/build*
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
#include <CGAL/IO/read_xyz_points.h>
|
||||
#include <CGAL/IO/Writer_OFF.h>
|
||||
#include <CGAL/property_map.h>
|
||||
#include <CGAL/Shape_detection_3.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
#include <CGAL/Shape_detection/Efficient_RANSAC.h>
|
||||
#include <CGAL/Polygonal_surface_reconstruction.h>
|
||||
#include <CGAL/SCIP_mixed_integer_program_traits.h>
|
||||
#include <CGAL/Timer.h>
|
||||
|
|
@ -23,10 +23,11 @@ typedef CGAL::Nth_of_tuple_property_map<0, PNI> Point_map;
|
|||
typedef CGAL::Nth_of_tuple_property_map<1, PNI> Normal_map;
|
||||
typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map;
|
||||
|
||||
typedef CGAL::Shape_detection_3::Shape_detection_traits<Kernel, Point_vector, Point_map, Normal_map> Traits;
|
||||
typedef CGAL::Shape_detection_3::Efficient_RANSAC<Traits> Efficient_ransac;
|
||||
typedef CGAL::Shape_detection_3::Plane<Traits> Plane;
|
||||
typedef CGAL::Shape_detection_3::Point_to_shape_index_map<Traits> Point_to_shape_index_map;
|
||||
typedef CGAL::Shape_detection::Efficient_RANSAC_traits<Kernel, Point_vector, Point_map, Normal_map> Traits;
|
||||
|
||||
typedef CGAL::Shape_detection::Efficient_RANSAC<Traits> Efficient_ransac;
|
||||
typedef CGAL::Shape_detection::Plane<Traits> Plane;
|
||||
typedef CGAL::Shape_detection::Point_to_shape_index_map<Traits> Point_to_shape_index_map;
|
||||
|
||||
typedef CGAL::Polygonal_surface_reconstruction<Kernel> Polygonal_surface_reconstruction;
|
||||
typedef CGAL::Surface_mesh<Point> Surface_mesh;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
|
||||
#ifndef SKIP_TEST_USING_GLPK
|
||||
#include <CGAL/GLPK_mixed_integer_program_traits.h>
|
||||
|
|
@ -32,9 +31,9 @@ typedef CGAL::GLPK_mixed_integer_program_traits<double> GLPK_Solver;
|
|||
typedef CGAL::SCIP_mixed_integer_program_traits<double> SCIP_Solver;
|
||||
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
std::cerr << "Testing the Polygonal Surface Reconstruction method...\n\n";
|
||||
std::cerr << "Testing the Polygonal Surface Reconstruction method...\n";
|
||||
|
||||
#if 0
|
||||
argc = 2;
|
||||
|
|
@ -49,7 +48,7 @@ int main(int argc, char * argv[])
|
|||
std::cerr << "For the input point cloud, reconstruct a water-tight polygonal surface.\n";
|
||||
std::cerr << "\n";
|
||||
std::cerr << "Usage: " << argv[0] << " point_cloud_file" << std::endl;
|
||||
std::cerr << "Input file formats are \'pwn\' and \'ply\'. No output.\n\n";
|
||||
std::cerr << "Input file formats are \'pwn\' and \'ply\'. No output.\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
@ -57,50 +56,50 @@ int main(int argc, char * argv[])
|
|||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
std::cerr << "--- Using Simple cartesian kernel\n\n";
|
||||
std::cerr << "--- Using Simple cartesian kernel";
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
#ifndef SKIP_TEST_USING_GLPK
|
||||
std::cerr << "\n\t---- Using GLPK solver\n\n";
|
||||
std::cerr << "\n\t---- Using GLPK solver\n";
|
||||
|
||||
std::cerr << "\t\t---- using provided planes\n";
|
||||
reconstruct<Cartesian, GLPK_Solver>(input_file, false);
|
||||
|
||||
std::cerr << "\n\t\t---- re-extract planes\n";
|
||||
std::cerr << "\t\t---- re-extract planes\n";
|
||||
reconstruct<Cartesian, GLPK_Solver>(input_file, true);
|
||||
#endif
|
||||
|
||||
std::cerr << "\n\t---- Using SCIP solver\n\n";
|
||||
std::cerr << "\n\t---- Using SCIP solver\n";
|
||||
|
||||
std::cerr << "\t\t---- using provided planes\n";
|
||||
reconstruct<Cartesian, SCIP_Solver>(input_file, false);
|
||||
|
||||
std::cerr << "\n\t\t---- re-extract planes\n\n";
|
||||
std::cerr << "\t\t---- re-extract planes\n";
|
||||
reconstruct<Cartesian, SCIP_Solver>(input_file, true);
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
std::cerr << "\n--- Using Epick kernel\n\n";
|
||||
std::cerr << "\n--- Using Epick kernel";
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
#ifndef SKIP_TEST_USING_GLPK
|
||||
std::cerr << "\t---- Using GLPK solver\n\n";
|
||||
std::cerr << "\n\t---- Using GLPK solver\n";
|
||||
|
||||
std::cerr << "\t\t---- using provided planes\n";
|
||||
reconstruct<Epick, GLPK_Solver>(input_file, false);
|
||||
|
||||
std::cerr << "\n\t\t---- re-extract planes\n";
|
||||
std::cerr << "\t\t---- re-extract planes\n";
|
||||
reconstruct<Epick, GLPK_Solver>(input_file, true);
|
||||
#endif
|
||||
|
||||
std::cerr << "\n\t---- Using SCIP solver\n\n";
|
||||
std::cerr << "\n\t---- Using SCIP solver\n";
|
||||
|
||||
std::cerr << "\t\t---- using provided planes\n";
|
||||
reconstruct<Epick, SCIP_Solver>(input_file, false);
|
||||
|
||||
std::cerr << "\n\t\t---- re-extract planes\n";
|
||||
std::cerr << "\t\t---- re-extract planes\n";
|
||||
reconstruct<Epick, SCIP_Solver>(input_file, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
#include <CGAL/IO/read_xyz_points.h>
|
||||
#include <CGAL/IO/read_ply_points.h>
|
||||
#include <CGAL/property_map.h>
|
||||
#include <CGAL/Shape_detection_3.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
#include <CGAL/Shape_detection/Efficient_RANSAC.h>
|
||||
#include <CGAL/Polygonal_surface_reconstruction.h>
|
||||
#include <CGAL/Timer.h>
|
||||
|
||||
|
|
@ -34,11 +34,11 @@ int reconstruct(const std::string& input_file, bool force_extract_planes)
|
|||
typedef CGAL::Nth_of_tuple_property_map<1, PNI> Normal_map;
|
||||
typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map;
|
||||
|
||||
typedef CGAL::Shape_detection_3::Shape_detection_traits<Kernel, Point_vector, Point_map, Normal_map> Traits;
|
||||
typedef CGAL::Shape_detection_3::Efficient_RANSAC<Traits> Efficient_ransac;
|
||||
typedef CGAL::Shape_detection_3::Plane<Traits> Plane;
|
||||
typedef CGAL::Shape_detection_3::Point_to_shape_index_map<Traits> Point_to_shape_index_map;
|
||||
typedef CGAL::Shape_detection::Efficient_RANSAC_traits<Kernel, Point_vector, Point_map, Normal_map> Traits;
|
||||
|
||||
typedef CGAL::Shape_detection::Efficient_RANSAC<Traits> Efficient_ransac;
|
||||
typedef CGAL::Shape_detection::Plane<Traits> Plane;
|
||||
typedef CGAL::Shape_detection::Point_to_shape_index_map<Traits> Point_to_shape_index_map;
|
||||
|
||||
Point_vector points;
|
||||
|
||||
|
|
@ -150,15 +150,15 @@ int reconstruct(const std::string& input_file, bool force_extract_planes)
|
|||
std::cerr << " Failed: " << algo.error_message() << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
std::cout << " Done. Time: " << t.time() << " sec." << std::endl;
|
||||
std::cout << " Done. Time: " << t.time() << " sec. ";
|
||||
|
||||
if (model.is_valid()) {
|
||||
std::cout << "\t\t\tReconstructed model has " << model.number_of_faces() << " faces" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
std::cout << "\tReconstructed model has " << model.number_of_faces() << " faces" << std::endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
else {
|
||||
std::cout << "\t\t\tReconstructed model is not valid. Reconstruction maybe failed?" << std::endl;
|
||||
return EXIT_SUCCESS;
|
||||
std::cout << "\tReconstructed model is not valid. Reconstruction maybe failed?" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@
|
|||
#include <CGAL/Kernel_traits.h>
|
||||
#include <CGAL/IO/io.h>
|
||||
|
||||
#include <boost/property_map/property_map.hpp>
|
||||
|
||||
#include <tuple>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
|
|
|||
Loading…
Reference in New Issue