fix bug on edgecollapse

This commit is contained in:
T.Alderighi 2018-08-06 11:15:15 +02:00
parent 96a8e0e08f
commit 3dd1f38353
1 changed files with 577 additions and 571 deletions

View File

@ -475,7 +475,8 @@ private:
computeVQualityDistrMinMax(m, minQ, maxQ);
tri::UpdateTopology<MeshType>::VertexFace(m);
tri::UpdateFlags<MeshType>::VertexBorderFromNone(m);
tri::UpdateFlags<MeshType>::FaceBorderFromVF(m);
tri::UpdateFlags<MeshType>::VertexBorderFromFaceBorder(m);
for(auto fi=m.face.begin(); fi!=m.face.end(); ++fi)
if(!(*fi).IsD() && (params.selectedOnly == false || fi->IsS()))
@ -486,14 +487,19 @@ private:
++candidates;
VertexPair bp = VertexPair(pi.V(), pi.VFlip());
Point3<ScalarType> mp = (pi.V()->P()+pi.VFlip()->P())/2.f;
bool boundary = false;
bool boundary = false;
//if both border or both internal use midpoint
if(pi.V()->IsB() == pi.VFlip()->IsB())
{
if(pi.V()->IsB() && !(boundary = chooseBoundaryCollapse(pi, bp)))
//if both border but not on border edge..abort..if chooseBoundaryCollapse can't find good collapse..abort..
if(pi.V()->IsB() && !fi->IsB(i) && !(boundary = chooseBoundaryCollapse(pi, bp)))
continue;
mp = (pi.V()->IsB()) ? bp.V(1)->P() : (pi.V()->P()+pi.VFlip()->P())/2.f;
} else {
}
else //if only one is border...collapse on it!
{
bp = (pi.V()->IsB()) ? VertexPair(pi.VFlip(), pi.V()) : VertexPair(pi.V(), pi.VFlip());
mp = (pi.V()->IsB()) ? pi.V()->P() : pi.VFlip()->P();
}