From 01f190a69757accfe027e91808ff6eb8a494acde Mon Sep 17 00:00:00 2001 From: cignoni Date: Thu, 8 May 2008 23:50:44 +0000 Subject: [PATCH] renamed vertex quality smoothing added face normal smoothing FF (and added a VF to the previous face normal smoothing) --- vcg/complex/trimesh/smooth.h | 52 +++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/vcg/complex/trimesh/smooth.h b/vcg/complex/trimesh/smooth.h index bb780f1d..5a8727b6 100644 --- a/vcg/complex/trimesh/smooth.h +++ b/vcg/complex/trimesh/smooth.h @@ -23,6 +23,9 @@ /**************************************************************************** History $Log: not supported by cvs2svn $ +Revision 1.18 2008/05/02 09:43:25 cignoni +Added color smoothing, scale dependent laplacian changed a SD_old into SD fujumori, improved comments. + Revision 1.17 2008/04/18 17:48:29 cignoni added facenormal smoothing @@ -497,7 +500,7 @@ public: }; template -void LaplacianSmoothQuality(MESH_TYPE &m, int step,bool SmoothSelected=false) +void VertexQualitySmooth(MESH_TYPE &m, int step=1, bool SmoothSelected=false) { SimpleTempData > TD(m.vert); QualitySmoothInfo lpz; @@ -772,7 +775,6 @@ void NormalSmoothSB(MESH_TYPE &m, } } - // Replace the normal of the face with the average of normals of the vertex adijacent faces. // Normals are weighted with face area. // It assumes that: @@ -780,7 +782,7 @@ void NormalSmoothSB(MESH_TYPE &m, // VF adjacency is present. template -void FaceNormalSmooth(MESH_TYPE &m) +void FaceNormalSmoothVF(MESH_TYPE &m) { SimpleTempData > TDF(m.face); @@ -835,6 +837,50 @@ void FaceNormalSmooth(MESH_TYPE &m) TDF.Stop(); } +// Replace the normal of the face with the average of normals of the face adijacent faces. +// Normals are weighted with face area. +// It assumes that: +// Normals are normalized: +// FF adjacency is present. + +template +void FaceNormalSmoothFF(MESH_TYPE &m, int step=1, bool SmoothSelected=false ) +{ + SimpleTempData > TDF(m.face); + + PDFaceInfo lpzf; + lpzf.m=typename MESH_TYPE::CoordType(0,0,0); + + assert(tri::HasFFAdjacency(m)); + TDF.Start(lpzf); + int i; + + typedef typename MESH_TYPE::CoordType CoordType; +// typedef typename MESH_TYPE::ScalarType ScalarType; +// typedef typename vcg::face::VFIterator VFLocalIterator; + typename MESH_TYPE::FaceIterator fi; + + tri::UpdateNormals::AreaNormalizeFace(m); + for(int i=0;iN(); + + TDF[*fi].m=normalSum; + } + for(fi=m.face.begin();fi!=m.face.end();++fi) + if(!SmoothSelected || (*fi).IsS()) + (*fi).N()=TDF[*fi].m; + + tri::UpdateNormals::NormalizeFace(m); + } + TDF.Stop(); +} + /***************************************************************************/ // Paso Doble Step 1 compute the smoothed normals