Added support of selection in polygon smoothing
This commit is contained in:
parent
1d7a803c8c
commit
a2c22505ed
|
|
@ -596,14 +596,16 @@ public:
|
|||
static void LaplacianReproject(PolyMeshType &poly_m,
|
||||
TriMeshType &tri_mesh,
|
||||
int nstep=100,
|
||||
ScalarType Damp=0.5)
|
||||
ScalarType DampS=0.5,
|
||||
ScalarType DampR=0.5,
|
||||
bool OnlyOnSelected=false)
|
||||
{
|
||||
typedef typename TriMeshType::FaceType TriFaceType;
|
||||
typedef typename TriMeshType::ScalarType TriScalarType;
|
||||
typedef typename TriMeshType::CoordType TriCoordType;
|
||||
typedef vcg::GridStaticPtr<TriFaceType, TriScalarType> TriMeshGrid;
|
||||
TriMeshGrid grid;
|
||||
|
||||
tri::MeshAssert<TriMeshType>::VertexNormalNormalized(tri_mesh);
|
||||
//initialize the grid
|
||||
grid.Set(tri_mesh.face.begin(),tri_mesh.face.end());
|
||||
|
||||
|
|
@ -617,13 +619,16 @@ public:
|
|||
for (size_t i=0;i<poly_m.vert.size();i++)
|
||||
{
|
||||
if (poly_m.vert[i].IsB()) continue;
|
||||
poly_m.vert[i].P()=poly_m.vert[i].P()*Damp+
|
||||
AvVert[i]*(1-Damp);
|
||||
if (OnlyOnSelected && !poly_m.vert[i].IsS()) continue;
|
||||
|
||||
poly_m.vert[i].P()=poly_m.vert[i].P()*DampS+
|
||||
AvVert[i]*(1-DampS);
|
||||
}
|
||||
|
||||
|
||||
for (size_t i=0;i<poly_m.vert.size();i++)
|
||||
{
|
||||
if(OnlyOnSelected && !poly_m.vert[i].IsS()) continue;
|
||||
TriCoordType testPos;
|
||||
testPos.Import(poly_m.vert[i].P());
|
||||
TriCoordType closestPt;
|
||||
|
|
@ -633,8 +638,8 @@ public:
|
|||
f=vcg::tri::GetClosestFaceBase(tri_mesh,grid,testPos,MaxD,minDist,closestPt,norm,ip);
|
||||
CoordType closestImp;
|
||||
closestImp.Import(closestPt);
|
||||
poly_m.vert[i].P()=poly_m.vert[i].P()*Damp+
|
||||
closestImp*(1-Damp);
|
||||
poly_m.vert[i].P()=poly_m.vert[i].P()*DampR+
|
||||
closestImp*(1-DampR);
|
||||
CoordType normalImp;
|
||||
normalImp.Import(norm);
|
||||
poly_m.vert[i].N()=normalImp;
|
||||
|
|
|
|||
Loading…
Reference in New Issue