From 48c2a09db87ff1a5704d76cd0d2767f6eae5fbaa Mon Sep 17 00:00:00 2001 From: Pierre Kraemer Date: Mon, 7 Mar 2011 09:06:34 +0100 Subject: [PATCH] pliant remeshing v1 ok --- Apps/Examples/miniTest.cpp | 25 +++++++++++++++++++++++++ include/Algo/Geometry/normal.hpp | 4 ++-- include/Geometry/vector_gen.hpp | 2 +- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/Apps/Examples/miniTest.cpp b/Apps/Examples/miniTest.cpp index fabf2abf5..d7d47d98e 100644 --- a/Apps/Examples/miniTest.cpp +++ b/Apps/Examples/miniTest.cpp @@ -668,6 +668,31 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y) break ; } + case '0': + { + + GLint t1 = glutGet(GLUT_ELAPSED_TIME) ; + + Algo::Modelisation::reverseOrientation(myMap) ; + + GLint t2 = glutGet(GLUT_ELAPSED_TIME) ; + GLfloat seconds = (t2 - t1) / 1000.0f ; + std::cout << "pliant remeshing: "<< seconds << "sec" << std::endl ; + + t1 = glutGet(GLUT_ELAPSED_TIME) ; + + updateVBOprimitives(Algo::Render::VBO::TRIANGLES | Algo::Render::VBO::LINES | Algo::Render::VBO::POINTS) ; + updateVBOdata(Algo::Render::VBO::POSITIONS | Algo::Render::VBO::NORMALS) ; + topo_render->updateData(myMap, position, 0.9f, 0.9f) ; + + t2 = glutGet(GLUT_ELAPSED_TIME) ; + seconds = (t2 - t1) / 1000.0f ; + std::cout << "display update: "<< seconds << "sec" << std::endl ; + + glutPostRedisplay() ; + break ; + } + case '9': { CellMarker markVisit(myMap, VERTEX_CELL) ; diff --git a/include/Algo/Geometry/normal.hpp b/include/Algo/Geometry/normal.hpp index e2f340d26..816172d21 100644 --- a/include/Algo/Geometry/normal.hpp +++ b/include/Algo/Geometry/normal.hpp @@ -64,8 +64,8 @@ typename PFP::VEC3 faceNormal(typename PFP::MAP& map, Dart d, const typename PFP do { VEC3 n = triangleNormal(map, it, position) ; - //if(!std::isnan(n[0])) - if (n[0] == n[0]) + //if(!std::isnan(n[0]) && !std::isnan(n[1]) && !std::isnan(n[2])) + if (n[0] == n[0] && n[1] == n[1] && n[2] == n[2]) N += n ; it = map.phi1(it) ; } while (it != d) ; diff --git a/include/Geometry/vector_gen.hpp b/include/Geometry/vector_gen.hpp index db3de8774..fa89bb317 100644 --- a/include/Geometry/vector_gen.hpp +++ b/include/Geometry/vector_gen.hpp @@ -280,7 +280,7 @@ template inline bool Vector::hasNan() const { for(unsigned int i = 0 ; i < DIM ; ++i) - if(isnan(m_data[i])) + if(m_data[i] != m_data[i]) return true ; return false ; } -- GitLab