1

I want to use vcglib for reconstructing a surface based on a point cloud. But whenever I run my program (also with the provided examples, e.g. /vcglib/apps/sample/trimesh_allocate) I get the following output:

trimesh_allocate: ../../../vcg/simplex/vertex/component.h:50: int vcg::vertex::EmptyCore::cFlags() const [with TT = MyUsedTypes]: Assertion `0' failed.

Any ideas how to solve this? I am using QT-Creator 2.4.1 on Ubuntu 12.04. I do net get any compiler or linker errors.

Thanks a lot in advance, Mirco

Mirco
  • 107
  • 2
  • 11

1 Answers1

1

In order to get rid of such an error you typically need to change the definition of the vertex, edge, face, mesh definition. I could get this example to work using:

class MyFace;
class MyVertex;

struct MyUsedTypes : public vcg::UsedTypes< vcg::Use<MyVertex>::AsVertexType,
vcg::Use<MyFace>::AsFaceType>{};

class MyVertex  : public vcg::Vertex< MyUsedTypes, vcg::vertex::Coord3f,  vcg::vertex::Normal3f, vcg::vertex::VFAdj, vcg::vertex::BitFlags, vcg::vertex::Mark>{};
class MyFace    : public vcg::Face  < MyUsedTypes, vcg::face::VertexRef,   vcg::face::Normal3f, vcg::face::FFAdj, vcg::face::Mark, vcg::face::VFAdj,  vcg::face::BitFlags > {};
class MyMesh    : public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> > {};

I believe the vcg::xx::BitFlags are the ones that you need to add for both vertex and face. This can be seen from the error you have that is about cFlags().

Furthermore in the trimesh_allocate.cpp example, you need to comment out the following section:

// WRONG WAY of iterating: FN() != m.face.size() if there are deleted elements
/*for(int i=0;i<m.FN();++i)
{
 if(!fi->IsD())
   {
    MyMesh::CoordType b = vcg::Barycenter(*fi);
   }
}*/
Deepfreeze
  • 1,755
  • 1
  • 13
  • 18
  • 1
    I tried your solution. But It doesn't work for me... but other simple examples works for me. Do you know how to Insert Vertices in the mesh? I tired as explained in the example. But when i try to Insert `MyMesh::VertexPointer ivp[400000];` like 400k vertices. the program crashes with no error. Please help me Thank you. – Teh Sunn Liu Jan 06 '17 at 08:24
  • If you make a new question and place the link here, I will answer it. – Deepfreeze Jan 10 '17 at 10:59
  • Hi. Thank you for replying. I've posted the question [here](http://stackoverflow.com/questions/41628620/program-crashes-while-creating-vertexpointer-of-more-then-400k-vertex-in-vcg) – Teh Sunn Liu Jan 13 '17 at 06:29