- readd unittests

- fix McDecimater random crash

refs #1007

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@666 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Matthias Möller
2012-09-10 13:59:42 +00:00
parent 94ec0ac3f4
commit 0e15808378
4 changed files with 98 additions and 2 deletions

View File

@@ -113,7 +113,7 @@ size_t McDecimaterT<Mesh>::decimate(size_t _n_collapses) {
for ( unsigned int i = 0; i < randomSamples_; ++i) {
// Random halfedge handle
typename Mesh::HalfedgeHandle tmpHandle = typename Mesh::HalfedgeHandle(double(rand()) / RAND_MAX * mesh_.n_halfedges() );
typename Mesh::HalfedgeHandle tmpHandle = typename Mesh::HalfedgeHandle((static_cast<double>(rand()) / RAND_MAX) * (mesh_.n_halfedges()-1) );
// if it is not deleted, we analyse it
if ( ! mesh_.status(tmpHandle).deleted() ) {
@@ -191,7 +191,7 @@ size_t McDecimaterT<Mesh>::decimate_to_faces(size_t _nv, size_t _nf) {
for ( unsigned int i = 0; i < randomSamples_; ++i) {
// Random halfedge handle
typename Mesh::HalfedgeHandle tmpHandle = typename Mesh::HalfedgeHandle(double(rand()) / RAND_MAX * mesh_.n_halfedges() );
typename Mesh::HalfedgeHandle tmpHandle = typename Mesh::HalfedgeHandle((static_cast<double>(rand()) / RAND_MAX) * (mesh_.n_halfedges()-1) );
// if it is not deleted, we analyse it
if ( ! mesh_.status(tmpHandle).deleted() ) {