From 50165d7b0388f8d47cc273516d0e48d4b19a69dd Mon Sep 17 00:00:00 2001 From: alemuntoni Date: Wed, 18 Dec 2019 15:47:12 +0100 Subject: [PATCH] solved bug non-referenced vertices in hc laplacian smoothing --- vcg/complex/algorithms/smooth.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vcg/complex/algorithms/smooth.h b/vcg/complex/algorithms/smooth.h index 9eb4ced0..d2e4dbdf 100644 --- a/vcg/complex/algorithms/smooth.h +++ b/vcg/complex/algorithms/smooth.h @@ -604,9 +604,11 @@ So if for (vi = m.vert.begin(); vi != m.vert.end(); ++vi) { - TD[*vi].dif /= (float)TD[*vi].cnt; - if (!SmoothSelected || (*vi).IsS()) - (*vi).P() = TD[*vi].sum - (TD[*vi].sum - (*vi).P()) * beta + (TD[*vi].dif) * (1.f - beta); + if (TD[*vi].cnt > 0){ + TD[*vi].dif /= (float)TD[*vi].cnt; + if (!SmoothSelected || (*vi).IsS()) + (*vi).P() = TD[*vi].sum - (TD[*vi].sum - (*vi).P()) * beta + (TD[*vi].dif) * (1.f - beta); + } } } // end for step };