fix bug about angle thresholding
This commit is contained in:
parent
d4f5f73324
commit
96a8e0e08f
|
|
@ -123,6 +123,7 @@ public:
|
||||||
params.stat.Reset();
|
params.stat.Reset();
|
||||||
|
|
||||||
if(cb) cb(100*i/params.iter, "Remeshing");
|
if(cb) cb(100*i/params.iter, "Remeshing");
|
||||||
|
|
||||||
if(params.splitFlag)
|
if(params.splitFlag)
|
||||||
SplitLongEdges(toRemesh, params);
|
SplitLongEdges(toRemesh, params);
|
||||||
|
|
||||||
|
|
@ -134,12 +135,12 @@ public:
|
||||||
CollapseShortEdges(toRemesh, params);
|
CollapseShortEdges(toRemesh, params);
|
||||||
CollapseCrosses(toRemesh, params);
|
CollapseCrosses(toRemesh, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(params.smoothFlag)
|
if(params.smoothFlag)
|
||||||
ImproveByLaplacian(toRemesh, params);
|
ImproveByLaplacian(toRemesh, params);
|
||||||
if(params.projectFlag)
|
if(params.projectFlag)
|
||||||
ProjectToSurface(toRemesh, t, mark);
|
ProjectToSurface(toRemesh, t, mark);
|
||||||
|
|
||||||
printf("%4i %7i split %7i swap %7i collapse\n",i,params.stat.splitNum, params.stat.flipNum, params.stat.collapseNum);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -154,7 +155,8 @@ private:
|
||||||
static inline bool testCreaseEdge(PosType &p, ScalarType creaseCosineThr)
|
static inline bool testCreaseEdge(PosType &p, ScalarType creaseCosineThr)
|
||||||
{
|
{
|
||||||
ScalarType angle = fastAngle(NormalizedTriangleNormal(*(p.F())), NormalizedTriangleNormal(*(p.FFlip())));
|
ScalarType angle = fastAngle(NormalizedTriangleNormal(*(p.F())), NormalizedTriangleNormal(*(p.FFlip())));
|
||||||
return (angle <= creaseCosineThr && angle >= -creaseCosineThr);
|
return 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.
|
||||||
|
|
@ -277,6 +279,7 @@ private:
|
||||||
(newDist == oldDist && qNew > qOld * 1.f) || qNew > 1.5f * qOld;
|
(newDist == oldDist && qNew > qOld * 1.f) || qNew > 1.5f * qOld;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Edge swap step: edges are flipped in order to optimize valence and triangle quality across the mesh
|
// Edge swap step: edges are flipped in order to optimize valence and triangle quality across the mesh
|
||||||
static void ImproveValence(MeshType &m, Params ¶ms)
|
static void ImproveValence(MeshType &m, Params ¶ms)
|
||||||
{
|
{
|
||||||
|
|
@ -285,7 +288,7 @@ private:
|
||||||
if(p.FFlip() > p.F())
|
if(p.FFlip() > p.F())
|
||||||
if(((!params.selectedOnly) || (p.F()->IsS() && p.FFlip()->IsS())) &&
|
if(((!params.selectedOnly) || (p.F()->IsS() && p.FFlip()->IsS())) &&
|
||||||
testSwap(p, params.creaseAngleCosThr) &&
|
testSwap(p, params.creaseAngleCosThr) &&
|
||||||
face::CheckFlipEdgeNormal(*p.F(), p.E(), math::ToRad(10.f)) &&
|
face::CheckFlipEdgeNormal(*p.F(), p.E(), math::ToRad(10.f)) &&
|
||||||
face::CheckFlipEdge(*p.F(), p.E()) )
|
face::CheckFlipEdge(*p.F(), p.E()) )
|
||||||
{
|
{
|
||||||
face::FlipEdge(*p.F(), p.E());
|
face::FlipEdge(*p.F(), p.E());
|
||||||
|
|
@ -398,8 +401,8 @@ 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;
|
||||||
|
|
||||||
|
|
@ -651,7 +654,7 @@ private:
|
||||||
if(params.selectedOnly) {
|
if(params.selectedOnly) {
|
||||||
ss.popAnd();
|
ss.popAnd();
|
||||||
}
|
}
|
||||||
tri::Smooth<MeshType>::VertexCoordPlanarLaplacian(m,1,params.creaseAngleRadThr,true);
|
tri::Smooth<MeshType>::VertexCoordPlanarLaplacian(m,1, params.creaseAngleRadThr,true);
|
||||||
tri::UpdateSelection<MeshType>::VertexClear(m);
|
tri::UpdateSelection<MeshType>::VertexClear(m);
|
||||||
if(params.selectedOnly) {
|
if(params.selectedOnly) {
|
||||||
ss.pop();
|
ss.pop();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue