Cleaned up a bit the Final flipping stage of EMC. Now it is a bit more robust.
This commit is contained in:
parent
f83dc8b993
commit
c77aeae697
|
@ -37,6 +37,7 @@
|
|||
#include <vcg/complex/trimesh/update/normal.h>
|
||||
#include <vcg/complex/trimesh/update/topology.h>
|
||||
#include <vcg/complex/trimesh/allocate.h>
|
||||
#include <vcg/complex/trimesh/clean.h>
|
||||
#include <vcg/space/point3.h>
|
||||
#include "emc_lookup_table.h"
|
||||
|
||||
|
@ -94,10 +95,11 @@ namespace vcg
|
|||
typedef typename TRIMESH_TYPE::CoordType CoordType;
|
||||
typedef typename TRIMESH_TYPE::CoordType* CoordPointer;
|
||||
|
||||
typedef struct
|
||||
struct LightEdge
|
||||
{
|
||||
LightEdge(size_t _face, size_t _edge):face(_face), edge(_edge) { }
|
||||
size_t face, edge;
|
||||
} LightEdge;
|
||||
};
|
||||
|
||||
/*!
|
||||
* Constructor
|
||||
|
@ -399,31 +401,18 @@ namespace vcg
|
|||
FaceIterator f_end = _mesh->face.end();
|
||||
for (i=0; f_iter!=f_end; f_iter++, i++)
|
||||
{
|
||||
if (f_iter->V(1) > f_iter->V(0))
|
||||
{
|
||||
LightEdge le;
|
||||
le.face = i;
|
||||
le.edge = 0;
|
||||
edges.push_back( le );
|
||||
if (f_iter->V(1) > f_iter->V(0)) edges.push_back( LightEdge(i,0) );
|
||||
if (f_iter->V(2) > f_iter->V(1)) edges.push_back( LightEdge(i,1) );
|
||||
if (f_iter->V(0) > f_iter->V(2)) edges.push_back( LightEdge(i,2) );
|
||||
}
|
||||
if (f_iter->V(2) > f_iter->V(1))
|
||||
{
|
||||
LightEdge le;
|
||||
le.face = i;
|
||||
le.edge = 1;
|
||||
edges.push_back( LightEdge(le));
|
||||
}
|
||||
if (f_iter->V(0) > f_iter->V(2))
|
||||
{
|
||||
LightEdge le;
|
||||
le.face = i;
|
||||
le.edge = 2;
|
||||
edges.push_back( le );
|
||||
}
|
||||
}
|
||||
vcg::tri::UpdateTopology< TRIMESH_TYPE >::VertexFace( *_mesh );
|
||||
vcg::tri::UpdateTopology< TRIMESH_TYPE >::FaceFace( *_mesh );
|
||||
|
||||
// Select all the triangles that has a vertex shared with a non manifold edge.
|
||||
int nonManifEdge = tri::Clean< TRIMESH_TYPE >::CountNonManifoldEdgeFF(*_mesh,true);
|
||||
if(nonManifEdge >0)
|
||||
tri::UpdateSelection< TRIMESH_TYPE >::FaceFromVertexLoose(*_mesh);
|
||||
//qDebug("Got %i non manif edges",nonManifEdge);
|
||||
|
||||
typename std::vector< LightEdge >::iterator e_it = edges.begin();
|
||||
typename std::vector< LightEdge >::iterator e_end = edges.end();
|
||||
|
||||
|
@ -434,7 +423,11 @@ namespace vcg
|
|||
f = &_mesh->face[e_it->face];
|
||||
z = (int) e_it->edge;
|
||||
|
||||
if (vcg::face::CheckFlipEdge< FaceType >(*f, z))
|
||||
// v2------v1 swap the diagonal only if v2 and v3 are feature and v0 and v1 are not.
|
||||
// | / |
|
||||
// | / |
|
||||
// v0------v3
|
||||
if (!(f->IsS()) && vcg::face::CheckFlipEdge< FaceType >(*f, z))
|
||||
{
|
||||
VertexPointer v0, v1, v2, v3;
|
||||
v0 = f->V(z);
|
||||
|
|
Loading…
Reference in New Issue