From 3fce89c4c9f7a6c7d4c214712420141a6da01466 Mon Sep 17 00:00:00 2001 From: cignoni Date: Fri, 17 Jun 2005 00:46:09 +0000 Subject: [PATCH] Added a PerVertexNormalizedPerFace (vertex are face/area weighted AND normalized) --- vcg/complex/trimesh/update/normal.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/vcg/complex/trimesh/update/normal.h b/vcg/complex/trimesh/update/normal.h index 5e4ea3ec..82e1176c 100644 --- a/vcg/complex/trimesh/update/normal.h +++ b/vcg/complex/trimesh/update/normal.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.5 2005/04/01 13:04:55 fiorin +Minor changes + Revision 1.4 2004/09/09 14:35:14 ponchio Typename changes for linux @@ -127,6 +130,16 @@ static void PerVertexPerFace(ComputeMeshType &m) } } +/// Calculates both vertex and face normals. +/// The normal of a vertex v is the weigthed average of the normals of the faces incident on v. +static void PerVertexNormalizedPerFace(ComputeMeshType &m) +{ +PerVertexPerFace(m); + VertexIterator vi; + for(vi=m.vert.begin();vi!=m.vert.end();++vi) + if( !(*vi).IsD() && (*vi).IsRW() ) + (*vi).N().Normalize(); +} static void PerFaceRW(ComputeMeshType &m, bool normalize=false) {