From be92e128c304e63a7146ffd7f4816f73e67321ef Mon Sep 17 00:00:00 2001 From: Pierre Kraemer Date: Fri, 25 Feb 2011 17:31:44 +0100 Subject: [PATCH] debut pliant remeshing.. --- Apps/Examples/miniTest.cpp | 28 ++++++++++++++++++++++-- include/Algo/Geometry/area.h | 6 ++--- include/Algo/Geometry/basic.h | 16 +++++++++----- include/Algo/Modelisation/extrusion.h | 8 ++++--- include/Algo/Parallel/parallel_foreach.h | 11 +++------- include/Geometry/basic.hpp | 1 - 6 files changed, 48 insertions(+), 22 deletions(-) diff --git a/Apps/Examples/miniTest.cpp b/Apps/Examples/miniTest.cpp index d6a7d50d..887d669d 100644 --- a/Apps/Examples/miniTest.cpp +++ b/Apps/Examples/miniTest.cpp @@ -43,7 +43,7 @@ #include "Algo/Geometry/laplacian.h" #include "Algo/Modelisation/subdivision.h" #include "Algo/Decimation/decimation.h" -#include "Algo/Filters2D/filters2D.h" +#include "Algo/Remeshing/pliant.h" using namespace CGoGN ; @@ -583,6 +583,30 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y) break ; } + case 'r': + { + GLint t1 = glutGet(GLUT_ELAPSED_TIME) ; + + Algo::Remeshing::pliantRemeshing(myMap, position) ; + + 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 'd': { AttributeHandler positionF = myMap.getAttribute(FACE_ORBIT, "position") ; @@ -598,7 +622,7 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y) GLfloat seconds = (t2 - t1) / 1000.0f ; std::cout << "dual computation: "<< seconds << "sec" << std::endl ; - position = myMap.getAttribute(VERTEX_ORBIT, "position") ; + position = positionF ; normal = myMap.getAttribute(VERTEX_ORBIT, "normal") ; if(!normal.isValid()) diff --git a/include/Algo/Geometry/area.h b/include/Algo/Geometry/area.h index 9c0e3260..27d8ff1d 100644 --- a/include/Algo/Geometry/area.h +++ b/include/Algo/Geometry/area.h @@ -46,11 +46,11 @@ typename PFP::REAL totalArea(typename PFP::MAP& map, const typename PFP::TVEC3& template void computeAreaFaces(typename PFP::MAP& map, const typename PFP::TVEC3& position, typename PFP::TREAL& face_area, const FunctorSelect& select = SelectorTrue()) ; -} +} // namespace Geometry -} +} // namespace Algo -} +} // namespace CGoGN #include "Algo/Geometry/area.hpp" diff --git a/include/Algo/Geometry/basic.h b/include/Algo/Geometry/basic.h index aa320576..27f1fd80 100644 --- a/include/Algo/Geometry/basic.h +++ b/include/Algo/Geometry/basic.h @@ -40,7 +40,7 @@ namespace Geometry * vectorOutOfDart return a dart from the position of vertex attribute of d to the position of vertex attribute of phi1(d) */ template -typename PFP::VEC3 vectorOutOfDart(typename PFP::MAP& map, Dart d, const typename PFP::TVEC3& position) +inline typename PFP::VEC3 vectorOutOfDart(typename PFP::MAP& map, Dart d, const typename PFP::TVEC3& position) { typename PFP::VEC3 vec = position[map.phi1(d)] ; vec -= position[d] ; @@ -48,11 +48,17 @@ typename PFP::VEC3 vectorOutOfDart(typename PFP::MAP& map, Dart d, const typenam } template -float angle(typename PFP::MAP& map, Dart d1, Dart d2, const typename PFP::TVEC3& position) +inline typename PFP::REAL edgeLength(typename PFP::MAP& map, Dart d, const typename PFP::TVEC3& position) { - typename PFP::VEC3 v1, v2 ; - vectorOutOfDart(map, d1, position, v1) ; - vectorOutOfDart(map, d2, position, v2) ; + typename PFP::VEC3 v = vectorOutOfDart(map, d, position) ; + return v.norm() ; +} + +template +inline float angle(typename PFP::MAP& map, Dart d1, Dart d2, const typename PFP::TVEC3& position) +{ + typename PFP::VEC3 v1 = vectorOutOfDart(map, d1, position) ; + typename PFP::VEC3 v2 = vectorOutOfDart(map, d2, position) ; return Geom::angle(v1, v2) ; } diff --git a/include/Algo/Modelisation/extrusion.h b/include/Algo/Modelisation/extrusion.h index e46b26fa..757960ec 100644 --- a/include/Algo/Modelisation/extrusion.h +++ b/include/Algo/Modelisation/extrusion.h @@ -194,9 +194,11 @@ template Dart extrudeFace(typename PFP::MAP& the_map, typename PFP::TVEC3& positions, Dart d, float dist); -}//end namespace -}//end namespace -}//end namespace +} // namespace Modelisation + +} // namespace Algo + +} // namespace CGoGN #include "Algo/Modelisation/extrusion.hpp" diff --git a/include/Algo/Parallel/parallel_foreach.h b/include/Algo/Parallel/parallel_foreach.h index b0fe1a13..d45827d1 100644 --- a/include/Algo/Parallel/parallel_foreach.h +++ b/include/Algo/Parallel/parallel_foreach.h @@ -22,7 +22,6 @@ * * *******************************************************************************/ - #include "Topology/generic/functor.h" #ifndef __PARALLEL_FOREACH__ @@ -225,16 +224,12 @@ public: virtual void operator()() =0; }; +} // namespace Parallel +} // namespace Algo - -} -} // end namespace -} - +} // namespace CGoGN #include "Algo/Parallel/parallel_foreach.hpp" - #endif - diff --git a/include/Geometry/basic.hpp b/include/Geometry/basic.hpp index e5a3874b..5e45add8 100644 --- a/include/Geometry/basic.hpp +++ b/include/Geometry/basic.hpp @@ -32,4 +32,3 @@ namespace Geom } } - -- GitLab