From 68abf6dc46372aa39a2fc2a337193b3f7ebe6b0f Mon Sep 17 00:00:00 2001 From: Paolo Cignoni cignoni Date: Thu, 13 Nov 2014 22:46:52 +0000 Subject: [PATCH] Added area weighting counting to for vertex/face quality Histogram dumping filters --- .../filter_measure/filter_measure.cpp | 27 ++-- .../filter_measure/filter_measure.xml | 115 ++++++++++-------- 2 files changed, 76 insertions(+), 66 deletions(-) diff --git a/src/meshlabplugins/filter_measure/filter_measure.cpp b/src/meshlabplugins/filter_measure/filter_measure.cpp index ed78b6ab5..4cd091b79 100644 --- a/src/meshlabplugins/filter_measure/filter_measure.cpp +++ b/src/meshlabplugins/filter_measure/filter_measure.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #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::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 aVec(m.vn,1.0); + if(areaFlag) + tri::MeshToMatrix::PerVertexArea(m,aVec); + + for(size_t i=0;i aVec(m.fn,1.0); + if(areaFlag) + tri::MeshToMatrix::PerFaceArea(m,aVec); + + for(size_t i=0;i - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +