代码之家  ›  专栏  ›  技术社区  ›  Agnel Kurian

CGAL 3.4:如何从有限边迭代器获得端点坐标?

  •  3
  • Agnel Kurian  · 技术社区  · 15 年前

    下面是一些代码:

    struct K : CGAL::Exact_predicates_inexact_constructions_kernel {};
    
    typedef CGAL::Triangulation_vertex_base_2<K>               Vb;
    typedef CGAL::Constrained_triangulation_face_base_2<K>     Fb;
    typedef CGAL::Triangulation_data_structure_2<Vb,Fb>        TDS;
    typedef CGAL::Exact_predicates_tag                         Itag;
    typedef CGAL::Constrained_triangulation_2<K, TDS, Itag>    CT;
    typedef CT::Point                                          Point;
    
    for (CT::Finite_edges_iterator eit = ct.finite_edges_begin();
        eit != ct.finite_edges_end(); ++eit){
        // TODO: list vertex co-ordinates here
    }
    

    manual :

    我觉得没关系。。。但是如何使用 CT::Finite_edges_iterator 在上面给出的代码中?

    更新:

    Segment s = ct.segment(eit);
    const Point& p1 = s.point(0);
    const Point& p2 = s.point(1);
    

    我仍然在寻找一个更好的方法来做到这一点。

    3 回复  |  直到 15 年前
        1
  •  2
  •   Agnel Kurian    15 年前

    我设法想出了这个解决方案:

    Segment s = ct.segment(eit);
    const Point& p1 = s.point(0);
    const Point& p2 = s.point(1);
    

        2
  •  1
  •   Carlos Lara    11 年前

    我用过类似的东西

    三角测量::顶点处理fVertex=eit->第一->顶点(三角测量):ccw(eit->第二),;

    三角测量::顶点处理sVertex=eit->第一->顶点(三角测量):cw(eit->第二),;

        3
  •  0
  •   tixxit    15 年前

    边提供面上顶点的索引。三角剖分的面在CGAL中只有3个顶点。边是一个三元组(脸,i,j)。你可以 get the i-th (either 0, 1, or 2) vertex of a face using the vertex(i) method.

    v1 = eit->first->vertex(eit->second);
    v2 = eit->first->vertex(eit->third);