From 6bba6520f16df9f7b10a73c6123b41cf14ce7af6 Mon Sep 17 00:00:00 2001 From: Kenneth Vanhoey Date: Tue, 22 Mar 2011 11:25:28 +0100 Subject: [PATCH] correction sur vector.normalize() --> division par zero --- include/Algo/Decimation/geometryApproximator.hpp | 6 ------ include/Geometry/vector_gen.hpp | 7 +++---- include/Utils/quadricRGBfunctions.hpp | 2 +- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/include/Algo/Decimation/geometryApproximator.hpp b/include/Algo/Decimation/geometryApproximator.hpp index 3b5fe234..ad819a88 100644 --- a/include/Algo/Decimation/geometryApproximator.hpp +++ b/include/Algo/Decimation/geometryApproximator.hpp @@ -166,12 +166,6 @@ void Approximator_QEMhalfEdge::approximate(Dart d) this->m_approx[d] = this->m_attrV[d] ; else this->m_approx[d] = res ; - - if (isnan((res[0]))) { - std::cout << "res(" << opt << ") = " << this->m_approx[d] << std::endl ; - std::cout << q1 << std::endl ; - std::cout << q2 << std::endl ; - } } /************************************************************************************ diff --git a/include/Geometry/vector_gen.hpp b/include/Geometry/vector_gen.hpp index 5c52a8ca..c4811b50 100644 --- a/include/Geometry/vector_gen.hpp +++ b/include/Geometry/vector_gen.hpp @@ -242,10 +242,9 @@ template inline double Vector::normalize() { double n = norm() ; - if(n==T(0.0)) - n = T(0.0001) ; - for(unsigned int i = 0; i < DIM; ++i) - m_data[i] /= T(n) ; + if(n != T(0.0)) + for(unsigned int i = 0; i < DIM; ++i) + m_data[i] /= T(n) ; return n ; } diff --git a/include/Utils/quadricRGBfunctions.hpp b/include/Utils/quadricRGBfunctions.hpp index 64b0d502..52a69bab 100644 --- a/include/Utils/quadricRGBfunctions.hpp +++ b/include/Utils/quadricRGBfunctions.hpp @@ -358,8 +358,8 @@ void QuadricRGBfunctions::buildRotateMatrix(MATRIX66 &N, const REAL gamma) N(3,1) = REAL(0); N(3,2) = REAL(0); N(3,3) = cosinus; - N(3,5) = REAL(0); N(3,4) = sinus; + N(3,5) = REAL(0); N(4,0) = REAL(0); N(4,1) = REAL(0); -- GitLab