added missing iteration control inthe hc laplacian smoothing
This commit is contained in:
parent
70d3ccfa23
commit
fde38e0612
|
|
@ -507,6 +507,8 @@ static void VertexCoordLaplacianHC(MeshType &m, int step, bool SmoothSelected=fa
|
||||||
lpz.sum=CoordType(0,0,0);
|
lpz.sum=CoordType(0,0,0);
|
||||||
lpz.dif=CoordType(0,0,0);
|
lpz.dif=CoordType(0,0,0);
|
||||||
lpz.cnt=0;
|
lpz.cnt=0;
|
||||||
|
for(int i=0;i<step;++i)
|
||||||
|
{
|
||||||
SimpleTempData<typename MeshType::VertContainer,HCSmoothInfo > TD(m.vert,lpz);
|
SimpleTempData<typename MeshType::VertContainer,HCSmoothInfo > TD(m.vert,lpz);
|
||||||
// First Loop compute the laplacian
|
// First Loop compute the laplacian
|
||||||
FaceIterator fi;
|
FaceIterator fi;
|
||||||
|
|
@ -554,6 +556,7 @@ static void VertexCoordLaplacianHC(MeshType &m, int step, bool SmoothSelected=fa
|
||||||
if(!SmoothSelected || (*vi).IsS())
|
if(!SmoothSelected || (*vi).IsS())
|
||||||
(*vi).P()= TD[*vi].sum - (TD[*vi].sum - (*vi).P())*beta + (TD[*vi].dif)*(1.f-beta);
|
(*vi).P()= TD[*vi].sum - (TD[*vi].sum - (*vi).P())*beta + (TD[*vi].dif)*(1.f-beta);
|
||||||
}
|
}
|
||||||
|
} // end for step
|
||||||
};
|
};
|
||||||
|
|
||||||
// Laplacian smooth of the quality.
|
// Laplacian smooth of the quality.
|
||||||
|
|
@ -1097,6 +1100,9 @@ static void FaceNormalAngleThreshold(MeshType &m,
|
||||||
if(! (*ep.f).IsV() )
|
if(! (*ep.f).IsV() )
|
||||||
{
|
{
|
||||||
ScalarType cosang=ep.f->N().dot((*fi).N());
|
ScalarType cosang=ep.f->N().dot((*fi).N());
|
||||||
|
// Note that if two faces form an angle larger than 90 deg, their contribution should be very very small.
|
||||||
|
// Without this clamping
|
||||||
|
cosang = math::Clamp(cosang,0.0001f,1.f);
|
||||||
if(cosang >= sigma)
|
if(cosang >= sigma)
|
||||||
{
|
{
|
||||||
ScalarType w = cosang-sigma;
|
ScalarType w = cosang-sigma;
|
||||||
|
|
@ -1269,19 +1275,18 @@ static void VertexCoordPasoDoble(MeshType &m, int step, typename MeshType::Scala
|
||||||
|
|
||||||
// The sigma parameter affect the normal smoothing step
|
// The sigma parameter affect the normal smoothing step
|
||||||
|
|
||||||
static void VertexCoordPasoDobleFast(MeshType &m, int step, typename MeshType::ScalarType Sigma=0, int FitStep=50, bool SmoothSelected =false)
|
static void VertexCoordPasoDobleFast(MeshType &m, int NormalSmoothStep, typename MeshType::ScalarType Sigma=0, int FitStep=50, bool SmoothSelected =false)
|
||||||
{
|
{
|
||||||
PDVertInfo lpzv;
|
PDVertInfo lpzv;
|
||||||
lpzv.np=CoordType(0,0,0);
|
lpzv.np=CoordType(0,0,0);
|
||||||
PDFaceInfo lpzf;
|
PDFaceInfo lpzf;
|
||||||
lpzf.m=CoordType(0,0,0);
|
lpzf.m=CoordType(0,0,0);
|
||||||
|
|
||||||
assert(m.HasVFTopology());
|
assert(HasVFAdjacency(m));
|
||||||
m.HasVFTopology();
|
|
||||||
SimpleTempData< typename MeshType::VertContainer, PDVertInfo> TDV(m.vert,lpzv);
|
SimpleTempData< typename MeshType::VertContainer, PDVertInfo> TDV(m.vert,lpzv);
|
||||||
SimpleTempData< typename MeshType::FaceContainer, PDFaceInfo> TDF(m.face,lpzf);
|
SimpleTempData< typename MeshType::FaceContainer, PDFaceInfo> TDF(m.face,lpzf);
|
||||||
|
|
||||||
for(int j=0;j<step;++j)
|
for(int j=0;j<NormalSmoothStep;++j)
|
||||||
FaceNormalAngleThreshold(m,TDF,Sigma);
|
FaceNormalAngleThreshold(m,TDF,Sigma);
|
||||||
|
|
||||||
for(int j=0;j<FitStep;++j)
|
for(int j=0;j<FitStep;++j)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue