diff --git a/src/meshlabplugins/filter_colorize/meshcolorize.cpp b/src/meshlabplugins/filter_colorize/meshcolorize.cpp index 5235871d1..d1c7e9da3 100644 --- a/src/meshlabplugins/filter_colorize/meshcolorize.cpp +++ b/src/meshlabplugins/filter_colorize/meshcolorize.cpp @@ -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::ComputePerFaceQualityHistogram(m.cm,H); @@ -234,9 +235,14 @@ break; PercHi = max(math::Abs(PercLo), PercHi); } - tri::UpdateColor::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::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::PerFaceQualityRamp(m.cm,RangeMin,RangeMax); + Log("Quality Range: %f %f; Used (%f %f)",H.MinV(),H.MaxV(),RangeMin,RangeMax); + } break; } diff --git a/src/meshlabplugins/filter_colorize/meshcolorize.h b/src/meshlabplugins/filter_colorize/meshcolorize.h index 23184e5fa..6924f1bab 100644 --- a/src/meshlabplugins/filter_colorize/meshcolorize.h +++ b/src/meshlabplugins/filter_colorize/meshcolorize.h @@ -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