Restrutctured a bit the FaceFace computing function in order to allow other function to compute the set of edges (needed in the new point_sampling.h)
This commit is contained in:
parent
cd7d4b5053
commit
5bc8b01870
|
|
@ -131,8 +131,8 @@ void Set( FacePointer pf, const int nz )
|
||||||
assert(nz>=0);
|
assert(nz>=0);
|
||||||
assert(nz<3);
|
assert(nz<3);
|
||||||
|
|
||||||
v[0] = pf->V(nz);
|
v[0] = pf->V0(nz);
|
||||||
v[1] = pf->V((nz+1)%3);
|
v[1] = pf->V1(nz);
|
||||||
assert(v[0] != v[1]); // The face pointed by 'f' is Degenerate (two coincident vertexes)
|
assert(v[0] != v[1]); // The face pointed by 'f' is Degenerate (two coincident vertexes)
|
||||||
|
|
||||||
if( v[0] > v[1] ) math::Swap(v[0],v[1]);
|
if( v[0] > v[1] ) math::Swap(v[0],v[1]);
|
||||||
|
|
@ -147,51 +147,17 @@ inline bool operator < ( const PEdge & pe ) const
|
||||||
else return v[1] < pe.v[1];
|
else return v[1] < pe.v[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool operator <= ( const PEdge & pe ) const
|
|
||||||
{
|
|
||||||
if( v[0]<pe.v[0] ) return true;
|
|
||||||
else if( v[0]>pe.v[0] ) return false;
|
|
||||||
else return v[1] <= pe.v[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool operator > ( const PEdge & pe ) const
|
|
||||||
{
|
|
||||||
if( v[0]>pe.v[0] ) return true;
|
|
||||||
else if( v[0]<pe.v[0] ) return false;
|
|
||||||
else return v[1] > pe.v[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool operator >= ( const PEdge & pe ) const
|
|
||||||
{
|
|
||||||
if( v[0]>pe.v[0] ) return true;
|
|
||||||
else if( v[0]<pe.v[0] ) return false;
|
|
||||||
else return v[1] >= pe.v[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool operator == ( const PEdge & pe ) const
|
inline bool operator == ( const PEdge & pe ) const
|
||||||
{
|
{
|
||||||
return v[0]==pe.v[0] && v[1]==pe.v[1];
|
return v[0]==pe.v[0] && v[1]==pe.v[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool operator != ( const PEdge & pe ) const
|
|
||||||
{
|
|
||||||
return v[0]!=pe.v[0] || v[1]!=pe.v[1];
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void FillEdgeVector(MeshType &m, std::vector<PEdge> &e)
|
||||||
/** Update the Face-Face topological relation by allowing to retrieve for each face what other faces shares their edges.
|
|
||||||
*/
|
|
||||||
static void FaceFace(MeshType &m)
|
|
||||||
{
|
{
|
||||||
if(!m.HasFFTopology()) return;
|
FaceIterator pf;
|
||||||
|
|
||||||
std::vector<PEdge> e;
|
|
||||||
FaceIterator pf;
|
|
||||||
typename std::vector<PEdge>::iterator p;
|
typename std::vector<PEdge>::iterator p;
|
||||||
|
|
||||||
if( m.fn == 0 ) return;
|
|
||||||
|
|
||||||
e.resize(m.fn*3); // Alloco il vettore ausiliario
|
e.resize(m.fn*3); // Alloco il vettore ausiliario
|
||||||
p = e.begin();
|
p = e.begin();
|
||||||
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
|
||||||
|
|
@ -201,7 +167,18 @@ static void FaceFace(MeshType &m)
|
||||||
(*p).Set(&(*pf),j);
|
(*p).Set(&(*pf),j);
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
assert(p==e.end());
|
assert(p==e.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Update the Face-Face topological relation by allowing to retrieve for each face what other faces shares their edges.
|
||||||
|
*/
|
||||||
|
static void FaceFace(MeshType &m)
|
||||||
|
{
|
||||||
|
if(!m.HasFFTopology()) return;
|
||||||
|
if( m.fn == 0 ) return;
|
||||||
|
|
||||||
|
std::vector<PEdge> e;
|
||||||
|
FillEdgeVector(m,e);
|
||||||
sort(e.begin(), e.end()); // Lo ordino per vertici
|
sort(e.begin(), e.end()); // Lo ordino per vertici
|
||||||
|
|
||||||
int ne = 0; // Numero di edge reali
|
int ne = 0; // Numero di edge reali
|
||||||
|
|
@ -211,7 +188,7 @@ static void FaceFace(MeshType &m)
|
||||||
//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
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if( pe==e.end() || *pe != *ps ) // Trovo blocco di edge uguali
|
if( pe==e.end() || !(*pe == *ps) ) // Trovo blocco di edge uguali
|
||||||
{
|
{
|
||||||
typename std::vector<PEdge>::iterator q,q_next;
|
typename std::vector<PEdge>::iterator q,q_next;
|
||||||
for (q=ps;q<pe-1;++q) // Scansione facce associate
|
for (q=ps;q<pe-1;++q) // Scansione facce associate
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue