From 84913a7d54a63725c94c2bd03b912fbe03be7d05 Mon Sep 17 00:00:00 2001 From: nico Date: Mon, 23 Jan 2017 16:24:29 +0100 Subject: [PATCH] added expectedValence function and solved minor bugs --- .../parametrization/tangent_field_operators.h | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/vcg/complex/algorithms/parametrization/tangent_field_operators.h b/vcg/complex/algorithms/parametrization/tangent_field_operators.h index 3da1a33a..2f035ea4 100644 --- a/vcg/complex/algorithms/parametrization/tangent_field_operators.h +++ b/vcg/complex/algorithms/parametrization/tangent_field_operators.h @@ -1289,6 +1289,13 @@ public: } } + static bool IsSingular(MeshType &mesh,const VertexType &v) + { + assert(vcg::tri::HasPerVertexAttribute(mesh,std::string("Singular"))); + typename MeshType::template PerVertexAttributeHandle Handle_Singular; + Handle_Singular = vcg::tri::Allocator::template GetPerVertexAttribute(mesh,std::string("Singular")); + return (Handle_Singular[v]); + } static void GradientToCross(const FaceType &f, const vcg::Point2 &UV0, @@ -1514,6 +1521,31 @@ public: OrientDirectionFaceCoherently(mesh); } + static size_t expectedValence(MeshType &mesh, + const VertexType &v) { + + // query if an attribute is present or not + assert(vcg::tri::HasPerVertexAttribute(mesh,std::string("Singular"))); + assert(vcg::tri::HasPerVertexAttribute(mesh,std::string("SingularIndex"))); + typename MeshType::template PerVertexAttributeHandle Handle_Singular; + Handle_Singular = vcg::tri::Allocator::template GetPerVertexAttribute(mesh,std::string("Singular")); + typename MeshType::template PerVertexAttributeHandle Handle_SingularIndex; + Handle_SingularIndex = vcg::tri::Allocator::template GetPerVertexAttribute(mesh,std::string("SingularIndex")); + if (!Handle_Singular[v]) + return 4; + switch (Handle_SingularIndex[v]) { + case 1: + return 5; + case 2: + return 6; + case 3: + return 3; + case 4: + return 2; + default: + return 4; + } + } };///end class } //End Namespace Tri } // End Namespace vcg