Improved robustness of FF adj from texture coords adjacency.

Now faces with degenerated tex coords are more correctly managed.
This commit is contained in:
Paolo Cignoni 2008-09-15 10:08:41 +00:00
parent 4971b69b13
commit 7473170272
1 changed files with 9 additions and 5 deletions

View File

@ -323,15 +323,19 @@ static void FaceFaceFromTexCoord(MeshType &m)
for(pf=m.face.begin();pf!=m.face.end();++pf) // Lo riempio con i dati delle facce for(pf=m.face.begin();pf!=m.face.end();++pf) // Lo riempio con i dati delle facce
if( ! (*pf).IsD() ) if( ! (*pf).IsD() )
for(int j=0;j<3;++j) for(int j=0;j<3;++j)
{
if( (*pf).WT(j) != (*pf).WT((j+1)%3) )
{ {
(*p).Set(&(*pf),j); (*p).Set(&(*pf),j);
++p; ++p;
} }
}
e.resize(p-e.begin()); // remove from the end of the edge vector the unitiailized ones
assert(p==e.end()); assert(p==e.end());
sort(e.begin(), e.end()); // Lo ordino per vertici sort(e.begin(), e.end());
int ne = 0; // Numero di edge reali
int ne = 0; // number of real edges
typename std::vector<PEdgeTex>::iterator pe,ps; typename std::vector<PEdgeTex>::iterator pe,ps;
ps = e.begin();pe=e.begin(); ps = e.begin();pe=e.begin();
//for(ps = e.begin(),pe=e.begin();pe<=e.end();++pe) // Scansione vettore ausiliario //for(ps = e.begin(),pe=e.begin();pe<=e.end();++pe) // Scansione vettore ausiliario