Added Vertex-Face Topology
This commit is contained in:
parent
a6269df8cd
commit
49691db569
|
|
@ -24,6 +24,9 @@
|
||||||
History
|
History
|
||||||
|
|
||||||
$Log: not supported by cvs2svn $
|
$Log: not supported by cvs2svn $
|
||||||
|
Revision 1.3 2004/03/12 15:22:19 cignoni
|
||||||
|
Written some documentation and added to the trimes doxygen module
|
||||||
|
|
||||||
Revision 1.2 2004/03/05 21:49:21 cignoni
|
Revision 1.2 2004/03/05 21:49:21 cignoni
|
||||||
First working version for face face
|
First working version for face face
|
||||||
|
|
||||||
|
|
@ -126,56 +129,80 @@ inline bool operator != ( const PEdge & pe ) const
|
||||||
static void FaceFace(MeshType &m)
|
static void FaceFace(MeshType &m)
|
||||||
{
|
{
|
||||||
if(!m.HasFFTopology()) return;
|
if(!m.HasFFTopology()) return;
|
||||||
{
|
|
||||||
vector<PEdge> e;
|
|
||||||
FaceIterator pf;
|
|
||||||
vector<PEdge>::iterator p;
|
|
||||||
|
|
||||||
if( m.fn == 0 ) return;
|
vector<PEdge> e;
|
||||||
|
FaceIterator pf;
|
||||||
|
vector<PEdge>::iterator p;
|
||||||
|
|
||||||
e.resize(m.fn*3); // Alloco il vettore ausiliario
|
if( m.fn == 0 ) return;
|
||||||
p = e.begin();
|
|
||||||
for(pf=m.face.begin();pf!=m.face.end();++pf) // Lo riempio con i dati delle facce
|
|
||||||
if( ! (*pf).IsD() )
|
|
||||||
for(int j=0;j<3;++j)
|
|
||||||
{
|
|
||||||
(*p).Set(&(*pf),j);
|
|
||||||
++p;
|
|
||||||
}
|
|
||||||
assert(p==e.end());
|
|
||||||
sort(e.begin(), e.end()); // Lo ordino per vertici
|
|
||||||
|
|
||||||
int ne = 0; // Numero di edge reali
|
|
||||||
|
|
||||||
vector<PEdge>::iterator pe,ps;
|
e.resize(m.fn*3); // Alloco il vettore ausiliario
|
||||||
for(ps = e.begin(),pe=e.begin();pe<=e.end();++pe) // Scansione vettore ausiliario
|
p = e.begin();
|
||||||
{
|
for(pf=m.face.begin();pf!=m.face.end();++pf) // Lo riempio con i dati delle facce
|
||||||
if( pe==e.end() || *pe != *ps ) // Trovo blocco di edge uguali
|
if( ! (*pf).IsD() )
|
||||||
|
for(int j=0;j<3;++j)
|
||||||
|
{
|
||||||
|
(*p).Set(&(*pf),j);
|
||||||
|
++p;
|
||||||
|
}
|
||||||
|
assert(p==e.end());
|
||||||
|
sort(e.begin(), e.end()); // Lo ordino per vertici
|
||||||
|
|
||||||
|
int ne = 0; // Numero di edge reali
|
||||||
|
|
||||||
|
vector<PEdge>::iterator pe,ps;
|
||||||
|
for(ps = e.begin(),pe=e.begin();pe<=e.end();++pe) // Scansione vettore ausiliario
|
||||||
|
{
|
||||||
|
if( pe==e.end() || *pe != *ps ) // Trovo blocco di edge uguali
|
||||||
|
{
|
||||||
|
vector<PEdge>::iterator q,q_next;
|
||||||
|
for (q=ps;q<pe-1;++q) // Scansione facce associate
|
||||||
{
|
{
|
||||||
vector<PEdge>::iterator q,q_next;
|
|
||||||
for (q=ps;q<pe-1;++q) // Scansione facce associate
|
|
||||||
{
|
|
||||||
assert((*q).z>=0);
|
|
||||||
assert((*q).z< 3);
|
|
||||||
q_next = q;
|
|
||||||
++q_next;
|
|
||||||
assert((*q_next).z>=0);
|
|
||||||
assert((*q_next).z< 3);
|
|
||||||
(*q).f->F(q->z) = (*q_next).f; // Collegamento in lista delle facce
|
|
||||||
(*q).f->Z(q->z) = (*q_next).z;
|
|
||||||
}
|
|
||||||
assert((*q).z>=0);
|
assert((*q).z>=0);
|
||||||
assert((*q).z< 3);
|
assert((*q).z< 3);
|
||||||
(*q).f->F((*q).z) = ps->f;
|
q_next = q;
|
||||||
(*q).f->Z((*q).z) = ps->z;
|
++q_next;
|
||||||
ps = pe;
|
assert((*q_next).z>=0);
|
||||||
++ne; // Aggiorno il numero di edge
|
assert((*q_next).z< 3);
|
||||||
|
(*q).f->F(q->z) = (*q_next).f; // Collegamento in lista delle facce
|
||||||
|
(*q).f->Z(q->z) = (*q_next).z;
|
||||||
}
|
}
|
||||||
|
assert((*q).z>=0);
|
||||||
|
assert((*q).z< 3);
|
||||||
|
(*q).f->F((*q).z) = ps->f;
|
||||||
|
(*q).f->Z((*q).z) = ps->z;
|
||||||
|
ps = pe;
|
||||||
|
++ne; // Aggiorno il numero di edge
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void VertexFace(MeshType &m)
|
||||||
|
{
|
||||||
|
if(!m.HasVFTopology()) return;
|
||||||
|
|
||||||
|
VertexIterator vi;
|
||||||
|
FaceIterator fi;
|
||||||
|
|
||||||
|
for(vi=m.vert.begin();vi!=m.vert.end();++vi)
|
||||||
|
{
|
||||||
|
(*vi).Fp() = 0;
|
||||||
|
(*vi).Zp() = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(fi=m.face.begin();fi!=m.face.end();++fi)
|
||||||
|
if( ! (*fi).IsD() )
|
||||||
|
{
|
||||||
|
for(int j=0;j<3;++j)
|
||||||
|
{
|
||||||
|
(*fi).Fv(j) = (*fi).V(j)->Fp();
|
||||||
|
(*fi).Zv(j) = (*fi).V(j)->Zp();
|
||||||
|
(*fi).V(j)->Fp() = &(*fi);
|
||||||
|
(*fi).V(j)->Zp() = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}; // end class
|
}; // end class
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue