在delaunay图上应用Kruskal算法后,我在读取边时有一个奇怪的行为。在显示结果边时,有时某些边的一个点可能是一个没有添加到图形点中的点(总是(0,0))。有人知道这是从哪里来的吗?
for (i = 0; i < Max; i++)
{
vertices.push_back(m_boostVector(data[i].x, data.y));
}
dt.insert(vertices.begin(), vertices.end());
for (index = 0, boost::tie(vit, ve) = boost::vertices(ft); vit != ve; vit++, index++)
{
vertex_id_map[*vit] = index;
}
boost::kruskal_minimum_spanning_tree(dt, std::back_inserter(mst), vertex_index_map(vertex_index_pmap));
for (std::list<edge_descriptor>::iterator it = mst.begin(); it != mst.end(); it++)
{
Delaunay::Vertex_handle sv = boost::source(*it, ft);
Delaunay::Vertex_handle tv = boost::target(*it, ft);
}谢谢
发布于 2017-08-04 15:12:23
如果你没有过滤无限的边,那么你最终可能会访问无限的顶点。请参阅下面的section,其中包含一个演示如何执行此操作的示例。
https://stackoverflow.com/questions/45494485
复制相似问题