Added RequirePolygonalMesh invariant to the list of the exception throwing utility

This commit is contained in:
Paolo Cignoni 2014-05-20 22:28:30 +00:00
parent d2131fd436
commit 1baf0f3727
2 changed files with 16 additions and 0 deletions

View File

@ -611,6 +611,7 @@ template <class MeshType> void RequireCompactness (MeshType &m) {
}
template <class MeshType> void RequireTriangularMesh (MeshType &m ) { if( tri::HasPolyInfo( m ) ) throw vcg::MissingTriangularRequirementException("");}
template <class MeshType> void RequirePolygonalMesh (MeshType &m ) { if(!tri::HasPolyInfo( m ) ) throw vcg::MissingPolygonalRequirementException("");}
template <class MeshType> void RequireVFAdjacency (MeshType &m) { if(!tri::HasVFAdjacency (m)) throw vcg::MissingComponentException("VFAdjacency"); }
template <class MeshType> void RequireVEAdjacency (MeshType &m) { if(!tri::HasVEAdjacency (m)) throw vcg::MissingComponentException("VEAdjacency"); }

View File

@ -67,6 +67,21 @@ public:
return buf;
}
};
class MissingPolygonalRequirementException : public std::runtime_error
{
public:
MissingPolygonalRequirementException(const std::string &err):std::runtime_error(err)
{
std::cout << "Mesh has to be composed by polygonal faces (not plain triangles) -" << err << "- \n";
}
virtual const char *what() const throw ()
{
static char buf[128]="Mesh has to be composed by polygonal faces (not plain triangles) ";
return buf;
}
};
}
#endif // EXCEPTION_H