diff --git a/vcg/complex/base.h b/vcg/complex/base.h index eb9e6e4b..1c4700de 100644 --- a/vcg/complex/base.h +++ b/vcg/complex/base.h @@ -611,6 +611,7 @@ template void RequireCompactness (MeshType &m) { } template void RequireTriangularMesh (MeshType &m ) { if( tri::HasPolyInfo( m ) ) throw vcg::MissingTriangularRequirementException("");} +template void RequirePolygonalMesh (MeshType &m ) { if(!tri::HasPolyInfo( m ) ) throw vcg::MissingPolygonalRequirementException("");} template void RequireVFAdjacency (MeshType &m) { if(!tri::HasVFAdjacency (m)) throw vcg::MissingComponentException("VFAdjacency"); } template void RequireVEAdjacency (MeshType &m) { if(!tri::HasVEAdjacency (m)) throw vcg::MissingComponentException("VEAdjacency"); } diff --git a/vcg/complex/exception.h b/vcg/complex/exception.h index bebd6c61..7dfa3e13 100644 --- a/vcg/complex/exception.h +++ b/vcg/complex/exception.h @@ -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