You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何检测周期性c3t3的面是否位于边界?is_infinite返回false求助

提取CGAL周期性C3T3的边界面(含周期边界)的正确方法

你当前用is_infinite检测周期边界的思路不对——这个方法只适用于非周期性三角剖分中判断“无限远面”,而周期性剖分里不存在这类面,所有边界面(包括周期边界)的判断依据是该面仅被一个四面体相邻。

修改代码如下,用mirror_facet获取对面单元格,判断是否为空来识别边界面:

for(Cell_iterator cit = c3t3P.cells_begin(); cit != c3t3P.cells_end(); ++cit) {
    for(int l = 0; l < 4; ++l) {
        const int id = V[cit->vertex(l)];
        CGAL_assertion(1 <= id && id <= medit_number_of_vertices);

        t[l] = id - 1;
        // 获取当前面的对面单元格
        Cell_handle opposite_cell = tr.mirror_facet(cit, l);
        // 对面单元格为空,说明此面是边界面(含周期边界)
        if (opposite_cell == nullptr) {
            std::cout << "找到边界面!" << std::endl;
            // 可在此处记录该面的顶点信息,示例:
            std::vector<int> facet_vertices;
            for (int i = 0; i < 4; ++i) {
                if (i != l) {
                    facet_vertices.push_back(V[cit->vertex(i)] - 1);
                }
            }
            // 处理facet_vertices,比如加入边界点列表
            // Facet_boundary.insert(Facet_boundary.end(), facet_vertices.begin(), facet_vertices.end());
        }
    }
}

补充说明

  • 周期性剖分的周期边界面,本质是当前原胞中没有对应的相邻四面体(对面的四面体属于周期复制的原胞,不在当前迭代的单元格集合里),因此mirror_facet会返回nullptr。
  • 若你使用的是带约束的周期性三角剖分,c3t3P.is_facet_on_surface(cit, l)只能检测被标记为约束的面,无法覆盖所有周期边界,因此优先用上述方法。

内容的提问来源于stack exchange,提问作者Fer

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.14 02:41:03