Added RequireCompactness to the basic exception throwing requirements that you can write at the beginning of an algorithm

This commit is contained in:
Paolo Cignoni 2013-12-20 02:24:22 +00:00
parent 4897d75026
commit 2acd02f102
1 changed files with 263 additions and 258 deletions

View File

@ -600,6 +600,11 @@ bool HasPerMeshAttribute(const MESH_TYPE &m, std::string name){
return (ai!= m.mesh_attr.end() ) ; return (ai!= m.mesh_attr.end() ) ;
} }
template <class MeshType> void RequireCompactness (MeshType &m) {
if(m.vert.size()!=m.vn) throw vcg::MissingCompactnessException("Vertex Vector Contains deleted elements");
if(m.edge.size()!=m.en) throw vcg::MissingCompactnessException("Edge Vector Contains deleted elements");
if(m.face.size()!=m.fn) throw vcg::MissingCompactnessException("Face Vector Contains deleted elements");
}
template <class MeshType> void RequireVFAdjacency (MeshType &m) { if(!tri::HasVFAdjacency (m)) throw vcg::MissingComponentException("VFAdjacency"); } 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"); } template <class MeshType> void RequireVEAdjacency (MeshType &m) { if(!tri::HasVEAdjacency (m)) throw vcg::MissingComponentException("VEAdjacency"); }