Added area weighting counting to for vertex/face quality Histogram dumping filters

This commit is contained in:
Paolo Cignoni cignoni 2014-11-13 22:46:52 +00:00
parent 2e4b9cb198
commit 68abf6dc46
2 changed files with 76 additions and 66 deletions

View File

@ -31,6 +31,7 @@
#include<vcg/complex/append.h>
#include<vcg/simplex/face/pos.h>
#include<vcg/complex/algorithms/bitquad_support.h>
#include<vcg/complex/algorithms/mesh_to_matrix.h>
#include<vcg/complex/algorithms/bitquad_optimization.h>
#include "filter_measure.h"
@ -242,27 +243,29 @@ bool FilterMeasurePlugin::applyFilter( const QString& filterName,MeshDocument& m
if((filterName == "Per Vertex Quality Histogram") || (filterName == "Per Face Quality Histogram") )
{
CMeshO &m=md.mm()->cm;
tri::Allocator<CMeshO>::CompactEveryVector(m);
float RangeMin = env.evalFloat("HistMin");
float RangeMax = env.evalFloat("HistMax");
int binNum = env.evalInt("binNum");
bool areaFlag = env.evalBool("areaWeighted");
Histogramf H;
H.SetRange(RangeMin,RangeMax,binNum);
if(filterName == "Per Vertex Quality Histogram")
{
for(CMeshO::VertexIterator vi = m.vert.begin(); vi != m.vert.end(); ++vi)
if(!(*vi).IsD())
{
assert(!math::IsNAN((*vi).Q()) && "You should never try to compute Histogram with Invalid Floating points numbers (NaN)");
H.Add((*vi).Q());
}
vector<Scalarm> aVec(m.vn,1.0);
if(areaFlag)
tri::MeshToMatrix<CMeshO>::PerVertexArea(m,aVec);
for(size_t i=0;i<m.vn;++i)
H.Add(m.vert[i].Q(), aVec[i]);
}else{
for(CMeshO::FaceIterator fi = m.face.begin(); fi != m.face.end(); ++fi)
if(!(*fi).IsD())
{
assert(!math::IsNAN((*fi).Q()) && "You should never try to compute Histogram with Invalid Floating points numbers (NaN)");
H.Add((*fi).Q());
}
vector<Scalarm> aVec(m.fn,1.0);
if(areaFlag)
tri::MeshToMatrix<CMeshO>::PerFaceArea(m,aVec);
for(size_t i=0;i<m.fn;++i)
H.Add(m.face[i].Q(),aVec[i]);
}
Log("( -inf..%15.7f) : %4.0f",RangeMin,H.BinCountInd(0));
for(int i=1;i<=binNum;++i)

View File

@ -1,56 +1,63 @@
<MESHLAB_FILTER_INTERFACE mfiVersion="2.0">
<PLUGIN pluginName="FilterMeasure" pluginAuthor="Guido Ranzuglia" pluginEmail="guido.ranzuglia@isti.cnr.it">
<FILTER filterName="Compute Topological Measures" filterFunction="computeTopoMeasure" filterClass="Measure" filterPre="MM_NONE" filterPost="MM_NONE" filterArity="SingleMesh" filterRasterArity="NoRaster" filterIsInterruptible="false">
<FILTER_HELP><![CDATA[Compute a set of topological measures over a mesh.]]></FILTER_HELP>
<FILTER_JSCODE><![CDATA[]]></FILTER_JSCODE>
</FILTER>
<FILTER filterName="Compute Topological Measures for Quad Meshes" filterFunction="computeTopoMeasureQuad" filterClass="Measure" filterPre="MM_NONE" filterPost="MM_NONE" filterArity="SingleMesh" filterRasterArity="NoRaster" filterIsInterruptible="false">
<FILTER_HELP><![CDATA[Compute a set of geometric measures over a mesh.]]></FILTER_HELP>
<FILTER_JSCODE><![CDATA[]]></FILTER_JSCODE>
</FILTER>
<FILTER filterName="Compute Geometric Measures" filterFunction="computeGeomMeasure" filterClass="Measure" filterPre="MM_NONE" filterPost="MM_NONE" filterArity="SingleMesh" filterRasterArity="NoRaster" filterIsInterruptible="false">
<FILTER_HELP><![CDATA[Compute a set of geometric measures over a mesh.It computes: bounding box volume and diagonal, surface area, thin shell barycenter, and an Inertia Matrix.Open the layer dialog to see the results.]]></FILTER_HELP>
<FILTER_JSCODE><![CDATA[]]></FILTER_JSCODE>
</FILTER>
<FILTER filterName="Per Vertex Quality Stat" filterFunction="computeVertQualityStat" filterClass="Measure" filterPre="MM_VERTQUALITY" filterPost="MM_NONE" filterArity="SingleMesh" filterRasterArity="NoRaster" filterIsInterruptible="false">
<FILTER_HELP><![CDATA[Compute some aggregate statistics over the per vertex quality, like Min, Max, Average, StdDev and Variance.]]></FILTER_HELP>
<FILTER_JSCODE><![CDATA[]]></FILTER_JSCODE>
</FILTER>
<FILTER filterName="Per Face Quality Stat" filterFunction="computeFaceQualityStat" filterClass="Measure" filterPre="MM_FACEQUALITY" filterPost="MM_NONE" filterArity="SingleMesh" filterRasterArity="NoRaster" filterIsInterruptible="false">
<FILTER_HELP><![CDATA[Compute some aggregate statistics over the per vertex quality, like Min, Max, Average, StdDev and Variance.]]></FILTER_HELP>
<FILTER_JSCODE><![CDATA[]]></FILTER_JSCODE>
</FILTER>
<FILTER filterName="Per Vertex Quality Histogram" filterFunction="computeVertQualityHistogram" filterClass="Measure" filterPre="MM_VERTQUALITY" filterPost="MM_NONE" filterArity="SingleMesh" filterRasterArity="NoRaster" filterIsInterruptible="false">
<FILTER_HELP><![CDATA[Compute an histogram of the values of the per-vertex quality.]]></FILTER_HELP>
<FILTER_JSCODE><![CDATA[]]></FILTER_JSCODE>
<PARAM parType="Real" parName="HistMin" parDefault="meshDoc.current().computeMinVQ()" parIsImportant="true">
<PARAM_HELP><![CDATA[The vertex are displaced of a vector whose norm is bounded by this value]]></PARAM_HELP>
<EDIT_GUI guiLabel="Hist Min" />
</PARAM>
<PARAM parType="Real" parName="HistMax" parDefault="meshDoc.current().computeMaxVQ()" parIsImportant="true">
<PARAM_HELP><![CDATA[The vertex are displaced of a vector whose norm is bounded by this value]]></PARAM_HELP>
<EDIT_GUI guiLabel="Hist Max" />
</PARAM>
<PARAM parType="Int" parName="binNum" parDefault="20" parIsImportant="false">
<PARAM_HELP><![CDATA[The number of bins of the histogram. E.g. the number of intervals in which the min..max range is subdivided into.]]></PARAM_HELP>
<EDIT_GUI guiLabel="Bin number" />
</PARAM>
</FILTER>
<FILTER filterName="Per Face Quality Histogram" filterFunction="computeFaceQualityHistogram" filterClass="Measure" filterPre="MM_FACEQUALITY" filterPost="MM_NONE" filterArity="SingleMesh" filterRasterArity="NoRaster" filterIsInterruptible="false">
<FILTER_HELP><![CDATA[Compute an histogram of the values of the per-vertex quality.]]></FILTER_HELP>
<FILTER_JSCODE><![CDATA[]]></FILTER_JSCODE>
<PARAM parType="Real" parName="HistMin" parDefault="meshDoc.current().computeMinFQ()" parIsImportant="true">
<PARAM_HELP><![CDATA[The vertex are displaced of a vector whose norm is bounded by this value]]></PARAM_HELP>
<EDIT_GUI guiLabel="Hist Min" />
</PARAM>
<PARAM parType="Real" parName="HistMax" parDefault="meshDoc.current().computeMaxFQ()" parIsImportant="true">
<PARAM_HELP><![CDATA[The vertex are displaced of a vector whose norm is bounded by this value]]></PARAM_HELP>
<EDIT_GUI guiLabel="Hist Max" />
</PARAM>
<PARAM parType="Int" parName="binNum" parDefault="20" parIsImportant="true">
<PARAM_HELP><![CDATA[The number of bins of the histogram. E.g. the number of intervals in which the min..max range is subdivided into.]]></PARAM_HELP>
<EDIT_GUI guiLabel="Bin number" />
</PARAM>
</FILTER>
</PLUGIN>
<PLUGIN pluginName="FilterMeasure" pluginAuthor="Guido Ranzuglia" pluginEmail="guido.ranzuglia@isti.cnr.it">
<FILTER filterName="Compute Topological Measures" filterFunction="computeTopoMeasure" filterClass="Measure" filterPre="MM_NONE" filterPost="MM_NONE" filterArity="SingleMesh" filterRasterArity="NoRaster" filterIsInterruptible="false">
<FILTER_HELP><![CDATA[Compute a set of topological measures over a mesh.]]></FILTER_HELP>
<FILTER_JSCODE><![CDATA[]]></FILTER_JSCODE>
</FILTER>
<FILTER filterName="Compute Topological Measures for Quad Meshes" filterFunction="computeTopoMeasureQuad" filterClass="Measure" filterPre="MM_NONE" filterPost="MM_NONE" filterArity="SingleMesh" filterRasterArity="NoRaster" filterIsInterruptible="false">
<FILTER_HELP><![CDATA[Compute a set of geometric measures over a mesh.]]></FILTER_HELP>
<FILTER_JSCODE><![CDATA[]]></FILTER_JSCODE>
</FILTER>
<FILTER filterName="Compute Geometric Measures" filterFunction="computeGeomMeasure" filterClass="Measure" filterPre="MM_NONE" filterPost="MM_NONE" filterArity="SingleMesh" filterRasterArity="NoRaster" filterIsInterruptible="false">
<FILTER_HELP><![CDATA[Compute a set of geometric measures over a mesh.It computes: bounding box volume and diagonal, surface area, thin shell barycenter, and an Inertia Matrix.Open the layer dialog to see the results.]]></FILTER_HELP>
<FILTER_JSCODE><![CDATA[]]></FILTER_JSCODE>
</FILTER>
<FILTER filterName="Per Vertex Quality Stat" filterFunction="computeVertQualityStat" filterClass="Measure" filterPre="MM_VERTQUALITY" filterPost="MM_NONE" filterArity="SingleMesh" filterRasterArity="NoRaster" filterIsInterruptible="false">
<FILTER_HELP><![CDATA[Compute some aggregate statistics over the per vertex quality, like Min, Max, Average, StdDev and Variance.]]></FILTER_HELP>
<FILTER_JSCODE><![CDATA[]]></FILTER_JSCODE>
</FILTER>
<FILTER filterName="Per Face Quality Stat" filterFunction="computeFaceQualityStat" filterClass="Measure" filterPre="MM_FACEQUALITY" filterPost="MM_NONE" filterArity="SingleMesh" filterRasterArity="NoRaster" filterIsInterruptible="false">
<FILTER_HELP><![CDATA[Compute some aggregate statistics over the per vertex quality, like Min, Max, Average, StdDev and Variance.]]></FILTER_HELP>
<FILTER_JSCODE><![CDATA[]]></FILTER_JSCODE>
</FILTER>
<FILTER filterName="Per Vertex Quality Histogram" filterFunction="computeVertQualityHistogram" filterClass="Measure" filterPre="MM_VERTQUALITY" filterPost="MM_NONE" filterArity="SingleMesh" filterRasterArity="NoRaster" filterIsInterruptible="false">
<FILTER_HELP><![CDATA[Compute an histogram of the values of the per-vertex quality. It can be useful to evaluate the distribution of the quality value over the surface. It can be discrete (e.g. based on vertex count or area weighted).]]></FILTER_HELP>
<FILTER_JSCODE><![CDATA[]]></FILTER_JSCODE>
<PARAM parType="Real" parName="HistMin" parDefault="meshDoc.current().computeMinVQ()" parIsImportant="true">
<PARAM_HELP><![CDATA[The vertex are displaced of a vector whose norm is bounded by this value]]></PARAM_HELP>
<EDIT_GUI guiLabel="Hist Min" />
</PARAM>
<PARAM parType="Real" parName="HistMax" parDefault="meshDoc.current().computeMaxVQ()" parIsImportant="true">
<PARAM_HELP><![CDATA[The vertex are displaced of a vector whose norm is bounded by this value]]></PARAM_HELP>
<EDIT_GUI guiLabel="Hist Max" />
</PARAM>
<PARAM parName="areaWeighted" parIsImportant="true" parType="Boolean" parDefault="false">
<PARAM_HELP><![CDATA[If false, the histogram will report the number of vertices with quality values
falling in each bin of the histogram. If true each bin of the histogram will report the approximate area
of the mesh with that range of values. Area is computed by assigning to each vertex one third of the area
all the incident triangles.]]></PARAM_HELP>
<CHECKBOX_GUI guiLabel="Area Weighted"/>
</PARAM><PARAM parType="Int" parName="binNum" parDefault="20" parIsImportant="false">
<PARAM_HELP><![CDATA[The number of bins of the histogram. E.g. the number of intervals in which the min..max range is subdivided into.]]></PARAM_HELP>
<EDIT_GUI guiLabel="Bin number" />
</PARAM>
</FILTER>
<FILTER filterName="Per Face Quality Histogram" filterFunction="computeFaceQualityHistogram" filterClass="Measure" filterPre="MM_FACEQUALITY" filterPost="MM_NONE" filterArity="SingleMesh" filterRasterArity="NoRaster" filterIsInterruptible="false">
<FILTER_HELP><![CDATA[Compute an histogram of the values of the per-vertex quality.]]></FILTER_HELP>
<FILTER_JSCODE><![CDATA[]]></FILTER_JSCODE>
<PARAM parType="Real" parName="HistMin" parDefault="meshDoc.current().computeMinFQ()" parIsImportant="true">
<PARAM_HELP><![CDATA[The vertex are displaced of a vector whose norm is bounded by this value]]></PARAM_HELP>
<EDIT_GUI guiLabel="Hist Min" />
</PARAM>
<PARAM parType="Real" parName="HistMax" parDefault="meshDoc.current().computeMaxFQ()" parIsImportant="true">
<PARAM_HELP><![CDATA[The vertex are displaced of a vector whose norm is bounded by this value]]></PARAM_HELP>
<EDIT_GUI guiLabel="Hist Max" />
</PARAM>
<PARAM parType="Int" parName="binNum" parDefault="20" parIsImportant="true">
<PARAM_HELP><![CDATA[The number of bins of the histogram. E.g. the number of intervals in which the min..max range is subdivided into.]]></PARAM_HELP>
<EDIT_GUI guiLabel="Bin number" />
</PARAM>
</FILTER>
</PLUGIN>
</MESHLAB_FILTER_INTERFACE>