diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt b/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt index 30bc1e26d44..c91edb8c0f7 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt @@ -9,21 +9,12 @@ find_package(CGAL QUIET) if ( CGAL_FOUND ) - find_package(Eigen3 3.2.0) #(requires 3.2.0 or greater) - include(CGAL_Eigen_support) - - -include_directories( BEFORE "c:/3rdPartyLibs/fast-envelope-VC/include" ) -link_directories ( "c:/3rdPartyLibs/fast-envelope-VC/lib" "c:/3rdPartyLibs/fast-envelope-VC" "c:/3rdPartyLibs/fast-envelope-VC/tbb" ) - # create a target per cppfile file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(cppfile ${cppfiles}) create_single_source_cgal_program( "${cppfile}" ) endforeach() - target_link_libraries( test_edge_collapse_FastEnvelope PUBLIC CGAL::Eigen_support) - target_link_libraries( test_edge_collapse_FastEnvelope PUBLIC ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} FastEnvelope IndirectPredicates geogram) else() message(STATUS "This program requires the CGAL library, and will not be compiled.") diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_FastEnvelope.cpp b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_FastEnvelope.cpp deleted file mode 100644 index 2ceeb83352e..00000000000 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_FastEnvelope.cpp +++ /dev/null @@ -1,180 +0,0 @@ -#include -#include -#include - -// Simplification function -#include -#include - - -#include -#include -#include - -#include -#include - -//bbox -#include - -#include -#include - -namespace SMS = CGAL::Surface_mesh_simplification; - -typedef CGAL::Simple_cartesian Kernel; - -typedef Kernel::Point_3 Point_3; -typedef CGAL::Surface_mesh Surface; - -typedef SMS::LindstromTurk_cost Cost; -typedef SMS::LindstromTurk_placement Placement; -typedef SMS::FastEnvelope_filter > Filter; - -struct Stats -{ - std::size_t collected = 0; - std::size_t processed = 0; - std::size_t collapsed = 0; - std::size_t non_collapsable = 0; - std::size_t cost_uncomputable = 0; - std::size_t placement_uncomputable = 0; -}; - -struct My_visitor : SMS::Edge_collapse_visitor_base -{ - My_visitor(Stats* s) : stats(s) {} - - // Called during the collecting phase for each edge collected. - void OnCollected(const Profile&, const boost::optional&) - { - ++(stats->collected); - std::cerr << "\rEdges collected: " << stats->collected << std::flush; - } - - // Called during the processing phase for each edge selected. - // If cost is absent the edge won't be collapsed. - void OnSelected(const Profile&, - boost::optional cost, - std::size_t initial, - std::size_t current) - { - ++(stats->processed); - if(!cost) - ++(stats->cost_uncomputable); - } - - // Called during the processing phase for each edge being collapsed. - // If placement is absent the edge is left uncollapsed. - void OnCollapsing(const Profile&, - boost::optional placement) - { - if(!placement) - ++(stats->placement_uncomputable); - } - - // Called for each edge which failed the so called link-condition, - // that is, which cannot be collapsed because doing so would - // turn the surface mesh into a non-manifold. - void OnNonCollapsable(const Profile&) - { - ++(stats->non_collapsable); - } - - // Called after each edge has been collapsed - void OnCollapsed(const Profile&, vertex_descriptor) - { - ++(stats->collapsed); - } - - Stats* stats; -}; - -int main(int argc, char** argv) -{ - Surface ref_mesh; - std::ifstream is(argc > 1 ? argv[1] : "data/helmet.off"); - is >> ref_mesh; - - SMS::Count_stop_predicate stop(num_halfedges(ref_mesh)/100); - - Stats stats; - My_visitor vis(&stats); - - std::cout << "Input has " << num_vertices(ref_mesh) << " vertices and " << num_edges(ref_mesh) << " edges" << std::endl; - CGAL::Iso_cuboid_3 bbox(CGAL::Polygon_mesh_processing::bbox(ref_mesh)); - - Point_3 cmin = (bbox.min)(); - Point_3 cmax = (bbox.max)(); - const double diag = CGAL::approximate_sqrt(CGAL::squared_distance(cmin, cmax)); - - Surface mesh_cpy = ref_mesh; // need a copy to keep the AABB tree valid - Surface small_mesh = ref_mesh; - Surface big_mesh = ref_mesh; - Surface huge_mesh = ref_mesh; - - CGAL::Timer t; - t.start(); - /* - { - Placement placement_ref; - SMS::edge_collapse(ref_mesh, stop, CGAL::parameters::get_cost(Cost()).get_placement(placement_ref)); - std::cout << "Output has " << vertices(ref_mesh).size() << " vertices and " << edges(ref_mesh).size() << " edges" << std::endl; - std::cout << t.time() << "sec\n"; - t.reset(); - } - */ - - /* - { - std::cout << "eps = " << 0.00005*diag << std::endl; - Placement placement_ref; - Filtered_placement ignore(0.00005*diag); - SMS::edge_collapse(small_mesh, stop, ignore, CGAL::parameters::get_cost(Cost()).get_placement(placement_ref)); - std::cout << "Output has " << vertices(small_mesh).size() << " vertices and " << edges(small_mesh).size() << " edges" << std::endl; - std::cout << t.time() << "sec\n"; - t.reset(); - } - */ - { - std::cout << "eps = " << 0.01*diag << std::endl; - Placement placement_ref; - Filter filter(0.01*diag); - SMS::edge_collapse(big_mesh, stop, CGAL::parameters::get_cost(Cost()).get_filter(filter).visitor(vis).get_placement(placement_ref)); - std::cout << "Output has " << vertices(big_mesh).size() << " vertices and " << edges(big_mesh).size() << " edges" << std::endl; - std::cout << t.time() << "sec\n"; - } - /* - { - std::cout << "eps = " << 0.0002*diag << std::endl; - Placement placement_ref; - Filtered_placement ignore(0.0002*diag); - SMS::edge_collapse(huge_mesh, stop, ignore, CGAL::parameters::get_cost(Cost()).get_placement(placement_ref)); - std::cout << "Output has " << vertices(huge_mesh).size() << " vertices and " << edges(huge_mesh).size() << " edges" << std::endl; - std::cout << t.time() << "sec\n"; - } - */ - std::ofstream out("big.off"); - out << big_mesh << std::endl; - out.close(); - - std::cout << "no filtering: " << vertices(ref_mesh).size() << " vertices left" << std::endl; - std::cout << "huge filtering distance: " << vertices(huge_mesh).size() << " vertices left" << std::endl; - std::cout << "large filtering distance: " << vertices(big_mesh).size() << " vertices left" << std::endl; - std::cout << "small filtering distance: " << vertices(small_mesh).size() << " vertices left" << std::endl; - - std::cout << "\nEdges collected: " << stats.collected - << "\nEdges proccessed: " << stats.processed - << "\nEdges collapsed: " << stats.collapsed - << std::endl - << "\nEdges not collapsed due to topological constraints: " << stats.non_collapsable - << "\nEdge not collapsed due to cost computation constraints: " << stats.cost_uncomputable - << "\nEdge not collapsed due to placement computation constraints: " << stats.placement_uncomputable - << std::endl; - - assert(vertices(ref_mesh).size() < vertices(small_mesh).size()); - assert(vertices(huge_mesh).size() < vertices(small_mesh).size()); - assert(vertices(ref_mesh).size() < vertices(big_mesh).size()); - - return EXIT_SUCCESS; -}