diff --git a/vcg/complex/algorithms/update/quality.h b/vcg/complex/algorithms/update/quality.h index 504c0089..05327364 100644 --- a/vcg/complex/algorithms/update/quality.h +++ b/vcg/complex/algorithms/update/quality.h @@ -226,6 +226,67 @@ static void VertexFromMeanCurvatureDir(MeshType &m) for(VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi) if(!(*vi).IsD()) (*vi).Q() = ((*vi).K1()+(*vi).K2())/2.0f; } +static void VertexFromMinCurvatureDir(MeshType &m) +{ + tri::RequirePerVertexQuality(m); + tri::RequirePerVertexCurvatureDir(m); + for(VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi) if(!(*vi).IsD()) + (*vi).Q() = (*vi).K1(); +} +static void VertexFromMaxCurvatureDir(MeshType &m) +{ + tri::RequirePerVertexQuality(m); + tri::RequirePerVertexCurvatureDir(m); + for(VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi) if(!(*vi).IsD()) + (*vi).Q() = (*vi).K2(); +} + +/** + * @brief VertexFromShapeIndexCurvatureDir + * Compute from the current Curvature Direction the Shape Index S as defined by [Koenderink 1992] + * and store it in the per-vertex Quality. + * S = 2/pi atan(k1+k2/k1-k2) + * + * J. Koenderink and A. van Doorn. + * Surface shape and curvature scales. + * Image and vision computing, 10(8):557–565, 1992. + */ + +static void VertexFromShapeIndexCurvatureDir(MeshType &m) +{ + tri::RequirePerVertexQuality(m); + tri::RequirePerVertexCurvatureDir(m); + for(VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi) if(!(*vi).IsD()) + { + ScalarType k1=(*vi).K1(); + ScalarType k2=(*vi).K2(); + if(k1