使用vcglib示例时断言失败 [英] Assertion Failure when using vcglib examples

查看:70
本文介绍了使用vcglib示例时断言失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用vcglib重建基于点云的曲面.但是每当我运行程序时(也提供了提供的示例,例如/vcglib/apps/sample/trimesh_allocate),我都会得到以下输出:

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:intvcg :: vertex :: EmptyCore :: cFlags()const [with TT = MyUsedTypes]:断言"0"失败.

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

任何想法如何解决这个问题?我在Ubuntu 12.04上使用QT-Creator 2.4.1.我确实得到任何编译器或链接器错误.

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.

Mirco,请多多关照

Thanks a lot in advance, Mirco

推荐答案

为了消除这种错误,通常需要更改顶点,边,面,网格定义的定义.我可以使用以下示例来工作:

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

我相信 vcg :: xx :: BitFlags 是您需要为顶点和面添加的对象.从关于cFlags()的错误中可以看出这一点.

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().

此外,在 trimesh_allocate.cpp 示例中,您需要注释掉以下部分:

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

这篇关于使用vcglib示例时断言失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆