Corrected Cleaning for poisson (removal of vertexes with bad normals)

This commit is contained in:
Paolo Cignoni 2017-02-28 16:39:41 +01:00
parent e56641bc59
commit ec6129c9fd

View File

@ -555,11 +555,15 @@ void PoissonClean(MeshType &m, bool scaleNormal, bool cleanFlag)
vcg::tri::UpdateNormal<MeshType>::NormalizePerVertex(m);
if(cleanFlag) {
for (auto vi = m.vert.begin(); vi != m.vert.end(); ++vi)
if (vcg::SquaredNorm(vi->N()) < std::numeric_limits<float>::min()*10.0)
vi->setD();
for (auto vi = m.vert.begin(); vi != m.vert.end(); ++vi)
if (vcg::SquaredNorm(vi->N()) < std::numeric_limits<float>::min()*10.0)
vcg::tri::Allocator<MeshType>::DeleteVertex(m,*vi);
for (auto fi = m.face.begin(); fi != m.face.end(); ++fi)
if( fi->V(0)->IsD() || fi->V(1)->IsD() || fi->V(2)->IsD() )
vcg::tri::Allocator<MeshType>::DeleteFace(m,*fi);
}
vcg::tri::Allocator<MeshType>::CompactEveryVector(m);
if(scaleNormal)
{