在cgal :: surface_mesh中找到某个原始的邻居

Find all neighbours of a certain primitive in a CGAL::Surface_mesh

本文关键字:原始 邻居 surface cgal mesh      更新时间:2023-10-16

我写了一个带有CGAL树加速的小型射线tracer(带有cgal :: surface_mesh网格(。我想找到一个命中的所有邻居。

Ray_intersection hit = tree.first_intersection(rays[y][x]);
if(hit)
{
    const Point& point =  boost::get<Point>(hit->first);
    const Primitive_id& primitive_id = boost::get<Primitive_id>(hit->second);
    //i need the neighbours of the hit primitive
}

我该如何?我找到了此文档,但似乎仅适用于点,而不是原语:

https://doc.cgal.org/latest/spatial_searching/index.html

它搜索其欧几里得距离,而不是连接在一起。

有类似的东西:

std::vector<Primitive_id&> ids = getNeighoursOfPrimive(primitive_id);

就像我说的那样,我正在使用cgal :: surface_mesh网状网格,它们的网格仅是一个网格。

您可以使用vertices_around_face()返回的范围获取面部的所有顶点,然后对于每个顶点,您可以使用halfedges_around_target()返回的范围将每个脸部的半edge事件接收到该顶点(该顶点(或者,您可以使用下一个和相反的组合手工完成。