diff --git a/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/vsa_autoinit_timing_benchmark.cpp b/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/vsa_autoinit_timing_benchmark.cpp index 17a124e0ead..4ef9f2b2dfe 100644 --- a/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/vsa_autoinit_timing_benchmark.cpp +++ b/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/vsa_autoinit_timing_benchmark.cpp @@ -11,18 +11,12 @@ #include typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; -typedef CGAL::Polyhedron_3 Polyhedron_3; typedef Kernel::FT FT; -typedef Kernel::Point_3 Point_3; -typedef Kernel::Vector_3 Vector_3; typedef CGAL::Polyhedron_3 Polyhedron_3; -typedef Polyhedron_3::Facet_handle Facet_handle; -typedef boost::associative_property_map > FacetAreaMap; -typedef boost::associative_property_map > FacetNormalMap; typedef CGAL::PlaneProxy PlaneProxy; -typedef CGAL::L21Metric L21Metric; -typedef CGAL::L21ProxyFitting L21ProxyFitting; +typedef CGAL::L21Metric L21Metric; +typedef CGAL::L21ProxyFitting L21ProxyFitting; typedef CGAL::VSA_approximation VSAL21; typedef CGAL::Timer Timer; @@ -46,25 +40,8 @@ int main(int argc, char *argv[]) } std::cerr << "#triangles " << mesh.size_of_facets() << std::endl; - std::map facet_normals; - std::map facet_areas; - for (Polyhedron_3::Facet_iterator fitr = mesh.facets_begin(); - fitr != mesh.facets_end(); ++fitr) { - Polyhedron_3::Halfedge_handle he = fitr->halfedge(); - const Point_3 &p0 = he->opposite()->vertex()->point(); - const Point_3 &p1 = he->vertex()->point(); - const Point_3 &p2 = he->next()->vertex()->point(); - - Vector_3 normal = CGAL::unit_normal(p0, p1, p2); - facet_normals.insert(std::pair(fitr, normal)); - FT area(std::sqrt(CGAL::to_double(CGAL::squared_area(p0, p1, p2)))); - facet_areas.insert(std::pair(fitr, area)); - } - FacetNormalMap normal_pmap(facet_normals); - FacetAreaMap area_pmap(facet_areas); - - L21Metric l21_metric(normal_pmap, area_pmap); - L21ProxyFitting l21_fitting(normal_pmap, area_pmap); + L21Metric l21_metric(mesh); + L21ProxyFitting l21_fitting(mesh); // algorithm instance VSAL21 vsa_l21(l21_metric, l21_fitting); diff --git a/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/vsa_timing_benchmark.cpp b/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/vsa_timing_benchmark.cpp index c632a3245a8..cfbeeffe013 100644 --- a/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/vsa_timing_benchmark.cpp +++ b/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/vsa_timing_benchmark.cpp @@ -12,17 +12,10 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef CGAL::Polyhedron_3 Polyhedron_3; -typedef Kernel::FT FT; -typedef Kernel::Point_3 Point_3; -typedef Kernel::Vector_3 Vector_3; -typedef CGAL::Polyhedron_3 Polyhedron_3; -typedef Polyhedron_3::Facet_handle Facet_handle; -typedef boost::associative_property_map > FacetAreaMap; -typedef boost::associative_property_map > FacetNormalMap; typedef CGAL::PlaneProxy PlaneProxy; -typedef CGAL::L21Metric L21Metric; -typedef CGAL::L21ProxyFitting L21ProxyFitting; +typedef CGAL::L21Metric L21Metric; +typedef CGAL::L21ProxyFitting L21ProxyFitting; typedef CGAL::VSA_approximation VSAL21; typedef CGAL::Timer Timer; @@ -48,25 +41,8 @@ int main(int argc, char *argv[]) } std::cerr << "#triangles " << mesh.size_of_facets() << std::endl; - std::map facet_normals; - std::map facet_areas; - for (Polyhedron_3::Facet_iterator fitr = mesh.facets_begin(); - fitr != mesh.facets_end(); ++fitr) { - Polyhedron_3::Halfedge_handle he = fitr->halfedge(); - const Point_3 &p0 = he->opposite()->vertex()->point(); - const Point_3 &p1 = he->vertex()->point(); - const Point_3 &p2 = he->next()->vertex()->point(); - - Vector_3 normal = CGAL::unit_normal(p0, p1, p2); - facet_normals.insert(std::pair(fitr, normal)); - FT area(std::sqrt(CGAL::to_double(CGAL::squared_area(p0, p1, p2)))); - facet_areas.insert(std::pair(fitr, area)); - } - FacetNormalMap normal_pmap(facet_normals); - FacetAreaMap area_pmap(facet_areas); - - L21Metric l21_metric(normal_pmap, area_pmap); - L21ProxyFitting l21_fitting(normal_pmap, area_pmap); + L21Metric l21_metric(mesh); + L21ProxyFitting l21_fitting(mesh); // algorithm instance VSAL21 vsa_l21(l21_metric, l21_fitting); diff --git a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_class_interface_example.cpp b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_class_interface_example.cpp index fba837a0142..7edb4441ddb 100644 --- a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_class_interface_example.cpp +++ b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_class_interface_example.cpp @@ -11,14 +11,11 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef CGAL::Polyhedron_3 Polyhedron_3; -typedef Kernel::FT FT; typedef Kernel::Point_3 Point_3; typedef CGAL::Polyhedron_3 Polyhedron_3; -typedef Polyhedron_3::Facet_handle Facet_handle; -typedef boost::associative_property_map > FacetAreaMap; typedef CGAL::PlaneProxy PlaneProxy; -typedef CGAL::L2Metric L2Metric; +typedef CGAL::L2Metric L2Metric; typedef CGAL::L2ProxyFitting L2ProxyFitting; typedef CGAL::VSA_approximation VSA; @@ -35,20 +32,6 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } - // facet area map - std::map facet_areas; - for (Polyhedron_3::Facet_iterator fitr = mesh.facets_begin(); - fitr != mesh.facets_end(); ++fitr) { - Polyhedron_3::Halfedge_handle he = fitr->halfedge(); - const Point_3 &p0 = he->opposite()->vertex()->point(); - const Point_3 &p1 = he->vertex()->point(); - const Point_3 &p2 = he->next()->vertex()->point(); - - FT farea(std::sqrt(CGAL::to_double(CGAL::squared_area(p0, p1, p2)))); - facet_areas.insert(std::pair(fitr, farea)); - } - FacetAreaMap area_pmap(facet_areas); - const std::size_t num_proxies = std::atoi(argv[3]); const std::size_t num_iterations = std::atoi(argv[4]); std::vector tris; @@ -57,7 +40,7 @@ int main(int argc, char *argv[]) if (init < 0 || init > 2) return EXIT_FAILURE; - L2Metric metric(mesh, area_pmap); + L2Metric metric(mesh); L2ProxyFitting proxy_fitting(mesh); // create VSA L2 metric approximation algorithm instance diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_class_interface_test.cpp b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_class_interface_test.cpp index 7babeeca346..a08c0a1faf2 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_class_interface_test.cpp +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_class_interface_test.cpp @@ -10,16 +10,15 @@ #include typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; -typedef CGAL::Polyhedron_3 Polyhedron_3; typedef Kernel::FT FT; typedef Kernel::Point_3 Point_3; + typedef CGAL::Polyhedron_3 Polyhedron_3; typedef Polyhedron_3::Facet_handle Facet_handle; -typedef boost::associative_property_map > FacetAreaMap; typedef boost::associative_property_map > FacetProxyMap; typedef CGAL::PlaneProxy PlaneProxy; -typedef CGAL::L2Metric L2Metric; +typedef CGAL::L2Metric L2Metric; typedef CGAL::L2ProxyFitting L2ProxyFitting; typedef CGAL::VSA_approximation VSA; @@ -37,24 +36,13 @@ int main() } // facet area map - std::map facet_areas; std::map facet_index; for (Polyhedron_3::Facet_iterator fitr = mesh.facets_begin(); - fitr != mesh.facets_end(); ++fitr) { - Polyhedron_3::Halfedge_handle he = fitr->halfedge(); - const Point_3 &p0 = he->opposite()->vertex()->point(); - const Point_3 &p1 = he->vertex()->point(); - const Point_3 &p2 = he->next()->vertex()->point(); - - FT farea(std::sqrt(CGAL::to_double(CGAL::squared_area(p0, p1, p2)))); - facet_areas.insert(std::pair(fitr, farea)); - + fitr != mesh.facets_end(); ++fitr) facet_index.insert(std::pair(fitr, 0)); - } - FacetAreaMap area_pmap(facet_areas); FacetProxyMap proxy_pmap(facet_index); - L2Metric metric(mesh, area_pmap); + L2Metric metric(mesh); L2ProxyFitting proxy_fitting(mesh); // create VSA L2 metric approximation algorithm instance diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_correctness_test.cpp b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_correctness_test.cpp index 25c46e251eb..9ab05fe1d38 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_correctness_test.cpp +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_correctness_test.cpp @@ -10,18 +10,13 @@ #include typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; -typedef CGAL::Polyhedron_3 Polyhedron_3; typedef Kernel::FT FT; typedef Kernel::Point_3 Point_3; -typedef Kernel::Vector_3 Vector_3; typedef CGAL::Polyhedron_3 Polyhedron_3; -typedef Polyhedron_3::Facet_handle Facet_handle; -typedef boost::associative_property_map > FacetAreaMap; -typedef boost::associative_property_map > FacetNormalMap; typedef CGAL::PlaneProxy PlaneProxy; -typedef CGAL::L21Metric L21Metric; -typedef CGAL::L21ProxyFitting L21ProxyFitting; +typedef CGAL::L21Metric L21Metric; +typedef CGAL::L21ProxyFitting L21ProxyFitting; typedef CGAL::VSA_approximation VSAL21; bool test_shape(const char *file_name, const std::size_t target_num_proxies) @@ -33,25 +28,8 @@ bool test_shape(const char *file_name, const std::size_t target_num_proxies) return false; } - std::map facet_normals; - std::map facet_areas; - for (Polyhedron_3::Facet_iterator fitr = mesh.facets_begin(); - fitr != mesh.facets_end(); ++fitr) { - Polyhedron_3::Halfedge_handle he = fitr->halfedge(); - const Point_3 &p0 = he->opposite()->vertex()->point(); - const Point_3 &p1 = he->vertex()->point(); - const Point_3 &p2 = he->next()->vertex()->point(); - - Vector_3 normal = CGAL::unit_normal(p0, p1, p2); - facet_normals.insert(std::pair(fitr, normal)); - FT area(std::sqrt(CGAL::to_double(CGAL::squared_area(p0, p1, p2)))); - facet_areas.insert(std::pair(fitr, area)); - } - FacetNormalMap normal_pmap(facet_normals); - FacetAreaMap area_pmap(facet_areas); - - L21Metric l21_metric(normal_pmap, area_pmap); - L21ProxyFitting l21_fitting(normal_pmap, area_pmap); + L21Metric l21_metric(mesh); + L21ProxyFitting l21_fitting(mesh); // algorithm instance VSAL21 vsa_l21(l21_metric, l21_fitting); diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_error_decrease_test.cpp b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_error_decrease_test.cpp index a7b665feaff..4441547f13b 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_error_decrease_test.cpp +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_error_decrease_test.cpp @@ -10,18 +10,12 @@ #include typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; -typedef CGAL::Polyhedron_3 Polyhedron_3; typedef Kernel::FT FT; -typedef Kernel::Point_3 Point_3; -typedef Kernel::Vector_3 Vector_3; typedef CGAL::Polyhedron_3 Polyhedron_3; -typedef Polyhedron_3::Facet_handle Facet_handle; -typedef boost::associative_property_map > FacetAreaMap; -typedef boost::associative_property_map > FacetNormalMap; typedef CGAL::PlaneProxy PlaneProxy; -typedef CGAL::L21Metric L21Metric; -typedef CGAL::L21ProxyFitting L21ProxyFitting; +typedef CGAL::L21Metric L21Metric; +typedef CGAL::L21ProxyFitting L21ProxyFitting; typedef CGAL::VSA_approximation VSAL21; bool check_strict_ordering(const std::vector &error) @@ -50,25 +44,8 @@ int main() return EXIT_FAILURE; } - std::map facet_normals; - std::map facet_areas; - for (Polyhedron_3::Facet_iterator fitr = mesh.facets_begin(); - fitr != mesh.facets_end(); ++fitr) { - Polyhedron_3::Halfedge_handle he = fitr->halfedge(); - const Point_3 &p0 = he->opposite()->vertex()->point(); - const Point_3 &p1 = he->vertex()->point(); - const Point_3 &p2 = he->next()->vertex()->point(); - - Vector_3 normal = CGAL::unit_normal(p0, p1, p2); - facet_normals.insert(std::pair(fitr, normal)); - FT area(std::sqrt(CGAL::to_double(CGAL::squared_area(p0, p1, p2)))); - facet_areas.insert(std::pair(fitr, area)); - } - FacetNormalMap normal_pmap(facet_normals); - FacetAreaMap area_pmap(facet_areas); - - L21Metric l21_metric(normal_pmap, area_pmap); - L21ProxyFitting l21_fitting(normal_pmap, area_pmap); + L21Metric l21_metric(mesh); + L21ProxyFitting l21_fitting(mesh); // algorithm instance VSAL21 vsa_l21(l21_metric, l21_fitting);