From de8504ba3ea6995b96f2ce07ac87d0984e404f6b Mon Sep 17 00:00:00 2001 From: cignoni Date: Tue, 14 Oct 2008 06:36:25 +0000 Subject: [PATCH] Added ComputePerFaceQualityMinMax() --- vcg/complex/trimesh/stat.h | 62 +++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/vcg/complex/trimesh/stat.h b/vcg/complex/trimesh/stat.h index ab1111d3..2d12d3c9 100644 --- a/vcg/complex/trimesh/stat.h +++ b/vcg/complex/trimesh/stat.h @@ -56,31 +56,45 @@ template class Stat { public: - typedef StatMeshType MeshType; - typedef typename MeshType::VertexType VertexType; - typedef typename MeshType::VertexPointer VertexPointer; - typedef typename MeshType::VertexIterator VertexIterator; - typedef typename MeshType::ScalarType ScalarType; - typedef typename MeshType::FaceType FaceType; - typedef typename MeshType::FacePointer FacePointer; - typedef typename MeshType::FaceIterator FaceIterator; - typedef typename MeshType::FaceContainer FaceContainer; - typedef typename vcg::Box3 Box3Type; - - static std::pair ComputePerVertexQualityMinMax( MeshType & m) // V1.0 - { - std::pair minmax = std::make_pair(std::numeric_limits::max(),-std::numeric_limits::max()); - - VertexIterator vi; - for(vi = m.vert.begin(); vi != m.vert.end(); ++vi) - if(!(*vi).IsD()) - { - if( (*vi).Q() < minmax.first) minmax.first=(*vi).Q(); - if( (*vi).Q() > minmax.second) minmax.second=(*vi).Q(); - } - return minmax; - } + typedef StatMeshType MeshType; + typedef typename MeshType::VertexType VertexType; + typedef typename MeshType::VertexPointer VertexPointer; + typedef typename MeshType::VertexIterator VertexIterator; + typedef typename MeshType::ScalarType ScalarType; + typedef typename MeshType::FaceType FaceType; + typedef typename MeshType::FacePointer FacePointer; + typedef typename MeshType::FaceIterator FaceIterator; + typedef typename MeshType::FaceContainer FaceContainer; + typedef typename vcg::Box3 Box3Type; + + static std::pair ComputePerVertexQualityMinMax( MeshType & m) // V1.0 + { + std::pair minmax = std::make_pair(std::numeric_limits::max(),-std::numeric_limits::max()); + + VertexIterator vi; + for(vi = m.vert.begin(); vi != m.vert.end(); ++vi) + if(!(*vi).IsD()) + { + if( (*vi).Q() < minmax.first) minmax.first=(*vi).Q(); + if( (*vi).Q() > minmax.second) minmax.second=(*vi).Q(); + } + return minmax; + } + static std::pair ComputePerFaceQualityMinMax( MeshType & m) // V1.0 + { + std::pair minmax = std::make_pair(std::numeric_limits::max(),-std::numeric_limits::max()); + + FaceIterator fi; + for(fi = m.face.begin(); fi != m.face.end(); ++fi) + if(!(*fi).IsD()) + { + if( (*fi).Q() < minmax.first) minmax.first =(*fi).Q(); + if( (*fi).Q() > minmax.second) minmax.second=(*fi).Q(); + } + return minmax; + } + static ScalarType ComputeMeshArea(MeshType & m) { ScalarType area=0;