From 33f4941d66f0991c5cf7a6e860e3e108795868a0 Mon Sep 17 00:00:00 2001 From: Max Lyon Date: Fri, 6 Dec 2019 11:16:54 +0100 Subject: [PATCH] normalize normal at end of calc_vertex_normal_correct --- src/OpenMesh/Core/Mesh/PolyMeshT_impl.hh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/OpenMesh/Core/Mesh/PolyMeshT_impl.hh b/src/OpenMesh/Core/Mesh/PolyMeshT_impl.hh index e25fe37b..dabdacfe 100644 --- a/src/OpenMesh/Core/Mesh/PolyMeshT_impl.hh +++ b/src/OpenMesh/Core/Mesh/PolyMeshT_impl.hh @@ -505,6 +505,9 @@ calc_vertex_normal_correct(VertexHandle _vh, Normal& _n) const in_he_vec = out_he_vec; in_he_vec *= -1;//change the orientation } + Scalar length = norm(_n); + if (length != 0.0) + _n *= (Scalar(1.0)/length); } //-----------------------------------------------------------------------------