1

When I execute my program

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

I get 6 intersections and when it is checked in Meshlab it say 4 intersection. This is my program:

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;
}

Attached pig.obj file here:

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

is the faces repeated in the result? How to get the right result as the meshlab does? Which is the better way to print the properties of every face or vertices in order to check that exist some repeated faces? How to remove the repeated faces if they exists?

Reblochon Masque
  • 35,405
  • 10
  • 55
  • 80
sergio campo
  • 190
  • 2
  • 13
  • How is boost involved? – sehe Jun 11 '18 at 14:39
  • Well the community of vcg it's only 17 members and normally the people who is dedicated to computational geometry has tried with vcg – sergio campo Jun 11 '18 at 14:54
  • Yeah, well you know. I've looked at this question long and hard trying to understand why I couldn't make heads or tails of the code sample. Best to use the tags as intended. – sehe Jun 11 '18 at 14:57

1 Answers1

0

Resolved!

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();
}
sergio campo
  • 190
  • 2
  • 13