From bdd25079acd48ffee6617fb6b5dcdc7afeae6b86 Mon Sep 17 00:00:00 2001 From: Paolo Cignoni Date: Sun, 29 Jan 2017 18:20:00 +0100 Subject: [PATCH] Added evaluation of Koenderink's Shape Index and Curvedness from curvature --- vcg/complex/algorithms/update/quality.h | 61 +++++++++++++++++++++++++ 1 file changed, 61 insertions(+) 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