diff --git a/Surface_mesh_approximation/doc/Surface_mesh_approximation/surface_mesh_approximation.txt b/Surface_mesh_approximation/doc/Surface_mesh_approximation/surface_mesh_approximation.txt index 56a74158d56..587612b5604 100644 --- a/Surface_mesh_approximation/doc/Surface_mesh_approximation/surface_mesh_approximation.txt +++ b/Surface_mesh_approximation/doc/Surface_mesh_approximation/surface_mesh_approximation.txt @@ -26,7 +26,7 @@ Approximate a triangle mesh and extract the approximated triangle surface, using The following example calls the functions `CGAL::vsa_mesh_approximation()` on the input triangle mesh. -\cgalExample{Surface_mesh_approximation/vsa_example.cpp} +\cgalExample{Surface_mesh_approximation/vsa_extraction_example.cpp} \subsection ApproximationExample_2 User-defined Proxy diff --git a/Surface_mesh_approximation/examples/Surface_mesh_approximation/CMakeLists.txt b/Surface_mesh_approximation/examples/Surface_mesh_approximation/CMakeLists.txt index 6042c9e152d..daa12be7423 100644 --- a/Surface_mesh_approximation/examples/Surface_mesh_approximation/CMakeLists.txt +++ b/Surface_mesh_approximation/examples/Surface_mesh_approximation/CMakeLists.txt @@ -41,5 +41,5 @@ include_directories( BEFORE ../../include ) include( CGAL_CreateSingleSourceCGALProgram ) -create_single_source_cgal_program( "vsa_example.cpp" ) +create_single_source_cgal_program( "vsa_extraction_example.cpp" ) create_single_source_cgal_program( "vsa_metric_example.cpp") diff --git a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_example.cpp b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_extraction_example.cpp similarity index 81% rename from Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_example.cpp rename to Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_extraction_example.cpp index 9bfa750efb0..32051bffc4f 100644 --- a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_example.cpp +++ b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_extraction_example.cpp @@ -36,7 +36,7 @@ int main(int argc, char *argv[]) Polyhedron mesh; std::ifstream input(argv[1]); if (!input || !(input >> mesh) || mesh.empty()) { - std::cerr << "Not a valid off file." << std::endl; + std::cerr << "Invalid off file." << std::endl; return EXIT_FAILURE; } @@ -57,33 +57,20 @@ int main(int argc, char *argv[]) FacetAreaMap area_pmap(facet_areas); VertexPointMap point_pmap = get(boost::vertex_point, const_cast(mesh)); - // create a property-map for segment-ids - typedef std::map Facet_id_map; - Facet_id_map internal_facet_id_map; - for (Facet_const_iterator fitr = mesh.facets_begin(); fitr != mesh.facets_end(); ++fitr) - internal_facet_id_map.insert(std::pair(fitr, 0)); - boost::associative_property_map proxy_patch_map(internal_facet_id_map); - const std::size_t num_proxies = std::atoi(argv[3]); const std::size_t num_iterations = std::atoi(argv[4]); std::vector tris; std::vector anchor_pos; - std::vector anchor_vtx; - std::vector > bdrs; int init = std::atoi(argv[2]); if (init < 0 || init > 3) return EXIT_FAILURE; - CGAL::vsa_mesh_approximation(init, mesh, - num_proxies, - num_iterations, - proxy_patch_map, - point_pmap, + CGAL::vsa_mesh_approximation(mesh, tris, anchor_pos, - anchor_vtx, - bdrs, - L21ApproximationTrait(mesh, point_pmap, normal_pmap, area_pmap)); + L21ApproximationTrait(mesh, point_pmap, normal_pmap, area_pmap), + init, + num_proxies, + num_iterations); return EXIT_SUCCESS; } - diff --git a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_metric_example.cpp b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_metric_example.cpp index 8255a427681..bdae566bf63 100644 --- a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_metric_example.cpp +++ b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_metric_example.cpp @@ -138,7 +138,7 @@ int main(int argc, char *argv[]) Polyhedron mesh; std::ifstream input(argv[1]); if (!input || !(input >> mesh) || mesh.empty()) { - std::cerr << "Not a valid off file." << std::endl; + std::cerr << "Invalid off file." << std::endl; return EXIT_FAILURE; } @@ -171,23 +171,15 @@ int main(int argc, char *argv[]) const std::size_t num_proxies = std::atoi(argv[3]); const std::size_t num_iterations = std::atoi(argv[4]); - std::vector tris; - std::vector anchor_pos; - std::vector anchor_vtx; - std::vector > bdrs; int init = std::atoi(argv[2]); if (init < 0 || init > 3) return EXIT_FAILURE; - CGAL::vsa_mesh_approximation(init, mesh, - num_proxies, - num_iterations, + CGAL::vsa_mesh_approximation(mesh, proxy_patch_map, - point_pmap, - tris, - anchor_pos, - anchor_vtx, - bdrs, - ApproxTrait(mesh, point_pmap, center_pmap, area_pmap, normal_pmap)); + ApproxTrait(mesh, point_pmap, center_pmap, area_pmap, normal_pmap), + init, + num_proxies, + num_iterations); return EXIT_SUCCESS; }