fix bug on edgecollapse
This commit is contained in:
parent
96a8e0e08f
commit
3dd1f38353
|
|
@ -156,7 +156,7 @@ private:
|
||||||
{
|
{
|
||||||
ScalarType angle = fastAngle(NormalizedTriangleNormal(*(p.F())), NormalizedTriangleNormal(*(p.FFlip())));
|
ScalarType angle = fastAngle(NormalizedTriangleNormal(*(p.F())), NormalizedTriangleNormal(*(p.FFlip())));
|
||||||
return angle <= creaseCosineThr;
|
return angle <= creaseCosineThr;
|
||||||
// return (angle <= creaseCosineThr && angle >= -creaseCosineThr);
|
// return (angle <= creaseCosineThr && angle >= -creaseCosineThr);
|
||||||
}
|
}
|
||||||
// this stores in minQ the value of the 10th percentile of the VertQuality distribution and in
|
// this stores in minQ the value of the 10th percentile of the VertQuality distribution and in
|
||||||
// maxQ the value of the 90th percentile.
|
// maxQ the value of the 90th percentile.
|
||||||
|
|
@ -402,7 +402,7 @@ private:
|
||||||
Point3<ScalarType> oldN = NormalizedTriangleNormal(*(pi.F()));
|
Point3<ScalarType> oldN = NormalizedTriangleNormal(*(pi.F()));
|
||||||
Point3<ScalarType> newN = Normal(mp, v1->P(), v2->P()).Normalize();
|
Point3<ScalarType> newN = Normal(mp, v1->P(), v2->P()).Normalize();
|
||||||
float div = fastAngle(oldN, newN);
|
float div = fastAngle(oldN, newN);
|
||||||
// if(AngleN(oldN,newN) > math::ToRad(1.0)) return false;
|
// if(AngleN(oldN,newN) > math::ToRad(1.0)) return false;
|
||||||
if(div <= params.creaseAngleCosThr )
|
if(div <= params.creaseAngleCosThr )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -475,7 +475,8 @@ private:
|
||||||
computeVQualityDistrMinMax(m, minQ, maxQ);
|
computeVQualityDistrMinMax(m, minQ, maxQ);
|
||||||
|
|
||||||
tri::UpdateTopology<MeshType>::VertexFace(m);
|
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)
|
for(auto fi=m.face.begin(); fi!=m.face.end(); ++fi)
|
||||||
if(!(*fi).IsD() && (params.selectedOnly == false || fi->IsS()))
|
if(!(*fi).IsD() && (params.selectedOnly == false || fi->IsS()))
|
||||||
|
|
@ -486,14 +487,19 @@ private:
|
||||||
++candidates;
|
++candidates;
|
||||||
VertexPair bp = VertexPair(pi.V(), pi.VFlip());
|
VertexPair bp = VertexPair(pi.V(), pi.VFlip());
|
||||||
Point3<ScalarType> mp = (pi.V()->P()+pi.VFlip()->P())/2.f;
|
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() == 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;
|
continue;
|
||||||
mp = (pi.V()->IsB()) ? bp.V(1)->P() : (pi.V()->P()+pi.VFlip()->P())/2.f;
|
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());
|
bp = (pi.V()->IsB()) ? VertexPair(pi.VFlip(), pi.V()) : VertexPair(pi.V(), pi.VFlip());
|
||||||
mp = (pi.V()->IsB()) ? pi.V()->P() : pi.VFlip()->P();
|
mp = (pi.V()->IsB()) ? pi.V()->P() : pi.VFlip()->P();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue