本文介绍了使用CGAL简化组合图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I want to simplify or edge collapse a mesh read from .off file as a combinatorial map using 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文件,它可以正确预览,但不能简化它
,我感谢您的帮助。

the method do nothing , I tried more than .off file and it's preview it properly but it cannot simplify it I appreciate any help .

推荐答案

请参见给出的示例,它运行良好。

See the example given here, it works perfectly.

这篇关于使用CGAL简化组合图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 14:46