Menu

#58 assert in

v1.0_(example)
open
nobody
None
1
2016-03-15
2016-03-15
Anonymous
No

When I try to process an stl model using vcg, my program crashes with this message:

Assertion failed!

Program: .....\target\app\debug\app.exe
File: ..\..\lib\vcglib/vcg/complex/algorithms/clean.h, Line 1276

Expression: m.face.back().FFp(0)

In my program I firstly clean mesh using these functions

tri::Clean<MeshType>::RemoveDuplicateVertex(mesh);
tri::Clean<MeshType>::RemoveDegenerateFace(mesh);
tri::Clean<MeshType>::RemoveFaceOutOfRangeArea<false>(mesh,0);
tri::Clean<MeshType>::RemoveUnreferencedVertex(mesh);

update topology with

tri::UpdateTopology<MeshType>::FaceFace(mesh);
tri::UpdateTopology<MeshType>::VertexFace(mesh);

and only then I check orientation of the mesh

tri::Clean<MeshType>::OrientCoherentlyMesh(mesh, is_oriented, is_orientable);

I have noticed that after cleaning some faces are marked as deleted including the last element of m.face vector. So when

static void FillEdgeVector(MeshType &m, std::vector<PEdge> &edgeVec, bool includeFauxEdge=true)
{
  edgeVec.reserve(m.fn*3);
  for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi)
    if( ! (*fi).IsD() )
      for(int j=0;j<(*fi).VN();++j)
        if(includeFauxEdge || !(*fi).IsF(j))
          edgeVec.push_back(PEdge(&*fi,j));
}

function is executed inside tri::UpdateTopology<MeshType>::FaceFace(mesh);, the face-to-face topology is not built for this last element. I suppose this leads the assertion to fail.

I'm not sure either I am supposed to use the functions in the other order (which then?) or the assertion is not correct.

Thanks in advance.

Discussion

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB