Commit be92e128 authored by Pierre Kraemer's avatar Pierre Kraemer
Browse files

debut pliant remeshing..

parent 3346213e
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#include "Algo/Geometry/laplacian.h" #include "Algo/Geometry/laplacian.h"
#include "Algo/Modelisation/subdivision.h" #include "Algo/Modelisation/subdivision.h"
#include "Algo/Decimation/decimation.h" #include "Algo/Decimation/decimation.h"
#include "Algo/Filters2D/filters2D.h" #include "Algo/Remeshing/pliant.h"
using namespace CGoGN ; using namespace CGoGN ;
...@@ -583,6 +583,30 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y) ...@@ -583,6 +583,30 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
break ; break ;
} }
case 'r':
{
GLint t1 = glutGet(GLUT_ELAPSED_TIME) ;
Algo::Remeshing::pliantRemeshing<PFP>(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<PFP>(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': case 'd':
{ {
AttributeHandler<PFP::VEC3> positionF = myMap.getAttribute<PFP::VEC3>(FACE_ORBIT, "position") ; AttributeHandler<PFP::VEC3> positionF = myMap.getAttribute<PFP::VEC3>(FACE_ORBIT, "position") ;
...@@ -598,7 +622,7 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y) ...@@ -598,7 +622,7 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
GLfloat seconds = (t2 - t1) / 1000.0f ; GLfloat seconds = (t2 - t1) / 1000.0f ;
std::cout << "dual computation: "<< seconds << "sec" << std::endl ; std::cout << "dual computation: "<< seconds << "sec" << std::endl ;
position = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, "position") ; position = positionF ;
normal = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, "normal") ; normal = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, "normal") ;
if(!normal.isValid()) if(!normal.isValid())
......
...@@ -46,11 +46,11 @@ typename PFP::REAL totalArea(typename PFP::MAP& map, const typename PFP::TVEC3& ...@@ -46,11 +46,11 @@ typename PFP::REAL totalArea(typename PFP::MAP& map, const typename PFP::TVEC3&
template <typename PFP> template <typename PFP>
void computeAreaFaces(typename PFP::MAP& map, const typename PFP::TVEC3& position, typename PFP::TREAL& face_area, const FunctorSelect& select = SelectorTrue()) ; 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" #include "Algo/Geometry/area.hpp"
......
...@@ -40,7 +40,7 @@ namespace Geometry ...@@ -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) * vectorOutOfDart return a dart from the position of vertex attribute of d to the position of vertex attribute of phi1(d)
*/ */
template <typename PFP> template <typename PFP>
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)] ; typename PFP::VEC3 vec = position[map.phi1(d)] ;
vec -= position[d] ; vec -= position[d] ;
...@@ -48,11 +48,17 @@ typename PFP::VEC3 vectorOutOfDart(typename PFP::MAP& map, Dart d, const typenam ...@@ -48,11 +48,17 @@ typename PFP::VEC3 vectorOutOfDart(typename PFP::MAP& map, Dart d, const typenam
} }
template <typename PFP> template <typename PFP>
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 ; typename PFP::VEC3 v = vectorOutOfDart<PFP>(map, d, position) ;
vectorOutOfDart<PFP>(map, d1, position, v1) ; return v.norm() ;
vectorOutOfDart<PFP>(map, d2, position, v2) ; }
template <typename PFP>
inline float angle(typename PFP::MAP& map, Dart d1, Dart d2, const typename PFP::TVEC3& position)
{
typename PFP::VEC3 v1 = vectorOutOfDart<PFP>(map, d1, position) ;
typename PFP::VEC3 v2 = vectorOutOfDart<PFP>(map, d2, position) ;
return Geom::angle(v1, v2) ; return Geom::angle(v1, v2) ;
} }
......
...@@ -194,9 +194,11 @@ template<typename PFP> ...@@ -194,9 +194,11 @@ template<typename PFP>
Dart extrudeFace(typename PFP::MAP& the_map, typename PFP::TVEC3& positions, Dart extrudeFace(typename PFP::MAP& the_map, typename PFP::TVEC3& positions,
Dart d, float dist); Dart d, float dist);
}//end namespace } // namespace Modelisation
}//end namespace
}//end namespace } // namespace Algo
} // namespace CGoGN
#include "Algo/Modelisation/extrusion.hpp" #include "Algo/Modelisation/extrusion.hpp"
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
* * * *
*******************************************************************************/ *******************************************************************************/
#include "Topology/generic/functor.h" #include "Topology/generic/functor.h"
#ifndef __PARALLEL_FOREACH__ #ifndef __PARALLEL_FOREACH__
...@@ -225,16 +224,12 @@ public: ...@@ -225,16 +224,12 @@ public:
virtual void operator()() =0; virtual void operator()() =0;
}; };
} // namespace Parallel
} // namespace Algo
} // namespace CGoGN
}
} // end namespace
}
#include "Algo/Parallel/parallel_foreach.hpp" #include "Algo/Parallel/parallel_foreach.hpp"
#endif #endif
...@@ -32,4 +32,3 @@ namespace Geom ...@@ -32,4 +32,3 @@ namespace Geom
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment