From 6e2ced74597b95f09a92305ab7591c5be8d15d5b Mon Sep 17 00:00:00 2001 From: Paolo Cignoni Date: Sun, 29 Jan 2017 18:22:02 +0100 Subject: [PATCH] evaluation of Koenderink's Shape Index and Curvedness from curvature As requested in issue #65 --- .../filter_meshing/meshfilter.cpp | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/meshlabplugins/filter_meshing/meshfilter.cpp b/src/meshlabplugins/filter_meshing/meshfilter.cpp index fd234ebca..54ac74cb7 100644 --- a/src/meshlabplugins/filter_meshing/meshfilter.cpp +++ b/src/meshlabplugins/filter_meshing/meshfilter.cpp @@ -338,18 +338,20 @@ QString ExtraMeshFilterPlugin::filterInfo(FilterIDType filterID) const void ExtraMeshFilterPlugin::initParameterSet(QAction * action, MeshModel & m, RichParameterSet & parlst) { float maxVal; - QStringList methods; + QStringList curvCalcMethods; + QStringList curvColorMethods; QStringList loopWeightLst; switch(ID(action)) { case FP_COMPUTE_PRINC_CURV_DIR: - methods.push_back("Taubin approximation"); - methods.push_back("Principal Component Analysis"); - methods.push_back("Normal Cycles"); - methods.push_back("Pseudoinverse Quadric Fitting"); - parlst.addParam(new RichEnum("Method", 3, methods, tr("Method:"), tr("Choose a method"))); - parlst.addParam(new RichEnum("CurvatureType", 0, QStringList()<<"Mean Curvature"<<"Gaussian Curvature"<<"None", tr("Color Mapping"), QString("Choose the curvature that is mapped into quality and visualized as per vertex color."))); + curvCalcMethods.push_back("Taubin approximation"); + curvCalcMethods.push_back("Principal Component Analysis"); + curvCalcMethods.push_back("Normal Cycles"); + curvCalcMethods.push_back("Pseudoinverse Quadric Fitting"); + curvColorMethods << "Mean Curvature"<<"Gaussian Curvature"<<"Min Curvature"<<"Max Curvature" << "Shape Index"<< "CurvedNess" <<"None"; + parlst.addParam(new RichEnum("Method", 3, curvCalcMethods, tr("Method:"), tr("Choose a method"))); + parlst.addParam(new RichEnum("CurvColorMethod", 0, curvColorMethods, tr("Quality/Color Mapping"), QString("Choose the curvature that is mapped into quality and visualized as per vertex color."))); parlst.addParam(new RichBool("Autoclean",true,"Remove Unreferenced Vertices","If selected, before starting the filter will remove anyy unreference vertex (for which curvature values are not defined)")); break; @@ -1237,17 +1239,20 @@ switch(ID(filter)) case 3: tri::UpdateCurvatureFitting::computeCurvature(m.cm); break; default:assert(0);break; } - switch(par.getEnum("CurvatureType")) + switch(par.getEnum("CurvColorMethod")) { case 0: tri::UpdateQuality::VertexFromMeanCurvatureDir (m.cm); break; case 1: tri::UpdateQuality::VertexFromGaussianCurvatureDir(m.cm); break; - case 2: tri::UpdateQuality::VertexFromGaussianCurvatureDir(m.cm); break; + case 2: tri::UpdateQuality::VertexFromMinCurvatureDir(m.cm); break; + case 3: tri::UpdateQuality::VertexFromMaxCurvatureDir(m.cm); break; + case 4: tri::UpdateQuality::VertexFromShapeIndexCurvatureDir(m.cm); break; + case 5: tri::UpdateQuality::VertexFromCurvednessCurvatureDir(m.cm); break; + case 6: tri::UpdateQuality::VertexConstant(m.cm,0); break; } Histogramf H; tri::Stat::ComputePerVertexQualityHistogram(m.cm,H); - if(par.getEnum("CurvatureType")!=2) - tri::UpdateColor::PerVertexQualityRamp(m.cm,H.Percentile(0.1f),H.Percentile(0.9f)); + tri::UpdateColor::PerVertexQualityRamp(m.cm,H.Percentile(0.1f),H.Percentile(0.9f)); Log( "Curvature Range: %f %f (Used 90 percentile %f %f) ",H.MinV(),H.MaxV(),H.Percentile(0.1f),H.Percentile(0.9f)); } break;