From 1d7a803c8cb22fed0346044ec9978e359c7c9e3e Mon Sep 17 00:00:00 2001 From: Paolo Cignoni Date: Thu, 29 Nov 2018 00:46:25 +0100 Subject: [PATCH] Added another Preconditionchech in MeshAssert VertexNormal are Normalized --- vcg/complex/algorithms/mesh_assert.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/vcg/complex/algorithms/mesh_assert.h b/vcg/complex/algorithms/mesh_assert.h index ec63cd62..b61721e9 100644 --- a/vcg/complex/algorithms/mesh_assert.h +++ b/vcg/complex/algorithms/mesh_assert.h @@ -95,6 +95,18 @@ public: } } + /// \brief Throw vcg::MissingPreconditionException if Vertex Normals are not unit lenght + static void VertexNormalNormalized(MeshType &m) + { + for(VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi) if(!vi->IsD()) + { + if(fabs(vi->cN().Norm()-1.0)>0.000001) + throw vcg::MissingPreconditionException("Vertex Normal are not normalized"); + } + } + + + /// \brief Throw vcg::MissingPreconditionException if There are unreferenced vertices static void NoUnreferencedVertex(MeshType &m) {