Moved ComputeNormal and ComputeNormalizedNormal out of the face class (no more a member function!)

This commit is contained in:
Paolo Cignoni 2005-11-21 21:44:47 +00:00
parent 25d8f00263
commit 0d97fa92f5
2 changed files with 19 additions and 7 deletions

View File

@ -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);
}

View File

@ -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 T> 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<typename T::FaceType>(*(static_cast<typename T::FaceType *>(this))); }
void ComputeNormalizedNormal() { _norm = vcg::NormalizedNormal(*this);}
// void ComputeNormal() { _norm = vcg::Normal<typename T::FaceType>(*(static_cast<typename T::FaceType *>(this))); }
// void ComputeNormalizedNormal() { _norm = vcg::NormalizedNormal(*this);}
private:
NormalType _norm;
};
template <class T>
void ComputeNormal(T &f) { f.N() = vcg::Normal<T>(f); }
template <class T>
void ComputeNormalizedNormal(T &f) { f.N() = vcg::NormalizedNormal<T>(f); }
template <class A, class T> class NormalAbs: public T {
public:
typedef A NormalType;