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 cfddead6989..51d0ff4f7c1 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 @@ -6,21 +6,22 @@ #include #include -#include #include typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef Kernel::FT FT; typedef Kernel::Point_3 Point_3; -typedef CGAL::Polyhedron_3 Polyhedron_3; -typedef Polyhedron_3::Facet_handle Facet_handle; +typedef CGAL::Polyhedron_3 Polyhedron; +typedef Polyhedron::Facet_handle Facet_handle; typedef boost::associative_property_map > FacetProxyMap; +typedef boost::property_map::type VertexPointMap; -typedef CGAL::PlaneProxy PlaneProxy; -typedef CGAL::L2Metric L2Metric; -typedef CGAL::L2ProxyFitting L2ProxyFitting; -typedef CGAL::VSA_approximation VSA; +typedef CGAL::PlaneProxy PlaneProxy; +typedef CGAL::L2Metric L2Metric; +typedef CGAL::L2ProxyFitting L2ProxyFitting; +typedef CGAL::VSA_approximation VSA; /** * This file tests the VSA class API and the L2 metric. @@ -28,7 +29,7 @@ typedef CGAL::VSA_approximation> mesh) || mesh.empty()) { std::cerr << "Invalid off file." << std::endl; @@ -37,20 +38,18 @@ int main() // facet area map std::map facet_index; - for (Polyhedron_3::Facet_iterator fitr = mesh.facets_begin(); + for (Polyhedron::Facet_iterator fitr = mesh.facets_begin(); fitr != mesh.facets_end(); ++fitr) facet_index.insert(std::pair(fitr, 0)); FacetProxyMap proxy_pmap(facet_index); - L2Metric metric(mesh); - L2ProxyFitting proxy_fitting(mesh); - // create VSA L2 metric approximation algorithm instance std::cout << "setup algorithm instance" << std::endl; - VSA l2_approx; - l2_approx.set_mesh(mesh); - l2_approx.set_error_metric(metric); - l2_approx.set_proxy_fitting(proxy_fitting); + VSA l2_approx(mesh, + get(boost::vertex_point, const_cast(mesh))); + L2Metric metric(mesh); + L2ProxyFitting proxy_fitting(mesh); + l2_approx.set_metric(metric, proxy_fitting); // random init and run std::cout << "random init and run" << std::endl; @@ -94,7 +93,7 @@ int main() // extract the approximation polyhedron std::cout << "meshing" << std::endl; - Polyhedron_3 out_mesh; + Polyhedron out_mesh; if (l2_approx.meshing(out_mesh, FT(0.5), true)) std::cout << "manifold." << std::endl; else @@ -110,7 +109,7 @@ int main() std::vector anchor_pos; l2_approx.get_anchor_points(std::back_inserter(anchor_pos)); - std::vector anchor_vtx; + std::vector anchor_vtx; l2_approx.get_anchor_vertices(std::back_inserter(anchor_vtx)); std::vector tris; 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 1fa7e5dc6c6..e4f4ccb07b3 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 @@ -6,34 +6,34 @@ #include #include -#include #include typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef Kernel::FT FT; typedef Kernel::Point_3 Point_3; -typedef CGAL::Polyhedron_3 Polyhedron_3; +typedef CGAL::Polyhedron_3 Polyhedron; +typedef boost::property_map::type VertexPointMap; -typedef CGAL::PlaneProxy PlaneProxy; -typedef CGAL::L21Metric L21Metric; -typedef CGAL::L21ProxyFitting L21ProxyFitting; -typedef CGAL::VSA_approximation VSAL21; +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) { - Polyhedron_3 mesh; + Polyhedron mesh; std::ifstream input(file_name); if (!input || !(input >> mesh) || mesh.empty()) { std::cerr << "Invalid off file." << std::endl; return false; } + // algorithm instance + VSAL21 vsa_l21(mesh, + get(boost::vertex_point, const_cast(mesh))); + L21Metric l21_metric(mesh); L21ProxyFitting l21_fitting(mesh); - - // algorithm instance - VSAL21 vsa_l21(l21_metric, l21_fitting); - vsa_l21.set_mesh(mesh); + vsa_l21.set_metric(l21_metric, l21_fitting); // approximation, init from error, drop to the target error incrementally // should reach targeted number of proxies gradually @@ -51,7 +51,7 @@ bool test_shape(const char *file_name, const std::size_t target_num_proxies) } // meshing, should be manifold - Polyhedron_3 mesh_out; + Polyhedron mesh_out; if (!vsa_l21.meshing(mesh_out)) { std::cout << "incremental reaching meshing non-manifold" << std::endl; return false; 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 27b845e6248..98464a7f068 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 @@ -6,17 +6,17 @@ #include #include -#include #include typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef Kernel::FT FT; -typedef CGAL::Polyhedron_3 Polyhedron_3; +typedef CGAL::Polyhedron_3 Polyhedron; +typedef boost::property_map::type VertexPointMap; -typedef CGAL::PlaneProxy PlaneProxy; -typedef CGAL::L21Metric L21Metric; -typedef CGAL::L21ProxyFitting L21ProxyFitting; -typedef CGAL::VSA_approximation VSAL21; +typedef CGAL::PlaneProxy PlaneProxy; +typedef CGAL::L21Metric L21Metric; +typedef CGAL::L21ProxyFitting L21ProxyFitting; +typedef CGAL::VSA_approximation VSAL21; bool check_strict_ordering(const std::vector &error) { @@ -37,19 +37,20 @@ bool check_strict_ordering(const std::vector &error) */ int main() { - Polyhedron_3 mesh; + Polyhedron mesh; std::ifstream input("./data/sphere_iso.off"); if (!input || !(input >> mesh) || mesh.empty()) { std::cerr << "Invalid off file." << std::endl; return EXIT_FAILURE; } + // algorithm instance + VSAL21 vsa_l21(mesh, + get(boost::vertex_point, const_cast(mesh))); + L21Metric l21_metric(mesh); L21ProxyFitting l21_fitting(mesh); - - // algorithm instance - VSAL21 vsa_l21(l21_metric, l21_fitting); - vsa_l21.set_mesh(mesh); + vsa_l21.set_metric(l21_metric, l21_fitting); vsa_l21.init_proxies(100, VSAL21::RandomInit); std::vector error; diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_metric_test.cpp b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_metric_test.cpp index 9b8b5ffecdf..23858230434 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_metric_test.cpp +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_metric_test.cpp @@ -14,12 +14,13 @@ typedef Kernel::FT FT; typedef Kernel::Vector_3 Vector_3; typedef Kernel::Point_3 Point_3; -typedef CGAL::Polyhedron_3 Polyhedron_3; -typedef Polyhedron_3::Facet_handle Facet_handle; -typedef Polyhedron_3::Halfedge_handle Halfedge_handle; -typedef Polyhedron_3::Facet_iterator Facet_iterator; +typedef CGAL::Polyhedron_3 Polyhedron; +typedef Polyhedron::Facet_handle Facet_handle; +typedef Polyhedron::Halfedge_handle Halfedge_handle; +typedef Polyhedron::Facet_iterator Facet_iterator; typedef boost::associative_property_map > FacetAreaMap; typedef boost::associative_property_map > FacetCenterMap; +typedef boost::property_map::type VertexPointMap; struct PointProxy { Facet_handle seed; @@ -67,14 +68,15 @@ struct PointProxyFitting { const FacetCenterMap center_pmap; const FacetAreaMap area_pmap; }; -typedef CGAL::VSA_approximation CompactVSA; +typedef CGAL::VSA_approximation CompactVSA; /** * This file tests the user defined metric. */ int main() { - Polyhedron_3 mesh; + Polyhedron mesh; std::ifstream input("./data/cube_meshed_open.off"); if (!input || !(input >> mesh) || mesh.empty()) { std::cerr << "Invalid off file." << std::endl; @@ -96,15 +98,14 @@ int main() FacetAreaMap area_pmap(facet_areas); FacetCenterMap center_pmap(facet_centers); - CompactMetric metric(center_pmap); - PointProxyFitting proxy_fitting(center_pmap, area_pmap); - // create compact metric approximation algorithm instance std::cout << "create compact vas instance" << std::endl; - CompactVSA compact_approx; - compact_approx.set_mesh(mesh); - compact_approx.set_error_metric(metric); - compact_approx.set_proxy_fitting(proxy_fitting); + CompactVSA compact_approx(mesh, + get(boost::vertex_point, const_cast(mesh))); + + CompactMetric metric(center_pmap); + PointProxyFitting proxy_fitting(center_pmap, area_pmap); + compact_approx.set_metric(metric, proxy_fitting); std::cout << "random init and run" << std::endl; compact_approx.init_proxies(20, CompactVSA::RandomInit); @@ -115,7 +116,7 @@ int main() // extract the approximation polyhedron std::cout << "meshing" << std::endl; - Polyhedron_3 out_mesh; + Polyhedron out_mesh; if (compact_approx.meshing(out_mesh)) std::cout << "manifold." << std::endl; else