CGAL - 从段2获取边缘
问题描述:
我正在使用CGAL,并且我有一个用某些顶点创建的多边形。CGAL - 从段2获取边缘
现在,我得到一个段,用:
Segment_2 segment = polygon.edge(i)
其中i
是指数从0
到polygon.size()
。
如何将Segment_2
转换为Edge
?就像有一个t.segment(Edge e)
从Edge
得到Segment_2
,我想要得到相反的结果(Segment_2
到Edge
)。
现在我完全确定这个片段属于Triangulation_2上的边缘,我怎么能得到它?也许有像triangulation.edge(Segment_2)
之类的东西。
请帮忙。
答
如果你一直保持两个顶点处理对应程序段的两个点,你可以使用这个功能:
bool
CGAL::Triangulation_2< Traits, Tds >::
is_edge(Vertex_handle va,
Vertex_handle vb,
Face_handle & fr,
int & i
)
假设v1
和v2
是顶点处理,并t
您的三角对象:
Face_handle fh;
int i;
if(t.is_edge(v1, v2, fh, i)) {
Edge my_edge = Edge(fh, i);
// ... use your Edge
}
This Works,thank you。 – eLRuLL