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

CGAL Clip方法中before_subface_creations回调重复触发问题咨询

关于CGAL Clip操作中before_subface_creations回调重复触发的问题

我正在使用CGAL的Clip方法生成相交网格,同时尝试通过void before_subface_creations(face_descriptor f_old, Mesh&)回调获取被拆分的面。官方提供的示例代码如下:

void before_subface_creations(face_descriptor fd)
{
    std::cout << "split : " << fd << " into:" << std::endl;
    Container::iterator it = container.find(fd);
    qfd = it->second;
    container.erase(it);
}

但测试时发现,同一个拥有相同idx_的face_descriptor会两次进入该回调。我对此感到困惑:face_descriptor理应是唯一标识,而且触发回调后已经从容器中删除了对应条目,为什么还会重复触发?

另外我想了解Clip(属于corefinement操作)的内部逻辑,为什么单个三角面会被拆分两次?同时想请教,是否应该将官方示例代码更新为以下带存在性判断的版本:

void before_subface_creations(face_descriptor f_old, Mesh&) 
{
    std::cout << "split : " << f_old << " into:" << std::endl;
    Container::iterator it = container.find(f_old);
    if (it == container.end()) 
    {
        std::cout << "not found";
    }
    else 
    {
        qfd = it->second;
        container.erase(it);
    }
}

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.22 11:49:55