Added a few meshassert exception throwing check functions

This commit is contained in:
Paolo Cignoni 2017-03-13 15:41:16 +01:00
parent 45c1e13800
commit 781c333821
1 changed files with 29 additions and 2 deletions

View File

@ -23,8 +23,6 @@
#ifndef __VCGLIB_MESH_ASSERT #ifndef __VCGLIB_MESH_ASSERT
#define __VCGLIB_MESH_ASSERT #define __VCGLIB_MESH_ASSERT
#include <vcg/complex/complex.h>
namespace vcg { namespace vcg {
namespace tri { namespace tri {
/** /**
@ -70,6 +68,25 @@ public:
} }
} }
static void EEAdjacencyIsInitialized(MeshType &m)
{
for(auto ei=m.edge.begin();ei!=m.edge.end();++ei) if(!ei->IsD())
{
if(ei->EEp(0)==0)
throw vcg::MissingPreconditionException("EE adjacency is not initialized");
}
}
static void EEOneManifold(MeshType &m)
{
EEAdjacencyIsInitialized(m);
for(auto ei=m.edge.begin();ei!=m.edge.end();++ei) if(!ei->IsD())
{
if(! edge::IsEdgeManifold(*ei,0) )
throw vcg::MissingPreconditionException("The edge mesh is not 1-manifold (e.g there are more than 2 edges on a vertex)");
}
}
static void NoUnreferencedVertex(MeshType &m) static void NoUnreferencedVertex(MeshType &m)
{ {
tri::UpdateFlags<MeshType>::VertexClearV(m); tri::UpdateFlags<MeshType>::VertexClearV(m);
@ -110,6 +127,16 @@ public:
throw vcg::MissingPreconditionException("Expecting a mesh composed only by edges (no faces needed or allowed)"); throw vcg::MissingPreconditionException("Expecting a mesh composed only by edges (no faces needed or allowed)");
} }
static void FFTwoManifoldEdge(MeshType & m)
{
for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi) if(!fi->IsD())
{
for(int i=0;i<fi->VN();++i){
if(!face::IsManifold(*fi,i))
throw vcg::MissingPreconditionException("There are non quadrilateral faces");
}
}
}
}; };