繁体   English   中英

CGAL-Boost创建无向图

[英]CGAL - Boost create undirected graph

我已经使用Cgal的文档创建了3D体积网格,并且能够成功可视化我的c3t3(三角剖分3中的复杂3)对象。 网格由几个连接的组件组成,我想使用boost查找其数量。

过去处理c2t3(三角剖分3中的cimplex 2)会在的顶点上进行迭代,使用vertex_descriptor配对,然后再次在边缘上进行迭代以找到顶点,并使用add_edge创建了无向图,最后返回了数字的cc

现在,c3t3对象仅提供有关顶点nad单元的迭代器(不包括边-只能隐式找到)。 您能帮我将c3t3对象传递给Boost的图形结构吗?

到目前为止,我做到了:

for (Cell_iterator c_it=c3t3.cells_in_complex_begin(); c_it != c3t3.cells_in_complex_end(); ++c_it)
{

  Vertex_descriptor vd1 = boost::add_vertex(graph);
  Vertex_descriptor vd2 = boost::add_vertex(graph);
  Vertex_descriptor vd3 = boost::add_vertex(graph);
  Vertex_descriptor vd4 = boost::add_vertex(graph);

  C3t3::Vertex_handle v0 = c_it->vertex(0);
  C3t3::Vertex_handle v1 = c_it->vertex(1);
  C3t3::Vertex_handle v2 = c_it->vertex(2);
  C3t3::Vertex_handle v3 = c_it->vertex(3);

  vertex_id_map.insert(std::make_pair(v0, vd1));
  vertex_id_map.insert(std::make_pair(v1, vd2));
  vertex_id_map.insert(std::make_pair(v2, vd3));
  vertex_id_map.insert(std::make_pair(v3, vd4));
}

现在我必须创建边缘,但是我不知道在哪里可以找到对应于我的c3t3对象的正确边缘。

CGAL提供了许多类的“ Boost Graph适配器”(至少用于三角剖分,排列和多面体表面)。 CGAL BGL页面中查看更多详细信息。

本质上,所有DCEL或类似结构都可以看作是两个图形的组合,“主要”表示顶点边缘关系,“双重”表示单元边缘关系; CGAL为这两种都提供了Boost图形适配器。

如果这个现成的图形对您不利,那么您必须回答中心问题:如何在给定单元格的边缘(即“双”图的边缘)或给定边缘上进行迭代顶点(即“原始”图的边缘)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM