使用CGAL简化组合地图

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

我想简化或边缘折叠从.off文件读取的网格作为使用CGAL的组合地图

 std::ifstream ifile(fileName.toStdString().c_str());
     if (ifile)
     {
        CGAL::load_off(lcc, ifile);
        lcc.display_characteristics(std::cout)<<", is_valid="<<CGAL::is_valid(lcc)<<std::endl;

     }
  namespace SMS = CGAL::Surface_mesh_simplification ;

    SMS::Count_stop_predicate<LCC> stop(lcc.number_of_halfedges()/2 - 1);

 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>())
    );

    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;

输出 :

    #Darts=16674, #0-cells=2775, #1-cells=8337, #2-cells=5558, #ccs=1, is_valid=1
Finished...
0 edges removed.
8337 final edges.
    #Darts=16674, #0-cells=2775, #1-cells=8337, #2-cells=5558, #ccs=1, is_valid=1

该方法什么都不做,我尝试了多个.of​​f文件并且它正确预览但它无法简化它我感谢任何帮助。

c++ qt graphics computational-geometry cgal
1个回答
1
投票

查看给定here的示例,它完美地运行。

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