From c0bc2364824ab18b6b5b847e1fcc20c26b1f0739 Mon Sep 17 00:00:00 2001 From: nicopietroni Date: Mon, 23 Nov 2015 23:40:47 +0000 Subject: [PATCH] added PerEdgeQualityRamp function --- vcg/complex/algorithms/update/color.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/vcg/complex/algorithms/update/color.h b/vcg/complex/algorithms/update/color.h index 3b00ff8e..e2ed646c 100644 --- a/vcg/complex/algorithms/update/color.h +++ b/vcg/complex/algorithms/update/color.h @@ -59,6 +59,8 @@ public: typedef typename MeshType::FaceType FaceType; typedef typename MeshType::FacePointer FacePointer; typedef typename MeshType::FaceIterator FaceIterator; + typedef typename MeshType::EdgeIterator EdgeIterator; + typedef typename MeshType::ScalarType ScalarType; typedef typename MeshType::CoordType CoordType; @@ -202,6 +204,26 @@ public: (*fi).C().SetColorRamp(minq,maxq,(*fi).Q()); } + /*! \brief This function colores all the edges of a mesh with a hue color shade dependent on the quality. + + If no range of quality is passed it is automatically computed. + */ + static void PerEdgeQualityRamp(MeshType &m, float minq=0, float maxq=0, bool selected=false) + { + RequirePerEdgeColor(m); + RequirePerEdgeQuality(m); + + if(minq==maxq) + { + std::pair minmax = Stat::ComputePerEdgeQualityMinMax(m); + minq=minmax.first; + maxq=minmax.second; + } + for(EdgeIterator ei=m.edge.begin();ei!=m.edge.end();++ei) if(!(*ei).IsD()) + if(!selected || (*ei).IsS()) + (*ei).C().SetColorRamp(minq,maxq,(*ei).Q()); + } + /*! \brief This function colores all the vertices of a mesh with a gray shade dependent on the quality. If no range of quality is passed it is automatically computed.