diff --git a/vcg/complex/algorithms/update/quality.h b/vcg/complex/algorithms/update/quality.h index 51d27c94..9df78464 100644 --- a/vcg/complex/algorithms/update/quality.h +++ b/vcg/complex/algorithms/update/quality.h @@ -70,17 +70,18 @@ static void VertexConstant(MeshType &m, VertexQualityType q) */ static void VertexValence(UpdateMeshType &m) { - VertexConstant(m,0); - for (size_t i=0;iQ()+=1; - } + VertexType *v=m.face[i].V(j); + v->Q()+=1; } + } } /** Clamp each vertex of the mesh with a range of values. @@ -164,6 +165,7 @@ static void VertexFromFace( MeshType &m, bool areaWeighted=true) template static void VertexFromAttributeHandle(MeshType &m, typename MeshType::template PerVertexAttributeHandle &h) { + tri::RequirePerVertexQuality(m); for(VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi) if(!(*vi).IsD()) (*vi).Q()=VertexQualityType(h[vi]); @@ -172,6 +174,7 @@ static void VertexFromAttributeHandle(MeshType &m, typename MeshType::template P template static void FaceFromAttributeHandle(MeshType &m, typename MeshType::template PerFaceAttributeHandle &h) { + tri::RequirePerFaceQuality(m); for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi) if(!(*fi).IsD()) (*fi).Q() =FaceQualityType(h[fi]); } @@ -191,6 +194,7 @@ static void FaceFromVertex( MeshType &m) static void VertexFromPlane(MeshType &m, const Plane3 &pl) { + tri::RequirePerVertexQuality(m); for(VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi) if(!(*vi).IsD()) (*vi).Q() =SignedDistancePlanePoint(pl,(*vi).cP()); } @@ -306,6 +310,8 @@ static void VertexFromCurvednessCurvatureDir(MeshType &m) static void VertexFromAbsoluteCurvature(MeshType &m) { + tri::RequirePerVertexQuality(m); + tri::RequirePerVertexCurvature(m); VertexIterator vi; for(vi=m.vert.begin();vi!=m.vert.end();++vi) if(!(*vi).IsD()) { @@ -325,6 +331,8 @@ static void VertexFromAbsoluteCurvature(MeshType &m) */ static void VertexFromRMSCurvature(MeshType &m) { + tri::RequirePerVertexQuality(m); + tri::RequirePerVertexCurvature(m); VertexIterator vi; for(vi=m.vert.begin();vi!=m.vert.end();++vi) if(!(*vi).IsD()) (*vi).Q() = math::Sqrt(math::Abs( 4*(*vi).Kh()*(*vi).Kh() - 2*(*vi).Kg())); @@ -338,6 +346,8 @@ static void VertexFromRMSCurvature(MeshType &m) */ static void FaceSaturate(MeshType &m, FaceQualityType gradientThr=1.0) { + tri::RequirePerFaceQuality(m); + tri::RequireFFAdjacency(m); UpdateFlags::FaceClearV(m); std::stack st; @@ -410,6 +420,9 @@ static void FaceSaturate(MeshType &m, FaceQualityType gradientThr=1.0) */ static void VertexSaturate(MeshType &m, ScalarType gradientThr=1.0) { + tri::RequirePerVertexQuality(m); + tri::RequireVFAdjacency(m); + UpdateFlags::VertexClearV(m); std::stack st;