From 5b4357f9bb5d86aca552867b183abb953232c2f4 Mon Sep 17 00:00:00 2001 From: cignoni Date: Tue, 13 May 2014 10:55:53 +0000 Subject: [PATCH] Refactored the ComputeFaceEdgeLengthDistribution function. Now it collects info about the edges also complying fauxedges and polygonal meshes. --- vcg/complex/algorithms/stat.h | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/vcg/complex/algorithms/stat.h b/vcg/complex/algorithms/stat.h index bf10ea4e..c8e10da6 100644 --- a/vcg/complex/algorithms/stat.h +++ b/vcg/complex/algorithms/stat.h @@ -32,6 +32,7 @@ #include #include #include +#include namespace vcg { @@ -226,23 +227,14 @@ public: return h.Avg(); } - static void ComputeFaceEdgeLengthDistribution( MeshType & m, Distribution &h) + static void ComputeFaceEdgeLengthDistribution( MeshType & m, Distribution &h, bool includeFauxEdge=false) { - tri::RequireTriangularMesh(m); + std::vector< typename tri::UpdateTopology::PEdge > edgeVec; + tri::UpdateTopology::FillUniqueEdgeVector(m,edgeVec,includeFauxEdge); h.Clear(); tri::UpdateFlags::FaceBorderFromNone(m); - for(FaceIterator fi = m.face.begin(); fi != m.face.end(); ++fi) - { - if(!(*fi).IsD()) - { - for(int i=0;i<3;++i) - { - h.Add(Distance(fi->P0(i),fi->P1(i))); - if(fi->IsB(i)) // to be uniform border edges must be added twice... - h.Add(Distance(fi->P0(i),fi->P1(i))); - } - } - } + for(size_t i=0;iP(),edgeVec[i].v[1]->P())); } static ScalarType ComputeFaceEdgeLengthAverage(MeshType & m)