简体   繁体   中英

how can I undo the collapsed edges in a specific region using CGAL

I'm creating an application on QT-creator and using CGAL to read .off file as Linear_cell_complex_for_bgl_combinatorial_map_helper , simplify it using edge_collapse method and re-insert the collapsed edges by undo method

void MainWindow ::simplify()
{

    SMS::Edge_collapse_recorder <LCC,My_visitor> recorder(lcc);
    State state;
   My_visitor mvis(state, lcc);

  bool ok;
 int n = QInputDialog::getInt(this, "", tr("Number of vertices in each cell:"),lcc.number_of_darts(),0, lcc.number_of_darts(),1, &ok);

 if (ok){
    n=lcc.number_of_halfedges()/2 - 1;
   }

 SMS::Count_stop_predicate<LCC> stop(n);

 int r = SMS::edge_collapse
   (lcc
    ,stop
    ,CGAL::parameters::halfedge_index_map(get(CGAL::halfedge_index, lcc))
             .vertex_index_map(get(boost::vertex_index, lcc))
             .get_cost(SMS::Edge_length_cost<LCC>())
   .get_placement(SMS::Midpoint_placement<LCC>()).visitor(recorder.visitor(mvis)));

    std::cout << "\nFinished...\n" << r << " edges removed.\n"
               << (lcc.number_of_darts()/2) << " final edges.\n" ;

     lcc.display_characteristics(std::cout)<<", is_valid="<<CGAL::is_valid(lcc)<<std::endl;


     recorder.undo(mvis);
     std::cout<<"re insert "<<std::endl;
     lcc.display_characteristics(std::cout)<<", is_valid="<<CGAL::is_valid(lcc)<<std::endl;


 }

any Ideas or useful links about : -re-inserting collapsed edges in specific region only , not all collapsed edges?

I appreciate any help .

上面的链接是概念证明,它可以撤消CGAL::Surface_mesh和OpenMesh,但不能撤消CGAL::Polyhedron_3CGAL::LCC

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM