Corrected small bug in the percentile filtering in the colorize by face quality

This commit is contained in:
Paolo Cignoni cignoni 2014-06-17 15:08:42 +00:00
parent cf2089d54c
commit 0d9fb776e9
2 changed files with 34 additions and 28 deletions

View File

@ -35,21 +35,21 @@ using namespace std;
using namespace vcg;
ExtraMeshColorizePlugin::ExtraMeshColorizePlugin() {
typeList <<
CP_CLAMP_QUALITY <<
CP_SATURATE_QUALITY <<
CP_MAP_VQUALITY_INTO_COLOR <<
CP_MAP_FQUALITY_INTO_COLOR <<
CP_DISCRETE_CURVATURE <<
CP_TRIANGLE_QUALITY <<
CP_VERTEX_SMOOTH <<
CP_FACE_SMOOTH <<
CP_MESH_TO_FACE <<
CP_VERTEX_TO_FACE <<
CP_FACE_TO_VERTEX <<
CP_TEXTURE_TO_VERTEX <<
CP_RANDOM_FACE <<
CP_RANDOM_CONNECTED_COMPONENT;
typeList <<
CP_CLAMP_QUALITY <<
CP_SATURATE_QUALITY <<
CP_MAP_VQUALITY_INTO_COLOR <<
CP_MAP_FQUALITY_INTO_COLOR <<
CP_DISCRETE_CURVATURE <<
CP_TRIANGLE_QUALITY <<
CP_VERTEX_SMOOTH <<
CP_FACE_SMOOTH <<
CP_MESH_TO_FACE <<
CP_VERTEX_TO_FACE <<
CP_FACE_TO_VERTEX <<
CP_TEXTURE_TO_VERTEX <<
CP_RANDOM_FACE <<
CP_RANDOM_CONNECTED_COMPONENT;
FilterIDType tt;
foreach(tt , types())
@ -219,6 +219,7 @@ break;
float RangeMin = par.getFloat("minVal");
float RangeMax = par.getFloat("maxVal");
float perc = par.getDynamicFloat("perc");
bool usePerc = perc>0;
Histogramf H;
tri::Stat<CMeshO>::ComputePerFaceQualityHistogram(m.cm,H);
@ -234,9 +235,14 @@ break;
PercHi = max(math::Abs(PercLo), PercHi);
}
tri::UpdateColor<CMeshO>::PerFaceQualityRamp(m.cm,PercLo,PercHi);
Log("Quality Range: %f %f; Used (%f %f) percentile (%f %f) ",
H.MinV(), H.MaxV(), PercLo, PercHi, perc, 100-perc);
if(usePerc){
tri::UpdateColor<CMeshO>::PerFaceQualityRamp(m.cm,PercLo,PercHi);
Log("Quality Range: %f %f; Used (%f %f) percentile (%f %f) ",
H.MinV(), H.MaxV(), PercLo, PercHi, perc, 100-perc);
} else {
tri::UpdateColor<CMeshO>::PerFaceQualityRamp(m.cm,RangeMin,RangeMax);
Log("Quality Range: %f %f; Used (%f %f)",H.MinV(),H.MaxV(),RangeMin,RangeMax);
}
break;
}

View File

@ -8,7 +8,7 @@
* \ *
* All rights reserved. *
* *
* This program is free software; you can redistribute it and/or modify *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
@ -30,7 +30,7 @@
class ExtraMeshColorizePlugin : public QObject, public MeshFilterInterface
{
Q_OBJECT
MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID)
MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID)
Q_INTERFACES(MeshFilterInterface)
public:
@ -45,7 +45,7 @@ public:
CP_VERTEX_SMOOTH,
CP_FACE_SMOOTH,
CP_FACE_TO_VERTEX,
CP_TEXTURE_TO_VERTEX,
CP_TEXTURE_TO_VERTEX,
CP_VERTEX_TO_FACE,
CP_MESH_TO_FACE,
CP_COLOR_NON_TOPO_COHERENT,
@ -53,18 +53,18 @@ public:
CP_RANDOM_CONNECTED_COMPONENT
};
ExtraMeshColorizePlugin();
~ExtraMeshColorizePlugin(){}
QString filterName(FilterIDType filter) const;
QString filterInfo(FilterIDType filterId) const;
int getPreConditions(QAction *) const;
int postCondition( QAction* ) const;
FilterClass getClass(QAction *);
void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterSet & /*parent*/);
bool applyFilter(QAction *filter, MeshDocument &md, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
int getPreConditions(QAction *) const;
int postCondition( QAction* ) const;
FilterClass getClass(QAction *);
void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterSet & /*parent*/);
bool applyFilter(QAction *filter, MeshDocument &md, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
};
#endif