Moved ComputeNormal and ComputeNormalizedNormal out of the face class (no more a member function!)
This commit is contained in:
parent
25d8f00263
commit
0d97fa92f5
|
@ -24,6 +24,9 @@
|
||||||
History
|
History
|
||||||
|
|
||||||
$Log: not supported by cvs2svn $
|
$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
|
Revision 1.6 2005/06/17 00:46:09 cignoni
|
||||||
Added a PerVertexNormalizedPerFace (vertex are face/area weighted AND normalized)
|
Added a PerVertexNormalizedPerFace (vertex are face/area weighted AND normalized)
|
||||||
|
|
||||||
|
@ -82,7 +85,7 @@ static void PerFace(ComputeMeshType &m)
|
||||||
if( !m.HasPerFaceNormal()) return;
|
if( !m.HasPerFaceNormal()) return;
|
||||||
FaceIterator f;
|
FaceIterator f;
|
||||||
for(f=m.face.begin();f!=m.face.end();++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)
|
for(int j=0; j<3; ++j)
|
||||||
if( !(*f).V(j)->IsR()) cn = false;
|
if( !(*f).V(j)->IsR()) cn = false;
|
||||||
if( cn ) (*f).ComputeNormalizedNormal();
|
if( cn ) face::ComputeNormalizedNormal(*f);
|
||||||
cn = true;
|
cn = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,7 +187,7 @@ static void PerFaceNormalized(ComputeMeshType &m)
|
||||||
if( !m.HasPerFaceNormal()) return;
|
if( !m.HasPerFaceNormal()) return;
|
||||||
FaceIterator f;
|
FaceIterator f;
|
||||||
for(f=m.face.begin();f!=m.face.end();++f)
|
for(f=m.face.begin();f!=m.face.end();++f)
|
||||||
if( !(*f).IsD() ) (*f).ComputeNormalizedNormal();
|
if( !(*f).IsD() ) face::ComputeNormalizedNormal(*f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
History
|
History
|
||||||
|
|
||||||
$Log: not supported by cvs2svn $
|
$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
|
Revision 1.3 2005/11/16 22:58:17 cignoni
|
||||||
Added IncrementalMark and WedgeTexCoord
|
Added IncrementalMark and WedgeTexCoord
|
||||||
Standardized name of flags. It is plural becouse each simplex has many flag.
|
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 HasFaceNormal() { return false; }
|
||||||
static bool HasWedgeNormalOpt() { return false; }
|
static bool HasWedgeNormalOpt() { return false; }
|
||||||
static bool HasFaceNormalOpt() { return false; }
|
static bool HasFaceNormalOpt() { return false; }
|
||||||
void ComputeNormal() {assert(0);}
|
// void ComputeNormal() {assert(0);}
|
||||||
void ComputeNormalizedNormal() {assert(0);}
|
// void ComputeNormalizedNormal() {assert(0);}
|
||||||
|
|
||||||
};
|
};
|
||||||
template <class T> class NormalFromVert: public T {
|
template <class T> class NormalFromVert: public T {
|
||||||
|
@ -136,14 +139,20 @@ public:
|
||||||
NormalType &N() { return _norm; }
|
NormalType &N() { return _norm; }
|
||||||
NormalType &cN() const { return _norm; }
|
NormalType &cN() const { return _norm; }
|
||||||
static bool HasFaceNormal() { return true; }
|
static bool HasFaceNormal() { return true; }
|
||||||
void ComputeNormal() { _norm = vcg::Normal<typename T::FaceType>(*(static_cast<typename T::FaceType *>(this))); }
|
// void ComputeNormal() { _norm = vcg::Normal<typename T::FaceType>(*(static_cast<typename T::FaceType *>(this))); }
|
||||||
void ComputeNormalizedNormal() { _norm = vcg::NormalizedNormal(*this);}
|
// void ComputeNormalizedNormal() { _norm = vcg::NormalizedNormal(*this);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NormalType _norm;
|
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 {
|
template <class A, class T> class NormalAbs: public T {
|
||||||
public:
|
public:
|
||||||
typedef A NormalType;
|
typedef A NormalType;
|
||||||
|
|
Loading…
Reference in New Issue