removed the flag to fix irregulars on laplacian and created a version of LaplacianReproject that does not need a triangular mesh
This commit is contained in:
parent
8afa67c9be
commit
06f8a69ee1
|
@ -595,7 +595,6 @@ public:
|
||||||
template <class TriMeshType>
|
template <class TriMeshType>
|
||||||
static void LaplacianReproject(PolyMeshType &poly_m,
|
static void LaplacianReproject(PolyMeshType &poly_m,
|
||||||
TriMeshType &tri_mesh,
|
TriMeshType &tri_mesh,
|
||||||
bool fixIrr=false,
|
|
||||||
int nstep=100,
|
int nstep=100,
|
||||||
ScalarType Damp=0.5)
|
ScalarType Damp=0.5)
|
||||||
{
|
{
|
||||||
|
@ -608,8 +607,6 @@ public:
|
||||||
|
|
||||||
ScalarType MaxD=tri_mesh.bbox.Diag();
|
ScalarType MaxD=tri_mesh.bbox.Diag();
|
||||||
|
|
||||||
if (fixIrr)
|
|
||||||
poly_m.NumIrregular(true);
|
|
||||||
for (int s=0;s<nstep;s++)
|
for (int s=0;s<nstep;s++)
|
||||||
{
|
{
|
||||||
std::vector<CoordType> AvVert;
|
std::vector<CoordType> AvVert;
|
||||||
|
@ -618,7 +615,6 @@ public:
|
||||||
for (size_t i=0;i<poly_m.vert.size();i++)
|
for (size_t i=0;i<poly_m.vert.size();i++)
|
||||||
{
|
{
|
||||||
if (poly_m.vert[i].IsB())continue;
|
if (poly_m.vert[i].IsB())continue;
|
||||||
if (fixIrr && (poly_m.vert[i].IsS()))continue;
|
|
||||||
poly_m.vert[i].P()=poly_m.vert[i].P()*Damp+
|
poly_m.vert[i].P()=poly_m.vert[i].P()*Damp+
|
||||||
AvVert[i]*(1-Damp);
|
AvVert[i]*(1-Damp);
|
||||||
}
|
}
|
||||||
|
@ -640,8 +636,21 @@ public:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief This function laplacian smooth of a polygonal mesh
|
static void LaplacianReproject(PolyMeshType &poly_m,
|
||||||
*/
|
int nstep=100,
|
||||||
|
ScalarType Damp=0.5)
|
||||||
|
{
|
||||||
|
//transform into triangular
|
||||||
|
TempMesh GuideSurf;
|
||||||
|
//vcg::tri::PolygonSupport<TempMesh,PolyMeshType>:(GuideSurf,poly_m);
|
||||||
|
TriangulateToTriMesh<TempMesh>(poly_m,GuideSurf);
|
||||||
|
vcg::tri::UpdateBounding<TempMesh>::Box(GuideSurf);
|
||||||
|
vcg::tri::UpdateNormal<TempMesh>::PerVertexNormalizedPerFace(GuideSurf);
|
||||||
|
vcg::tri::UpdateTopology<TempMesh>::FaceFace(GuideSurf);
|
||||||
|
vcg::tri::UpdateFlags<TempMesh>::FaceBorderFromFF(GuideSurf);
|
||||||
|
LaplacianReproject(poly_m,GuideSurf,nstep,Damp=0.5);
|
||||||
|
}
|
||||||
|
|
||||||
static void Laplacian(PolyMeshType &poly_m,
|
static void Laplacian(PolyMeshType &poly_m,
|
||||||
bool FixS=false,
|
bool FixS=false,
|
||||||
int nstep=10,
|
int nstep=10,
|
||||||
|
@ -685,8 +694,8 @@ public:
|
||||||
//first select sharp features
|
//first select sharp features
|
||||||
if (SharpDeg>0)
|
if (SharpDeg>0)
|
||||||
{
|
{
|
||||||
for (size_t i=0;i<poly_m.face.size();i++)
|
for (int i=0;i<(int)poly_m.face.size();i++)
|
||||||
for (size_t j=0;j<poly_m.face[i].VN();j++)
|
for (int j=0;j<(int)poly_m.face[i].VN();j++)
|
||||||
{
|
{
|
||||||
//check only one side
|
//check only one side
|
||||||
if ((&poly_m.face[i])>=poly_m.face[i].FFp(j))continue;
|
if ((&poly_m.face[i])>=poly_m.face[i].FFp(j))continue;
|
||||||
|
|
Loading…
Reference in New Issue