如何使用CGAL撤消特定区域中的折叠边缘

问题描述 投票:0回答:1

我正在QT创建器上创建一个应用程序,并使用CGAL将.off文件读取为Linear_cell_complex_for_bgl_combinatorial_map_helper,使用edge_collapse方法简化它并使用undo方法重新插入折叠边缘

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;


 }

任何想法或有用的链接: - 仅插入特定区域中的折叠边缘,而不是所有折叠边缘?

我感谢任何帮助。

qt computational-geometry mesh cgal simplification
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.