【问题标题】:Number of detected self intersection in vcglib does not coincide with the Meshlab numbervcglib 中检测到的自相交数与 Meshlab 数不一致
【发布时间】:2018-11-20 16:27:50
【问题描述】:

当我执行我的程序时

C:\Users\me\Documents\projectCGALII\build\Debug>test.exe pig.obj

我得到 6 个交叉点,当它在 Meshlab 中检查时显示 4 个交叉点。这是我的程序:

void  countSelfIntersection(const char* filename)
{
    OpenMesh(filename, pm);
    vcg::tri::UpdateTopology<PMesh>::FaceFace(pm);
    std::vector<PMesh::FaceType *> intersections;
    bool SelfIntersect = tri::Clean<PMesh>::SelfIntersections(pm, intersections);

    std::cout << "Count Intersection: " << intersections.size() << std::endl;

    for (std::vector<PMesh::FaceType *>::iterator it = intersections.begin(); it != intersections.end(); it++)
    {
        PMesh::FaceType *face = *it;
        for (int i = 0; i < 3; ++i)
        {
            std::cout << "Vertex(" <<i<<")"<< std::dec <<(int) face->cV0(i) << " " << std::dec << (int)face->cV1(i) << " " << std::dec << (int)face->cV2(i) << std::endl;
        }

        std::cout<<std::endl;


    }

}


int main(int argc, char* argv[])
{
    nonManinfoldEdge(argv[1]);
    return 0;
}

此处附上 pig.obj 文件:

https://drive.google.com/open?id=1fEqZft_OhHxTsAvio58_TWOtvrYbGCOA

结果中的面孔是否重复?如何像 meshlab 一样得到正确的结果?打印每个面或顶点的属性以检查是否存在一些重复面的更好方法是什么?如果存在重复的人脸,如何去除?

【问题讨论】:

  • 提升是如何参与的?
  • vcg 社区只有 17 个成员,通常致力于计算几何的人都尝试过 vcg
  • 是的,你知道的。我已经很长时间地努力研究了这个问题,试图理解为什么我无法对代码示例做出正面或反面。最好按预期使用标签。

标签: computational-geometry meshlab vcg


【解决方案1】:

已解决!

int countSelfIntersections(PMesh &pm)
{
    vcg::tri::UpdateTopology<PMesh>::FaceFace(pm);
    std::vector<PFace *> intersections;
    bool SelfIntersect = tri::Clean<PMesh>::SelfIntersections(pm, intersections);
    tri::UpdateSelection<PMesh>::FaceClear(pm);

    for (std::vector<PFace*>::iterator it = intersections.begin(); it != intersections.end(); it++)
    {
        PFace *face = *it;
        face->SetS();
    }

    PMesh::FaceIterator f;
    f = pm.face.begin();
    std::vector<PFace*> sf;
    for (; f != pm.face.end(); ++f)
    {
        if (f->IsS())
        {
            sf.push_back(&(*f));
        }
    }

    return sf.size();
}

【讨论】:

    猜你喜欢
    • 2018-11-23
    • 1970-01-01
    • 1970-01-01
    • 2018-01-13
    • 2015-12-17
    • 2017-11-10
    • 2022-01-13
    • 2020-04-27
    • 1970-01-01
    相关资源
    最近更新 更多