我面临一个问题,我希望其他人之前遇到过,因为我无法找到出路!
我在CGAL中有一个常规的三角测量,我希望逐个插入一些带有信息std::pair<myweightpoint, myinfo>
的加权点,并在插入后得到顶点(Vertex_handle
)的句柄!事情是没有这样的功能。它有几个要插入的函数:
Vertex_handle
Regular_triangulation::insert
( const Weighted_point & p ) ;
返回一个Vertex_handle
很酷,但不带加权点WITH INFO,这对我来说非常重要,我对这些顶点做了什么。
std::ptrdiff_t
Regular_triangulation::insert
( WeightedPointWithInfoInputIterator first, WeightedPointWithInfoInputIterator last ) ;
这允许我插入一些带有信息的加权点(这很好)但是没有给我一个插入顶点的句柄。此外,由于我一次只插入一个点,现在我做这样的事情:
v_wpoints.resize(1) ;
v_wpoints[0] = std::make_pair(myweightpoint, myinfo) ;
rt.insert(v_wpoints.begin(), v_wpoints.end()) ;
看起来真的很脏。所以,我的问题是:为什么没有像这样的函数:
Vertex_handle Regular_triangulation::insert( const Weighted_point_with_info & p ) ;
如何在常规三角剖分中插入带有信息的加权点并获取插入顶点的句柄。
非常感谢。
答案 0 :(得分:3)
你能做的是:
Vertex_handle v = rt.insert(wp);
v->info()=the_info;