CGAL:修改从定位调用中获取的扩展 DCEL

CGAL: Modify an extended DCEL fetched from a locate call

我有一个 Arrangement_2 class,使用自定义 Arr_face_extended_dcel 实例化以将一些数据映射到每个单元格。

我想找到一些带有 locate 调用的单元格并更改它们的关联数据,但不幸的是 locate returns 是某些 Face_const_handle 的迭代器,所以我不能调用 set_data(...) 因为那会破坏 constness.

所以,我的问题是:有没有一种方法可以有效地更改映射到用 locate 找到的人脸的数据,而无需求助于讨厌的 const_casts?

您必须使用 Arrangement_2 模板 class 的重载成员模板函数 non_const_handle()。有3个版本,分别接受Vertex_const_handleHalfedge_const_handleFace_const_handle;见manual

BW,const_cast<> 不行。因为,例如,Vertex_const_handleVertex_handle 只是不同的类型。