added RequireTriangularMesh guard and corresponding exception
This commit is contained in:
parent
4cc8a7c919
commit
b2e97b9134
|
@ -610,6 +610,8 @@ template <class MeshType> void RequireCompactness (MeshType &m) {
|
||||||
if(m.face.size()!=size_t(m.fn)) throw vcg::MissingCompactnessException("Face Vector Contains deleted elements");
|
if(m.face.size()!=size_t(m.fn)) throw vcg::MissingCompactnessException("Face Vector Contains deleted elements");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class MeshType> void RequireTriangularMesh (MeshType &m) { if(typename MeshType::FaceType::HasPolyInfo()) throw vcg::MissingTriangularRequirementException("");}
|
||||||
|
|
||||||
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"); }
|
||||||
template <class MeshType> void RequireFFAdjacency (MeshType &m) { if(!tri::HasFFAdjacency (m)) throw vcg::MissingComponentException("FFAdjacency"); }
|
template <class MeshType> void RequireFFAdjacency (MeshType &m) { if(!tri::HasFFAdjacency (m)) throw vcg::MissingComponentException("FFAdjacency"); }
|
||||||
|
|
|
@ -38,6 +38,7 @@ public:
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class MissingCompactnessException : public std::runtime_error
|
class MissingCompactnessException : public std::runtime_error
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -51,6 +52,21 @@ public:
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MissingTriangularRequirementException : public std::runtime_error
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MissingTriangularRequirementException(const std::string &err):std::runtime_error(err)
|
||||||
|
{
|
||||||
|
std::cout << "Mesh has to be composed by triangle and not polygons -" << err << "- \n";
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual const char *what() const throw ()
|
||||||
|
{
|
||||||
|
static char buf[128]="Mesh has to be composed by triangle and not polygons";
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // EXCEPTION_H
|
#endif // EXCEPTION_H
|
||||||
|
|
Loading…
Reference in New Issue