CGAL - 如何在Delaunay三角剖分后检索面和egdes顶点属性?

时间:2017-01-28 10:38:19

标签: c++ qt cgal

我是CGAL C ++库的初学者。 我尝试使用点列表进行简单的Delaunay三角剖分(参见下面的代码)。 它看起来很有效,但我不知道如何获得面和egdes属性(顶点位置)。 我在Delaunay :: Face和Delaunay :: Edge中没有顶点坐标属性, 我怎么能得到它?

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Projection_traits_xy_3<K>  Gt;
typedef CGAL::Delaunay_triangulation_2<Gt> Delaunay;

typedef K::Point_2 Point_2;
typedef K::Point_3 Point_3;
...
void MainWindow::on_pushButton_compute_Delaunay_triangulation_clicked()
{   
    // Point list to trialgulate (2D)
    std::vector<Point_3> vPts;
    vPts.push_back(Point_3(0,0,0));
    vPts.push_back(Point_3(10,0,0));
    vPts.push_back(Point_3(10,10,0));
    vPts.push_back(Point_3(6,5,0));
    vPts.push_back(Point_3(4,1,0));

    // Triangulation
    Delaunay dt(vPts.begin(), vPts.end());
    cout << "Number of vertices : " << dt.number_of_vertices() << std::endl;
    cout << "Number of faces    : " << dt.number_of_faces() << std::endl;
    Delaunay::Face_iterator itF;
    Delaunay::Face face;
    for ( itF = dt.faces_begin(); itF != dt.faces_end(); ++itF) {
        face = *itF;
        cout << face << endl;
    }
    Delaunay::Edge_iterator itE;
    Delaunay::Edge edge;
    for ( itE = dt.edges_begin(); itE != dt.edges_end(); ++itE) {
        edge = *itE;
        cout << "edge." << endl;
    }
}

节目输出:

  • 顶点数:5
  • 面孔数量:5
  • 5x空行(面部)
  • 5x“edge。”线条(边缘)

0 个答案:

没有答案