remove compact vert and face filters

This commit is contained in:
alemuntoni 2021-09-22 11:30:19 +02:00
parent 5ad9516523
commit eea574356b
3 changed files with 13 additions and 39 deletions

View File

@ -54,9 +54,7 @@ CleanFilter::CleanFilter()
FP_REMOVE_DUPLICATED_VERTEX,
FP_REMOVE_FACE_ZERO_AREA,
FP_MERGE_CLOSE_VERTEX,
FP_MERGE_WEDGE_TEX,
FP_COMPACT_FACE,
FP_COMPACT_VERT
FP_MERGE_WEDGE_TEX
};
for(ActionIDType tt : types())
@ -96,8 +94,6 @@ QString CleanFilter::filterName(ActionIDType filter) const
case FP_REMOVE_UNREFERENCED_VERTEX: return QString("Remove Unreferenced Vertices");
case FP_REMOVE_DUPLICATED_VERTEX: return QString("Remove Duplicate Vertices");
case FP_REMOVE_FACE_ZERO_AREA: return QString("Remove Zero Area Faces");
case FP_COMPACT_VERT: return QString("Compact vertices");
case FP_COMPACT_FACE: return QString("Compact faces");
default: assert(0);
}
return QString("error!");
@ -133,8 +129,6 @@ QString CleanFilter::filterInfo(ActionIDType filterId) const
case FP_REMOVE_UNREFERENCED_VERTEX: return QString("Check for every vertex on the mesh: if it is NOT referenced by a face, removes it");
case FP_REMOVE_DUPLICATED_VERTEX: return QString("Check for every vertex on the mesh: if there are two vertices with same coordinates they are merged into a single one.");
case FP_REMOVE_FACE_ZERO_AREA: return QString("Remove null faces (the one with area equal to zero)");
case FP_COMPACT_VERT: return QString("Compact all the vertices that have been deleted and put them to the end of the vector");
case FP_COMPACT_FACE: return QString("Compact all the faces that have been deleted and put them to the end of the vector");
default: assert(0);
}
return QString("error!");
@ -159,8 +153,6 @@ CleanFilter::FilterClass CleanFilter::getClass(const QAction *a) const
case FP_REMOVE_FACE_ZERO_AREA:
case FP_REMOVE_UNREFERENCED_VERTEX:
case FP_REMOVE_DUPLICATED_VERTEX:
case FP_COMPACT_VERT:
case FP_COMPACT_FACE: return FilterPlugin::Cleaning;
case FP_BALL_PIVOTING: return FilterPlugin::Remeshing;
case FP_MERGE_WEDGE_TEX: return FilterPlugin::FilterClass(FilterPlugin::Cleaning + FilterPlugin::Texture);
default : assert(0);
@ -172,8 +164,6 @@ int CleanFilter::getRequirements(const QAction *action)
{
switch(ID(action))
{
case FP_COMPACT_FACE:
case FP_COMPACT_VERT:
case FP_REMOVE_WRT_Q:
case FP_BALL_PIVOTING: return MeshModel::MM_VERTMARK;
case FP_REMOVE_ISOLATED_COMPLEXITY:
@ -217,8 +207,6 @@ int CleanFilter::postCondition(const QAction* action) const
case FP_REMOVE_DUPLICATED_VERTEX:
case FP_REMOVE_FACE_ZERO_AREA:
case FP_REMOVE_NON_MANIF_EDGE_SPLIT: return MeshModel::MM_GEOMETRY_AND_TOPOLOGY_CHANGE;
case FP_COMPACT_VERT:
case FP_COMPACT_FACE: return MeshModel::MM_NONE; // only internal vector storage should change, nothing more
}
return MeshModel::MM_ALL;
}
@ -468,16 +456,6 @@ std::map<std::string, QVariant> CleanFilter::applyFilter(const QAction *filter,
m.clearDataMask(MeshModel::MM_VERTFACETOPO);
} break;
case FP_COMPACT_FACE :
{
vcg::tri::Allocator<CMeshO>::CompactFaceVector(m.cm);
} break;
case FP_COMPACT_VERT :
{
vcg::tri::Allocator<CMeshO>::CompactVertexVector(m.cm);
} break;
default :
wrongActionCalled(filter); // unknown filter;
}

View File

@ -55,9 +55,7 @@ class CleanFilter : public QObject, public FilterPlugin
FP_REMOVE_DUPLICATED_VERTEX,
FP_REMOVE_FACE_ZERO_AREA,
FP_MERGE_CLOSE_VERTEX,
FP_MERGE_WEDGE_TEX,
FP_COMPACT_VERT,
FP_COMPACT_FACE
FP_MERGE_WEDGE_TEX
} ;
CleanFilter();

View File

@ -476,9 +476,8 @@ std::map<std::string, QVariant> FilterUnsharp::applyFilter(
float alpha = 1;
switch (stepNum) {
case 0: // ***** Storing Vertex Data *****
{
if(tri::HasPerVertexAttribute(m.cm,AttribName)) {
case 0: { // ***** Storing Vertex Data *****
if(tri::HasPerVertexAttribute(m.cm,AttribName)) {
vcg::tri::Allocator<CMeshO>::DeletePerVertexAttribute(m.cm,AttribName);
}
CMeshO::PerVertexAttributeHandle<Point3m> h = tri::Allocator<CMeshO>::AddPerVertexAttribute<Point3m> (m.cm,AttribName);
@ -490,27 +489,26 @@ std::map<std::string, QVariant> FilterUnsharp::applyFilter(
log( "Stored Position %d vertices", m.cm.vn);
break;
}
case 1: // ***** Recovering and Projection Vertex Data *****
{
if(!tri::HasPerVertexAttribute(m.cm,AttribName)) {
case 1: { // ***** Recovering and Projection Vertex Data *****
if(!tri::HasPerVertexAttribute(m.cm,AttribName)) {
throw MLException("Failed to retrieve the stored vertex position. First Store than recover.");
}
CMeshO::PerVertexAttributeHandle<Point3m> h = tri::Allocator<CMeshO>::GetPerVertexAttribute<Point3m> (m.cm,AttribName);
CMeshO::VertexIterator vi;
for(vi= m.cm.vert.begin();vi!= m.cm.vert.end();++vi)
{
Point3m d = h[vi] - viewpoint; d.Normalize();
float s = d * ( (*vi).cP() - h[vi] );
for(vi= m.cm.vert.begin();vi!= m.cm.vert.end();++vi) {
Point3m d = h[vi] - viewpoint;
d.Normalize();
Scalarm s = d * ( (*vi).cP() - h[vi] );
(*vi).P() = h[vi] + d * (s*alpha);
}
m.updateBoxAndNormals();
log( "Projected smoothed Position %d vertices", m.cm.vn);
}
log("Projected smoothed Position %d vertices", m.cm.vn);
break;
}
}
}
break;
}
case FP_SD_LAPLACIAN_SMOOTH:
{
tri::UpdateFlags<CMeshO>::FaceBorderFromNone(m.cm);