Commit ecb76539 authored by Jan Möbius's avatar Jan Möbius

Check for invalid HE handle

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@718 fdac6126-5c0c-442c-9429-916003d36597
parent e5ee41bc
......@@ -141,6 +141,11 @@ size_t McDecimaterT<Mesh>::decimate(size_t _n_collapses) {
tmpHandle = typename Mesh::HalfedgeHandle( (double(rand()) / double(RAND_MAX) ) * double(mesh_.n_halfedges()-1) );
#endif
// Only take valid Handles!
if ( tmpHandle.idx() >=mesh_.n_halfedges() ) {
continue;
}
// if it is not deleted, we analyse it
if ( ! mesh_.status(tmpHandle).deleted() ) {
......@@ -263,6 +268,11 @@ size_t McDecimaterT<Mesh>::decimate_to_faces(size_t _nv, size_t _nf) {
tmpHandle = typename Mesh::HalfedgeHandle( ( double(rand()) / double(RAND_MAX) ) * double(mesh_.n_halfedges() - 1));
#endif
// Only take valid Handles!
if ( tmpHandle.idx() >=mesh_.n_halfedges() ) {
continue;
}
// if it is not deleted, we analyse it
if (!mesh_.status(tmpHandle).deleted()) {
......@@ -401,6 +411,11 @@ size_t McDecimaterT<Mesh>::decimate_constraints_only(float _factor) {
tmpHandle = typename Mesh::HalfedgeHandle(int(rand() * randomNormalizer ) );
#endif
// Only take valid Handles!
if ( tmpHandle.idx() >=mesh_.n_halfedges() ) {
continue;
}
// if it is not deleted, we analyze it
if (!mesh_.status(mesh_.edge_handle(tmpHandle)).deleted()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment