diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/CMakeLists.txt b/Surface_mesh_approximation/test/Surface_mesh_approximation/CMakeLists.txt index c07e7b97b44..3735884e631 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/CMakeLists.txt +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/CMakeLists.txt @@ -48,10 +48,12 @@ create_single_source_cgal_program( "vsa_correctness_test.cpp" ) create_single_source_cgal_program( "vsa_error_decrease_test.cpp" ) -create_single_source_cgal_program( "vsa_free_function_test.cpp" ) - create_single_source_cgal_program( "vsa_kernel_test.cpp" ) +create_single_source_cgal_program( "vsa_mesh_approximation_test.cpp" ) + +create_single_source_cgal_program( "vsa_mesh_segmentation_test.cpp" ) + create_single_source_cgal_program( "vsa_meshing_manifold_test.cpp" ) create_single_source_cgal_program( "vsa_metric_test.cpp" ) diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_free_function_test.cpp b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_mesh_approximation_test.cpp similarity index 96% rename from Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_free_function_test.cpp rename to Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_mesh_approximation_test.cpp index 029c73daede..e03d55bce98 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_free_function_test.cpp +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_mesh_approximation_test.cpp @@ -11,7 +11,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef CGAL::Polyhedron_3 Polyhedron; /** - * This file tests the VSA free function API. + * This file tests the free function CGAL::VSA::mesh_approximation. */ int main() { diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_mesh_segmentation_test.cpp b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_mesh_segmentation_test.cpp new file mode 100644 index 00000000000..f9a84898a2c --- /dev/null +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_mesh_segmentation_test.cpp @@ -0,0 +1,45 @@ +#include +#include + +#include +#include +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; +typedef CGAL::VSA::Plane_proxy Plane_proxy; +typedef CGAL::Polyhedron_3 Polyhedron; +typedef typename boost::graph_traits::face_descriptor face_descriptor; +typedef boost::unordered_map Facet_index_map; +typedef boost::associative_property_map Facet_proxy_pmap; + +/** + * This file tests the free function CGAL::VSA::mesh_segmentation. + */ +int main() +{ + Polyhedron input; + std::ifstream file("data/sphere_iso.off"); + if (!file || !(file >> input) || input.empty()) { + std::cerr << "Invalid off file." << std::endl; + return EXIT_FAILURE; + } + + Facet_index_map fidx_map; + BOOST_FOREACH(face_descriptor f, faces(input)) + fidx_map[f] = 0; + Facet_proxy_pmap fpxmap(fidx_map); + + std::vector proxies; + + // free function interface with named parameters + CGAL::VSA::mesh_segmentation(input, + fpxmap, // output indexed face set + CGAL::VSA::parameters::seeding_method(CGAL::VSA::Hierarchical). // hierarchical seeding + max_nb_proxies(200). // both maximum number of proxies stop criterion, + min_error_drop(0.05). // and minimum error drop stop criterion are specified + nb_of_iterations(30). // number of clustering iterations after seeding + nb_of_relaxations(5). // number of relaxations in seeding + proxies(std::back_inserter(proxies))); // number of iterations after seeding + + return EXIT_SUCCESS; +}