From 2d0e455712c27dbb6d4131ac048c804e60349c25 Mon Sep 17 00:00:00 2001 From: Marco Callieri Date: Mon, 4 Jun 2018 14:15:55 +0200 Subject: [PATCH] added "only to selection" for depth smoothing --- vcg/complex/algorithms/smooth.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/vcg/complex/algorithms/smooth.h b/vcg/complex/algorithms/smooth.h index e0dbf468..5c1fd691 100644 --- a/vcg/complex/algorithms/smooth.h +++ b/vcg/complex/algorithms/smooth.h @@ -912,7 +912,7 @@ So if static void VertexCoordViewDepth(MeshType &m, const CoordType &viewpoint, const ScalarType alpha, - int step, bool SmoothBorder = false) + int step, bool SmoothSelected, bool SmoothBorder = false) { LaplacianInfo lpz; lpz.sum = CoordType(0, 0, 0); @@ -961,13 +961,14 @@ So if for (vi = m.vert.begin(); vi != m.vert.end(); ++vi) if (!(*vi).IsD() && TD[*vi].cnt > 0) - { - CoordType np = TD[*vi].sum / TD[*vi].cnt; - CoordType d = (*vi).cP() - viewpoint; - d.Normalize(); - ScalarType s = d.dot(np - (*vi).cP()); - (*vi).P() += d * (s * alpha); - } + if (!SmoothSelected || (*vi).IsS()) + { + CoordType np = TD[*vi].sum / TD[*vi].cnt; + CoordType d = (*vi).cP() - viewpoint; + d.Normalize(); + ScalarType s = d.dot(np - (*vi).cP()); + (*vi).P() += d * (s * alpha); + } } }