diff --git a/src/fgt/filter_aging/filter_aging.cpp b/src/fgt/filter_aging/filter_aging.cpp index a8c4df8da..9e5505f9c 100644 --- a/src/fgt/filter_aging/filter_aging.cpp +++ b/src/fgt/filter_aging/filter_aging.cpp @@ -83,79 +83,77 @@ const QString GeometryAgingPlugin::filterInfo(FilterIDType filterId) /* Initializes the list of parameters (called by the auto dialog framework) */ void GeometryAgingPlugin::initParameterSet(QAction *action, MeshModel &m, FilterParameterSet ¶ms) { - bool noQ = true; // vertex quality fields not initialized - std::pair qRange; // mesh quality range + if( ID(action) != FP_ERODE) + { + assert (0); + return; + } + bool hasQ = m.hasDataMask(MeshModel::MM_VERTQUALITY); + std::pair qRange(0.0, 0.0);; // mesh quality range // retrieve mesh quality range - if(m.cm.HasPerVertexQuality()) { + if(hasQ) + { qRange = tri::Stat::ComputePerVertexQualityMinMax(m.cm); - noQ = (qRange.second <= qRange.first); - if(noQ) { - computeMeanCurvature(m.cm); - qRange = tri::Stat::ComputePerVertexQualityMinMax(m.cm); - } - } - else - qRange = std::pair(0.0, 0.0); - - switch(ID(action)) { - case FP_ERODE: - params.addBool("ComputeCurvature", noQ, "Compute quality from curvature", - "Compute per vertex quality values using mesh mean curvature \n" - "algorithm. In this way only the areas with higher curvature \n" - "will be eroded. If not checked, the quality values already \n" - "present over the mesh will be used."); - params.addBool("SmoothQuality", false, "Smooth vertex quality", - "Smooth per vertex quality values. This allows to extend the \n" - "area affected by the erosion process."); - params.addAbsPerc("QualityThreshold", qRange.first+(qRange.second-qRange.first)*0.66, - qRange.first, qRange.second, "Min quality threshold", - "Represents the minimum quality value two vertexes must have \n" - "to consider the edge they are sharing."); - params.addAbsPerc("EdgeLenThreshold", m.cm.bbox.Diag()*0.02, 0,m.cm.bbox.Diag()*0.5, - "Edge len threshold", - "The minimum length of an edge. Useful to avoid the creation of too many small faces."); - params.addAbsPerc("ChipDepth", m.cm.bbox.Diag()*0.05, 0, m.cm.bbox.Diag(), - "Max chip depth", "The maximum depth of a chip."); - params.addInt("Octaves", 3, "Fractal Octaves", - "The number of octaves that are used in the generation of the \n" - "fractal noise using Perlin noise; reasonalble values are in the \n" - "1..8 range. Setting it to 1 means using a simple Perlin Noise."); - params.addAbsPerc("NoiseFreqScale", m.cm.bbox.Diag()/10, 0, m.cm.bbox.Diag(), "Noise frequency scale", - "Changes the noise frequency scale: this affects chip dimensions and \n" - "the distance between chips. The value denotes the average values \n" - "between two dents. Smaller number means small and frequent chips."); - params.addFloat("NoiseClamp", 0.5, "Noise clamp threshold [0..1]", - "All the noise values smaller than this parameter will be \n " - "considered as 0."); - params.addFloat("DisplacementSteps", 10, "Displacement steps", - "The whole displacement process is performed as a sequence of small \n" - "offsets applyed on each vertex. This parameter represents the number \n" - "of steps into which the displacement process will be splitted. \n" - "Useful to avoid the introduction of self intersections. \n" - "Bigger number means better accuracy."); - params.addBool("Selected", m.cm.sfn>0, "Affect only selected faces", - "The aging procedure will be applied to the selected faces only."); - params.addBool("StoreDisplacement", false, "Store erosion informations", - "Select this option if you want to store the erosion informations \n" - "over the mesh. A new attribute will be added to each vertex \n" - "to contain the displacement offset applied to that vertex."); - break; - default: - assert(0); + if(qRange.second <= qRange.first) hasQ=false; } + + params.addBool("ComputeCurvature", !hasQ, "ReCompute quality from curvature", + "Compute per vertex quality values using mesh mean curvature
" + "algorithm. In this way only the areas with higher curvature
" + "will be eroded. If not checked, the quality values already
" + "present over the mesh will be used."); + params.addBool("SmoothQuality", false, "Smooth vertex quality", + "Smooth per vertex quality values. This allows to extend the
" + "area affected by the erosion process."); + params.addAbsPerc("QualityThreshold", qRange.first+(qRange.second-qRange.first)*0.66, + qRange.first, qRange.second, "Min quality threshold", + "Represents the minimum quality value two vertexes must have
" + "to consider the edge they are sharing."); + params.addAbsPerc("EdgeLenThreshold", m.cm.bbox.Diag()*0.02, 0,m.cm.bbox.Diag()*0.5, + "Edge len threshold", + "The minimum length of an edge. Useful to avoid the creation of too many small faces."); + params.addAbsPerc("ChipDepth", m.cm.bbox.Diag()*0.05, 0, m.cm.bbox.Diag(), + "Max chip depth", "The maximum depth of a chip."); + params.addInt("Octaves", 3, "Fractal Octaves", + "The number of octaves that are used in the generation of the
" + "fractal noise using Perlin noise; reasonalble values are in the
" + "1..8 range. Setting it to 1 means using a simple Perlin Noise."); + params.addAbsPerc("NoiseFreqScale", m.cm.bbox.Diag()/10, 0, m.cm.bbox.Diag(), "Noise frequency scale", + "Changes the noise frequency scale: this affects chip dimensions and
" + "the distance between chips. The value denotes the average values
" + "between two dents. Smaller number means small and frequent chips."); + params.addFloat("NoiseClamp", 0.5, "Noise clamp threshold [0..1]", + "All the noise values smaller than this parameter will be
" + "considered as 0."); + params.addFloat("DisplacementSteps", 10, "Displacement steps", + "The whole displacement process is performed as a sequence of small
" + "offsets applyed on each vertex. This parameter represents the number
" + "of steps into which the displacement process will be splitted.
" + "Useful to avoid the introduction of self intersections.
" + "Bigger number means better accuracy."); + params.addBool("Selected", m.cm.sfn>0, "Affect only selected faces", + "The aging procedure will be applied to the selected faces only."); + params.addBool("StoreDisplacement", false, "Store erosion informations", + "Select this option if you want to store the erosion informations
" + "over the mesh. A new attribute will be added to each vertex
" + "to contain the displacement offset applied to that vertex."); } /* The Real Core Function doing the actual mesh processing */ bool GeometryAgingPlugin::applyFilter(QAction *filter, MeshModel &m, FilterParameterSet ¶ms, vcg::CallBackPos *cb) { - bool curvature = params.getBool("ComputeCurvature"); - - if(!m.cm.HasPerVertexQuality()) { - errorMessage = QString("This mesh doesn't have per vertex quality informations."); + if( ID(filter) != FP_ERODE) + { + assert (0); return false; } + + m.updateDataMask(MeshModel::MM_VERTQUALITY); + bool curvature = params.getBool("ComputeCurvature"); + if(curvature) computeMeanCurvature(m.cm); + // other plugin parameters bool smoothQ = params.getBool("SmoothQuality"); float qualityTh = params.getAbsPerc("QualityThreshold"); @@ -173,8 +171,6 @@ bool GeometryAgingPlugin::applyFilter(QAction *filter, MeshModel &m, FilterParam if(chipDepth == 0.0) chipDepth = m.cm.bbox.Diag()*0.05; noiseClamp = math::Clamp(noiseClamp, 0.0, 1.0); - switch(ID(filter)) { - case FP_ERODE: { // quality threshold percentage value std::pair qRange = tri::Stat::ComputePerVertexQualityMinMax(m.cm); float qperc = (qualityTh-qRange.first) / (qRange.second-qRange.first); @@ -273,10 +269,6 @@ bool GeometryAgingPlugin::applyFilter(QAction *filter, MeshModel &m, FilterParam if(selected) tri::UpdateSelection::VertexFromFaceLoose(m.cm); return true; - } - default: - assert(0); - } } @@ -405,7 +397,7 @@ void GeometryAgingPlugin::smoothPeaks(CMeshO &m, bool selected, bool updateErosi void GeometryAgingPlugin::computeMeanCurvature(CMeshO &m) { int delvert = tri::Clean::RemoveUnreferencedVertex(m); - if(delvert) Log(GLLogStream::Info, "Pre-Curvature Cleaning: Removed %d unreferenced vertices", delvert); + if(delvert) Log(GLLogStream::FILTER, "Pre-Curvature Cleaning: Removed %d unreferenced vertices", delvert); tri::Allocator::CompactVertexVector(m); tri::UpdateCurvature::MeanAndGaussian(m); tri::UpdateQuality::VertexFromMeanCurvature(m); diff --git a/src/fgt/filter_func/filter_func.cpp b/src/fgt/filter_func/filter_func.cpp index 0fbb7d2fc..f6b1ae93c 100644 --- a/src/fgt/filter_func/filter_func.cpp +++ b/src/fgt/filter_func/filter_func.cpp @@ -325,7 +325,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshModel &m, FilterPara tri::UpdateSelection::FaceFromVertexLoose(m.cm); // if succeded log stream contains number of vertices and time elapsed - Log(GLLogStream::Info, "selected %d vertices in %.2f sec.", numvert, (clock() - start) / (float) CLOCKS_PER_SEC); + Log(GLLogStream::FILTER, "selected %d vertices in %.2f sec.", numvert, (clock() - start) / (float) CLOCKS_PER_SEC); return true; } @@ -370,7 +370,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshModel &m, FilterPara } // if succeded log stream contains number of vertices and time elapsed - Log(GLLogStream::Info, "selected %d faces in %.2f sec.", numface, (clock() - start) / (float) CLOCKS_PER_SEC); + Log(GLLogStream::FILTER, "selected %d faces in %.2f sec.", numface, (clock() - start) / (float) CLOCKS_PER_SEC); return true; } @@ -443,7 +443,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshModel &m, FilterPara } // if succeded log stream contains number of vertices processed and time elapsed - Log(GLLogStream::Info, "%d vertices processed in %.2f sec.", m.cm.vn, (clock() - start) / (float) CLOCKS_PER_SEC); + Log(GLLogStream::FILTER, "%d vertices processed in %.2f sec.", m.cm.vn, (clock() - start) / (float) CLOCKS_PER_SEC); return true; } @@ -484,7 +484,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshModel &m, FilterPara if(par.getBool("map")) mapVertexQualityIntoColor(m); // if succeded log stream contains number of vertices and time elapsed - Log(GLLogStream::Info, "%d vertices processed in %.2f sec.", m.cm.vn, (clock() - start) / (float) CLOCKS_PER_SEC); + Log(GLLogStream::FILTER, "%d vertices processed in %.2f sec.", m.cm.vn, (clock() - start) / (float) CLOCKS_PER_SEC); return true; } @@ -544,7 +544,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshModel &m, FilterPara } // if succeded log stream contains number of vertices processed and time elapsed - Log(GLLogStream::Info, "%d faces processed in %.2f sec.", m.cm.fn, (clock() - start) / (float) CLOCKS_PER_SEC); + Log(GLLogStream::FILTER, "%d faces processed in %.2f sec.", m.cm.fn, (clock() - start) / (float) CLOCKS_PER_SEC); return true; @@ -587,7 +587,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshModel &m, FilterPara if(par.getBool("map")) mapFaceQualityIntoColor(m); // if succeded log stream contains number of faces processed and time elapsed - Log(GLLogStream::Info, "%d faces processed in %.2f sec.", m.cm.fn, (clock() - start) / (float) CLOCKS_PER_SEC); + Log(GLLogStream::FILTER, "%d faces processed in %.2f sec.", m.cm.fn, (clock() - start) / (float) CLOCKS_PER_SEC); return true; } @@ -635,7 +635,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshModel &m, FilterPara vhandlers.push_back(h); // if succeded log stream contains number of vertices processed and time elapsed - Log(GLLogStream::Info, "%d vertices processed in %.2f sec.", m.cm.vn, (clock() - start) / (float) CLOCKS_PER_SEC); + Log(GLLogStream::FILTER, "%d vertices processed in %.2f sec.", m.cm.vn, (clock() - start) / (float) CLOCKS_PER_SEC); return true; } @@ -683,7 +683,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshModel &m, FilterPara fhandlers.push_back(h); // if succeded log stream contains number of vertices processed and time elapsed - Log(GLLogStream::Info, "%d faces processed in %.2f sec.", m.cm.fn, (clock() - start) / (float) CLOCKS_PER_SEC); + Log(GLLogStream::FILTER, "%d faces processed in %.2f sec.", m.cm.fn, (clock() - start) / (float) CLOCKS_PER_SEC); return true; } diff --git a/src/fgt/filter_trioptimize/filter_trioptimize.cpp b/src/fgt/filter_trioptimize/filter_trioptimize.cpp index 36f5640d3..423e63ec2 100644 --- a/src/fgt/filter_trioptimize/filter_trioptimize.cpp +++ b/src/fgt/filter_trioptimize/filter_trioptimize.cpp @@ -266,7 +266,7 @@ bool TriOptimizePlugin::applyFilter(QAction *filter, MeshModel &m, int delvert = tri::Clean::RemoveUnreferencedVertex(m.cm); if (delvert) - Log(GLLogStream::Info, + Log(GLLogStream::FILTER, "Pre-Curvature Cleaning: Removed %d unreferenced vertices", delvert); @@ -312,7 +312,7 @@ bool TriOptimizePlugin::applyFilter(QAction *filter, MeshModel &m, optimiz.DoOptimization(); optimiz.h.clear(); - Log(GLLogStream::Info, "%d curvature edge flips performed in %.2f sec.", optimiz.nPerfmormedOps, (clock() - start) / (float) CLOCKS_PER_SEC); + Log(GLLogStream::FILTER, "%d curvature edge flips performed in %.2f sec.", optimiz.nPerfmormedOps, (clock() - start) / (float) CLOCKS_PER_SEC); } if (ID(filter) == FP_PLANAR_EDGE_FLIP) { if ( !tri::Clean::IsTwoManifoldFace(m.cm) ) { @@ -345,7 +345,7 @@ bool TriOptimizePlugin::applyFilter(QAction *filter, MeshModel &m, optimiz.DoOptimization(); optimiz.h.clear(); - Log(GLLogStream::Info, "%d planar edge flips performed in %.2f sec.", optimiz.nPerfmormedOps, (clock() - start) / (float) CLOCKS_PER_SEC); + Log(GLLogStream::FILTER, "%d planar edge flips performed in %.2f sec.", optimiz.nPerfmormedOps, (clock() - start) / (float) CLOCKS_PER_SEC); int iternum = par.getInt("iterations"); tri::Smooth::VertexCoordPlanarLaplacian(m.cm, iternum, 0.0001f, selection,cb); diff --git a/src/meshlabplugins/filter_clean/align_tools.cpp b/src/meshlabplugins/filter_clean/align_tools.cpp index f44f6bdef..45a81f40a 100644 --- a/src/meshlabplugins/filter_clean/align_tools.cpp +++ b/src/meshlabplugins/filter_clean/align_tools.cpp @@ -115,7 +115,7 @@ bool AlignTools::setupThenAlign(MeshModel &/*mm*/, FilterParameterSet & par) } else { qDebug() << "stuck points file didnt exist: " << ppFileName; - //Log(GLLogStream::Info, "No points were found for the Stuck mesh."); + //Log(GLLogStream::WARNING, "No points were found for the Stuck mesh."); return false; } } @@ -146,7 +146,7 @@ bool AlignTools::setupThenAlign(MeshModel &/*mm*/, FilterParameterSet & par) } else { qDebug() << "model to move points file didnt exist: " << ppFileName; - //Log(GLLogStream::Info, "No points were found for the mesh to move."); + //Log(GLLogStream::WARNING, "No points were found for the mesh to move."); return false; } } diff --git a/src/meshlabplugins/filter_clean/cleanfilter.cpp b/src/meshlabplugins/filter_clean/cleanfilter.cpp index abff25a30..bc95d7017 100644 --- a/src/meshlabplugins/filter_clean/cleanfilter.cpp +++ b/src/meshlabplugins/filter_clean/cleanfilter.cpp @@ -273,19 +273,19 @@ bool CleanFilter::applyFilter(QAction *filter, MeshModel &m, FilterParameterSet // the main processing pivot.BuildMesh(cb); m.clearDataMask(MeshModel::MM_FACEFACETOPO | MeshModel::MM_FACEFLAGBORDER); - Log(GLLogStream::Info,"Reconstructed surface. Added %i faces",m.cm.fn-startingFn); + Log(GLLogStream::FILTER,"Reconstructed surface. Added %i faces",m.cm.fn-startingFn); } break; case FP_REMOVE_ISOLATED_DIAMETER: { float minCC= par.getAbsPerc("MinComponentDiag"); std::pair delInfo= RemoveSmallConnectedComponentsDiameter(m.cm,minCC); - Log(GLLogStream::Info,"Removed %2 connected components out of %1", delInfo.second, delInfo.first); + Log(GLLogStream::FILTER,"Removed %2 connected components out of %1", delInfo.second, delInfo.first); }break; case FP_REMOVE_ISOLATED_COMPLEXITY: { float minCC= par.getInt("MinComponentSize"); std::pair delInfo=RemoveSmallConnectedComponentsSize(m.cm,minCC); - Log(GLLogStream::Info,"Removed %i connected components out of %i", delInfo.second, delInfo.first); + Log(GLLogStream::FILTER,"Removed %i connected components out of %i", delInfo.second, delInfo.first); }break; case FP_REMOVE_WRT_Q: { @@ -309,7 +309,7 @@ bool CleanFilter::applyFilter(QAction *filter, MeshModel &m, FilterParameterSet } m.clearDataMask(MeshModel::MM_FACEFACETOPO | MeshModel::MM_FACEFLAGBORDER); - Log(GLLogStream::Info,"Deleted %i vertices and %i faces with a quality lower than %f", deletedVN,deletedFN,val); + Log(GLLogStream::FILTER,"Deleted %i vertices and %i faces with a quality lower than %f", deletedVN,deletedFN,val); }break; case FP_ALIGN_WITH_PICKED_POINTS: @@ -317,7 +317,7 @@ bool CleanFilter::applyFilter(QAction *filter, MeshModel &m, FilterParameterSet bool result = AlignTools::setupThenAlign(m, par); if(!result) { - Log(GLLogStream::Info,"Align failed, make sure you have equal numbers of points."); + Log(GLLogStream::WARNING,"Align failed, make sure you have equal numbers of points."); return false; } }break;