diff --git a/vcg/complex/trimesh/update/normal.h b/vcg/complex/trimesh/update/normal.h index 8f33c999..ea635461 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.7 2005/10/13 08:38:00 cignoni +removed the access to the face member function normal and substituted with vcg::normal(*f); + Revision 1.6 2005/06/17 00:46:09 cignoni Added a PerVertexNormalizedPerFace (vertex are face/area weighted AND normalized) @@ -82,7 +85,7 @@ static void PerFace(ComputeMeshType &m) if( !m.HasPerFaceNormal()) return; FaceIterator f; for(f=m.face.begin();f!=m.face.end();++f) - if( !(*f).IsD() ) (*f).ComputeNormal(); + if( !(*f).IsD() ) ComputeNormal(*f); } @@ -159,7 +162,7 @@ static void PerFaceRW(ComputeMeshType &m, bool normalize=false) { for(int j=0; j<3; ++j) if( !(*f).V(j)->IsR()) cn = false; - if( cn ) (*f).ComputeNormalizedNormal(); + if( cn ) face::ComputeNormalizedNormal(*f); cn = true; } } @@ -184,7 +187,7 @@ static void PerFaceNormalized(ComputeMeshType &m) if( !m.HasPerFaceNormal()) return; FaceIterator f; for(f=m.face.begin();f!=m.face.end();++f) - if( !(*f).IsD() ) (*f).ComputeNormalizedNormal(); + if( !(*f).IsD() ) face::ComputeNormalizedNormal(*f); } diff --git a/vcg/simplex/faceplus/component.h b/vcg/simplex/faceplus/component.h index f738f0db..005e9833 100644 --- a/vcg/simplex/faceplus/component.h +++ b/vcg/simplex/faceplus/component.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.4 2005/11/18 15:44:49 cignoni +Access to constant normal changed from by val to by reference + Revision 1.3 2005/11/16 22:58:17 cignoni Added IncrementalMark and WedgeTexCoord Standardized name of flags. It is plural becouse each simplex has many flag. @@ -126,8 +129,8 @@ public: static bool HasFaceNormal() { return false; } static bool HasWedgeNormalOpt() { return false; } static bool HasFaceNormalOpt() { return false; } - void ComputeNormal() {assert(0);} - void ComputeNormalizedNormal() {assert(0);} +// void ComputeNormal() {assert(0);} +// void ComputeNormalizedNormal() {assert(0);} }; template class NormalFromVert: public T { @@ -136,14 +139,20 @@ public: NormalType &N() { return _norm; } NormalType &cN() const { return _norm; } static bool HasFaceNormal() { return true; } - void ComputeNormal() { _norm = vcg::Normal(*(static_cast(this))); } - void ComputeNormalizedNormal() { _norm = vcg::NormalizedNormal(*this);} +// void ComputeNormal() { _norm = vcg::Normal(*(static_cast(this))); } +// void ComputeNormalizedNormal() { _norm = vcg::NormalizedNormal(*this);} private: NormalType _norm; }; +template +void ComputeNormal(T &f) { f.N() = vcg::Normal(f); } + +template +void ComputeNormalizedNormal(T &f) { f.N() = vcg::NormalizedNormal(f); } + template class NormalAbs: public T { public: typedef A NormalType;