怎么构造Face_range?

请问CGAL中,我可以从Mesh中获取到Face_range,但是我无法自己构造它?

操作系统:Windows11
语言:C++
编译器:VS2022社区版

在CGAL中,'Face_rangeC3T3::Facet_iterator构成的一个迭代器范围。其中C3T3是三维三角剖分数据结构的一种类型,它存储了一个三角剖分的各种信息,包括点,三角形以及三角形之间的连接信息。

要构造一个 'Face_range。

下面是一个示例代码,它演示了如何从一个 C3T3对象Face_range。


#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Triangulation_data_structure_3.h>
#include <CGAL/Triangulation_vertex_base_with_info_3.h>
#include <CGAL/Triangulation_cell_base_with_info_3.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/iterator.h>

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_vertex_base_with_info_3<unsigned int, K> Vb;
typedef CGAL::Triangulation_cell_base_with_info_3<unsigned int, K> Cb;
typedef CGAL::Triangulation_data_structure_3<Vb, Cb> Tds;
typedef CGAL::Delaunay_triangulation_3<K, Tds> Delaunay;
typedef Delaunay::Cell_handle Cell_handle;
typedef Delaunay::Facet_iterator Facet_iterator;
typedef CGAL::Iterator_range<Facet_iterator> Face_range;

int main()
{
    // 构造三角剖分
    Delaunay dt;
    // ...添加顶点和单元格...
    
    // 构造 Face_range
    std::vector<Facet_iterator> facets;
    for (Facet_iterator it = dt.facets_begin(); it != dt.facets_end(); ++it) {
        facets.push_back(it);
    }
    Face_range face_range(facets.begin(), facets.end());
    
    // 使用 Face_range 遍历所有的面
    for (Facet_iterator it = face_range.begin(); it != face_range.end(); ++it) {
        // ...处理面...
    }

    return 0;
}

注意,构造 'Face

参考:https://www.saoniuhuo.com/article/detail-32047.html