From c2cd4dfccb558639f7aa34b5697e425ccac9acb6 Mon Sep 17 00:00:00 2001 From: nico Date: Mon, 3 Apr 2017 11:00:35 +0200 Subject: [PATCH] corrected one Bug for the usage of a threshold in VertexSaturate function --- vcg/complex/algorithms/update/quality.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vcg/complex/algorithms/update/quality.h b/vcg/complex/algorithms/update/quality.h index e41c66db..b460102d 100644 --- a/vcg/complex/algorithms/update/quality.h +++ b/vcg/complex/algorithms/update/quality.h @@ -436,7 +436,8 @@ static void VertexSaturate(MeshType &m, ScalarType gradientThr=1.0) if(vc->Q() > qi) // first case: the center of the star has to be lowered (and re-inserted in the queue). { //printf("Reinserting center %i \n",vc - &*m.vert.begin()); - vc->Q() = qi+distGeom-(ScalarType)0.00001; + ScalarType delta=std::min(0.00001,distGeom/2); + vc->Q() = qi+distGeom-delta; assert( distGeom > fabs(qi - vc->Q())); st.push(vc); break; @@ -446,7 +447,8 @@ static void VertexSaturate(MeshType &m, ScalarType gradientThr=1.0) // second case: you have to lower qi, the vertex under examination. assert( distGeom < fabs(qi - vc->Q())); assert(vc->Q() < qi); - float newQi = vc->Q() + distGeom -(ScalarType)0.00001; + ScalarType delta=std::min(0.00001,distGeom/2); + float newQi = vc->Q() + distGeom -delta; assert(newQi <= qi); assert(vc->Q() < newQi); assert( distGeom > fabs(newQi - vc->Q()) );