Insertion of weighted point with info in CGAL regular triangulation

巧了我就是萌 提交于 2020-01-01 19:37:13

问题


I'm facing a problem that I hope some others have faced before because I can't find a way out !

I have a regular triangulation in CGAL in which I wish to insert some weighted points with info std::pair<myweightpoint, myinfo> one by one and to get the handle to the vertex (Vertex_handle) once it is inserted ! The thing is that there is no such function. It exists several functions to insert :

  • Vertex_handleRegular_triangulation::insert( const Weighted_point & p ) ;

That returns a Vertex_handle which is cool but does not take weighted points WITH INFO which is very important for me and what I do with those vertices.

  • std::ptrdiff_tRegular_triangulation::insert( WeightedPointWithInfoInputIterator first, WeightedPointWithInfoInputIterator last ) ;

Which allows me to insert some weighted points with info (which is good) but doesn't gives me a handle to the inserted vertex. Moreover, since I am inserting points one at a time, for now I'm doing things like this :

v_wpoints.resize(1) ;
v_wpoints[0] = std::make_pair(myweightpoint, myinfo) ;
rt.insert(v_wpoints.begin(), v_wpoints.end()) ;

which seems really dirty. So, my questions are : why isn't there a function like that :

Vertex_handle Regular_triangulation::insert( const Weighted_point_with_info & p ) ;

and how can I do to insert a weighted point with info in the regular triangulation and get the handle to the vertex inserted.

Thanks a lot.


回答1:


What you can do is:

Vertex_handle v = rt.insert(wp);
v->info()=the_info;


来源:https://stackoverflow.com/questions/29748559/insertion-of-weighted-point-with-info-in-cgal-regular-triangulation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!