Assertion Failure when using vcglib examples

非 Y 不嫁゛ 提交于 2019-12-24 13:34:13

问题


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


回答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);
   }
}*/


来源:https://stackoverflow.com/questions/13586957/assertion-failure-when-using-vcglib-examples

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!