我正在研究一种网格生成算法,在这种算法中,我需要在一个称为分段线性复形( PLC )和Delaunay四面体化(DT)( Delaunay三角剖分扩展到3D空间)的结构中维护一个顶点、段和三角形的集合。
根据算法,我经常需要在DT中得到一个顶点的句柄,而在PLC中,我有指向相同顶点(都有相同的x、y、z坐标)的指针。以下是DT的初始化和PLC的结构:
PLC结构:
class vertex
{
float x;
float y;
float z;
std::list<vertex*> neighbor_vertices;
};
class segment
{
vertex* endpoints[2];
};
class facet
{
vertex*vertices[3];
};
class PLC
{
std::list<vertex> vertex_list;
std::list<segment> segment_list;
std::list<facet> facet_list;
};DT的初始化:
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_data_structure_3<> tds;
typedef CGAL::Delaunay_triangulation_3<K,tds> Delaunay;
Delaunay DT;
PLC input_constraints;
// Initializing Delaunay tetrahedralization structure
DT.insert(input_constraints.vertex_list.begin(),input_constraints.vertex_list.end());我的问题是:
对于在vertex_handle中获取DT中对应于input_constraints中的vertex的问题,是否有比以下方法更有效(需要更少的操作)的方法:
DT的所有顶点,并将它们的x、y、z组件与vertex的x、y、z组件在input_constraints中进行比较。vertex_handle of DT和vertex在input_constraints中的映射。这个问题可能会成为瓶颈,因为我需要频繁地执行这个操作,而且DT和input_constraints都在算法的不同阶段不断更新。
发布于 2014-05-15 07:01:41
理想情况下,您应该尽量避免丢失信息,即维护一个list<Vertex_handle>而不是一个list<Vertex *>。
不过,有一种方法可以满足你的需要。下面这样的内容可能会奏效:
Vertex * vp; // your vertex pointer
Vertex_handle v = Delaunay::Triangulation_data_structure::Vertex_range::s_iterator_to(*vp);https://stackoverflow.com/questions/23671091
复制相似问题