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.