Commit 2f7d4461 authored by Sylvain Thery's avatar Sylvain Thery
Browse files

Merge branch 'master' of cgogn:~jund/CGoGN

parents 61f307e8 73378a04
...@@ -17,7 +17,6 @@ include_directories( ...@@ -17,7 +17,6 @@ include_directories(
${CGoGN_ROOT_DIR}/ThirdParty/OpenCTM ${CGoGN_ROOT_DIR}/ThirdParty/OpenCTM
${CGoGN_ROOT_DIR}/ThirdParty/Assimp/include ${CGoGN_ROOT_DIR}/ThirdParty/Assimp/include
${CGoGN_ROOT_DIR}/ThirdParty/glm ${CGoGN_ROOT_DIR}/ThirdParty/glm
) )
# define libs path # define libs path
......
...@@ -9,6 +9,15 @@ SET(CMAKE_BUILD_TYPE Debug) ...@@ -9,6 +9,15 @@ SET(CMAKE_BUILD_TYPE Debug)
# define includes path # define includes path
include_directories( include_directories(
${CGoGN_ROOT_DIR}/include ${CGoGN_ROOT_DIR}/include
/usr/include/libxml2/
${CGoGN_ROOT_DIR}/include
${CGoGN_ROOT_DIR}/ThirdParty/Numerical
${CGoGN_ROOT_DIR}/ThirdParty/Numerical/UFconfig
${CGoGN_ROOT_DIR}/ThirdParty/gzstream
${CGoGN_ROOT_DIR}/ThirdParty/Zinri
${CGoGN_ROOT_DIR}/ThirdParty/AntTweakBar/include
${CGoGN_ROOT_DIR}/ThirdParty/OpenCTM
${CGoGN_ROOT_DIR}/ThirdParty/Assimp/include
) )
# define libs path # define libs path
...@@ -26,3 +35,7 @@ target_link_libraries( Geom_orientationD ...@@ -26,3 +35,7 @@ target_link_libraries( Geom_orientationD
add_executable( Geom_inclusionD ./Geom_inclusion.cpp) add_executable( Geom_inclusionD ./Geom_inclusion.cpp)
target_link_libraries( Geom_inclusionD target_link_libraries( Geom_inclusionD
${COMMON_LIBS} ) ${COMMON_LIBS} )
add_executable( Algo_Geom_inclusionD ./Algo_Geom_inclusion.cpp)
target_link_libraries( Algo_Geom_inclusionD
containerD topologyD utilsD algoD ${COMMON_LIBS} )
...@@ -39,6 +39,8 @@ int main() ...@@ -39,6 +39,8 @@ int main()
VEC3 tc(0,5,0); VEC3 tc(0,5,0);
VEC3 pIn1(1,1,0); VEC3 pIn1(1,1,0);
VEC3 pIn2(2,0,0); VEC3 pIn2(2,0,0);
VEC3 pIn3 = (tb+tc)/2.0f;
VEC3 pIn4 = (tc+ta)/2.0f;
VEC3 pOut(6,0,0); VEC3 pOut(6,0,0);
if(Geom::isPointInTriangle<VEC3>(pIn1,ta,tb,tc)!=Geom::FACE_INCLUSION) if(Geom::isPointInTriangle<VEC3>(pIn1,ta,tb,tc)!=Geom::FACE_INCLUSION)
...@@ -51,6 +53,16 @@ int main() ...@@ -51,6 +53,16 @@ int main()
std::cout << "ERROR : isPointInTriangle : edge inclusion" << std::endl; std::cout << "ERROR : isPointInTriangle : edge inclusion" << std::endl;
} }
if(Geom::isPointInTriangle<VEC3>(pIn3,ta,tb,tc)!=Geom::EDGE_INCLUSION)
{
std::cout << "ERROR : isPointInTriangle : edge inclusion" << std::endl;
}
if(Geom::isPointInTriangle<VEC3>(pIn4,ta,tb,tc)!=Geom::EDGE_INCLUSION)
{
std::cout << "ERROR : isPointInTriangle : edge inclusion" << std::endl;
}
if(Geom::isPointInTriangle<VEC3>(ta,ta,tb,tc)!=Geom::VERTEX_INCLUSION) if(Geom::isPointInTriangle<VEC3>(ta,ta,tb,tc)!=Geom::VERTEX_INCLUSION)
{ {
std::cout << "ERROR : isPointInTriangle : vertex inclusion" << std::endl; std::cout << "ERROR : isPointInTriangle : vertex inclusion" << std::endl;
......
...@@ -43,7 +43,8 @@ ...@@ -43,7 +43,8 @@
#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"
#include "Algo/Geometry/feature.h"
using namespace CGoGN ; using namespace CGoGN ;
...@@ -349,7 +350,7 @@ void MyGlutWin::myRedraw() ...@@ -349,7 +350,7 @@ void MyGlutWin::myRedraw()
glPushMatrix() ; glPushMatrix() ;
float sc = 50. / gWidthObj ; float sc = 50.0f / gWidthObj ;
glScalef(sc, sc, sc) ; glScalef(sc, sc, sc) ;
glTranslatef(-gPosObj[0], -gPosObj[1], -gPosObj[2]) ; glTranslatef(-gPosObj[0], -gPosObj[1], -gPosObj[2]) ;
...@@ -432,61 +433,102 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y) ...@@ -432,61 +433,102 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
{ {
case 'l': case 'l':
{ {
GLint t1 = glutGet(GLUT_ELAPSED_TIME); GLint t1 = glutGet(GLUT_ELAPSED_TIME) ;
Algo::Modelisation::LoopSubdivision<PFP>(myMap, position);
GLint t2 = glutGet(GLUT_ELAPSED_TIME); Algo::Modelisation::LoopSubdivision<PFP>(myMap, position) ;
GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "loop: "<< seconds << "sec" << std::endl; GLint t2 = glutGet(GLUT_ELAPSED_TIME) ;
GLfloat seconds = (t2 - t1) / 1000.0f ;
std::cout << "loop: "<< seconds << "sec" << std::endl ;
t1 = glutGet(GLUT_ELAPSED_TIME) ;
t1 = glutGet(GLUT_ELAPSED_TIME);
updateVBOprimitives(Algo::Render::VBO::TRIANGLES | Algo::Render::VBO::LINES | Algo::Render::VBO::POINTS) ; updateVBOprimitives(Algo::Render::VBO::TRIANGLES | Algo::Render::VBO::LINES | Algo::Render::VBO::POINTS) ;
updateVBOdata(Algo::Render::VBO::POSITIONS | Algo::Render::VBO::NORMALS) ; updateVBOdata(Algo::Render::VBO::POSITIONS | Algo::Render::VBO::NORMALS) ;
topo_render->updateData<PFP>(myMap, position, 0.9f, 0.9f) ; 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() ; t2 = glutGet(GLUT_ELAPSED_TIME) ;
seconds = (t2 - t1) / 1000.0f ;
std::cout << "display update: "<< seconds << "sec" << std::endl ;
glutPostRedisplay() ;
break ; break ;
} }
case 'c': case 'c':
{ {
GLint t1 = glutGet(GLUT_ELAPSED_TIME); GLint t1 = glutGet(GLUT_ELAPSED_TIME) ;
Algo::Modelisation::CatmullClarkSubdivision<PFP>(myMap, position);
GLint t2 = glutGet(GLUT_ELAPSED_TIME); Algo::Modelisation::CatmullClarkSubdivision<PFP>(myMap, position) ;
GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "catmull-clark: "<< seconds << "sec" << std::endl; GLint t2 = glutGet(GLUT_ELAPSED_TIME) ;
GLfloat seconds = (t2 - t1) / 1000.0f ;
std::cout << "catmull-clark: "<< seconds << "sec" << std::endl ;
t1 = glutGet(GLUT_ELAPSED_TIME) ;
t1 = glutGet(GLUT_ELAPSED_TIME);
updateVBOprimitives(Algo::Render::VBO::TRIANGLES | Algo::Render::VBO::LINES | Algo::Render::VBO::POINTS) ; updateVBOprimitives(Algo::Render::VBO::TRIANGLES | Algo::Render::VBO::LINES | Algo::Render::VBO::POINTS) ;
updateVBOdata(Algo::Render::VBO::POSITIONS | Algo::Render::VBO::NORMALS) ; updateVBOdata(Algo::Render::VBO::POSITIONS | Algo::Render::VBO::NORMALS) ;
topo_render->updateData<PFP>(myMap, position, 0.9f, 0.9f) ; topo_render->updateData<PFP>(myMap, position, 0.9f, 0.9f) ;
t2 = glutGet(GLUT_ELAPSED_TIME);
seconds = (t2 - t1) / 1000.0f; t2 = glutGet(GLUT_ELAPSED_TIME) ;
std::cout << "display update: "<< seconds << "sec" << std::endl; seconds = (t2 - t1) / 1000.0f ;
std::cout << "display update: "<< seconds << "sec" << std::endl ;
glutPostRedisplay() ; glutPostRedisplay() ;
break ;
}
case '3':
{
GLint t1 = glutGet(GLUT_ELAPSED_TIME) ;
Algo::Modelisation::Sqrt3Subdivision<PFP>(myMap, position) ;
GLint t2 = glutGet(GLUT_ELAPSED_TIME) ;
GLfloat seconds = (t2 - t1) / 1000.0f ;
std::cout << "sqrt3: "<< seconds << "sec" << std::endl ;
normal = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, "normal") ;
if(!normal.isValid())
normal = myMap.addAttribute<PFP::VEC3>(VERTEX_ORBIT, "normal") ;
laplacian = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, "laplacian") ;
if(!laplacian.isValid())
laplacian = myMap.addAttribute<PFP::VEC3>(VERTEX_ORBIT, "laplacian") ;
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 ; break ;
} }
case 't': case 't':
{ {
GLint t1 = glutGet(GLUT_ELAPSED_TIME); GLint t1 = glutGet(GLUT_ELAPSED_TIME) ;
Algo::Modelisation::trianguleFaces<PFP>(myMap, position) ; Algo::Modelisation::trianguleFaces<PFP>(myMap, position) ;
GLint t2 = glutGet(GLUT_ELAPSED_TIME);
GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "triangulation: "<< seconds << "sec" << std::endl;
t1 = glutGet(GLUT_ELAPSED_TIME); GLint t2 = glutGet(GLUT_ELAPSED_TIME) ;
GLfloat seconds = (t2 - t1) / 1000.0f ;
std::cout << "triangulation: "<< seconds << "sec" << std::endl ;
t1 = glutGet(GLUT_ELAPSED_TIME) ;
updateVBOprimitives(Algo::Render::VBO::TRIANGLES | Algo::Render::VBO::LINES | Algo::Render::VBO::POINTS) ; updateVBOprimitives(Algo::Render::VBO::TRIANGLES | Algo::Render::VBO::LINES | Algo::Render::VBO::POINTS) ;
updateVBOdata(Algo::Render::VBO::POSITIONS | Algo::Render::VBO::NORMALS) ; updateVBOdata(Algo::Render::VBO::POSITIONS | Algo::Render::VBO::NORMALS) ;
topo_render->updateData<PFP>(myMap, position, 0.9f, 0.9f) ; topo_render->updateData<PFP>(myMap, position, 0.9f, 0.9f) ;
t2 = glutGet(GLUT_ELAPSED_TIME);
seconds = (t2 - t1) / 1000.0f; t2 = glutGet(GLUT_ELAPSED_TIME) ;
std::cout << "display update: "<< seconds << "sec" << std::endl; seconds = (t2 - t1) / 1000.0f ;
std::cout << "display update: "<< seconds << "sec" << std::endl ;
glutPostRedisplay() ; glutPostRedisplay() ;
break ; break ;
...@@ -494,19 +536,23 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y) ...@@ -494,19 +536,23 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
case 'q': case 'q':
{ {
GLint t1 = glutGet(GLUT_ELAPSED_TIME); GLint t1 = glutGet(GLUT_ELAPSED_TIME) ;
Algo::Modelisation::quadranguleFaces<PFP>(myMap, position) ; Algo::Modelisation::quadranguleFaces<PFP>(myMap, position) ;
GLint t2 = glutGet(GLUT_ELAPSED_TIME);
GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "quadrangulation: "<< seconds << "sec" << std::endl;
t1 = glutGet(GLUT_ELAPSED_TIME); GLint t2 = glutGet(GLUT_ELAPSED_TIME) ;
GLfloat seconds = (t2 - t1) / 1000.0f ;
std::cout << "quadrangulation: "<< seconds << "sec" << std::endl ;
t1 = glutGet(GLUT_ELAPSED_TIME) ;
updateVBOprimitives(Algo::Render::VBO::TRIANGLES | Algo::Render::VBO::LINES | Algo::Render::VBO::POINTS) ; updateVBOprimitives(Algo::Render::VBO::TRIANGLES | Algo::Render::VBO::LINES | Algo::Render::VBO::POINTS) ;
updateVBOdata(Algo::Render::VBO::POSITIONS | Algo::Render::VBO::NORMALS) ; updateVBOdata(Algo::Render::VBO::POSITIONS | Algo::Render::VBO::NORMALS) ;
topo_render->updateData<PFP>(myMap, position, 0.9f, 0.9f) ; topo_render->updateData<PFP>(myMap, position, 0.9f, 0.9f) ;
t2 = glutGet(GLUT_ELAPSED_TIME);
seconds = (t2 - t1) / 1000.0f; t2 = glutGet(GLUT_ELAPSED_TIME) ;
std::cout << "display update: "<< seconds << "sec" << std::endl; seconds = (t2 - t1) / 1000.0f ;
std::cout << "display update: "<< seconds << "sec" << std::endl ;
glutPostRedisplay() ; glutPostRedisplay() ;
break ; break ;
...@@ -516,19 +562,23 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y) ...@@ -516,19 +562,23 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
{ {
unsigned int nbVertices = myMap.getNbOrbits(VERTEX_ORBIT) ; unsigned int nbVertices = myMap.getNbOrbits(VERTEX_ORBIT) ;
GLint t1 = glutGet(GLUT_ELAPSED_TIME); GLint t1 = glutGet(GLUT_ELAPSED_TIME) ;
Algo::Decimation::decimate<PFP>(myMap, Algo::Decimation::S_QEM, Algo::Decimation::A_QEM, position, nbVertices * 0.75) ; Algo::Decimation::decimate<PFP>(myMap, Algo::Decimation::S_QEM, Algo::Decimation::A_QEM, position, nbVertices * 0.75) ;
GLint t2 = glutGet(GLUT_ELAPSED_TIME);
GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "decimation: "<< seconds << "sec" << std::endl;
t1 = glutGet(GLUT_ELAPSED_TIME); GLint t2 = glutGet(GLUT_ELAPSED_TIME) ;
GLfloat seconds = (t2 - t1) / 1000.0f ;
std::cout << "decimation: "<< seconds << "sec" << std::endl ;
t1 = glutGet(GLUT_ELAPSED_TIME) ;
updateVBOprimitives(Algo::Render::VBO::TRIANGLES | Algo::Render::VBO::LINES | Algo::Render::VBO::POINTS) ; updateVBOprimitives(Algo::Render::VBO::TRIANGLES | Algo::Render::VBO::LINES | Algo::Render::VBO::POINTS) ;
updateVBOdata(Algo::Render::VBO::POSITIONS | Algo::Render::VBO::NORMALS) ; updateVBOdata(Algo::Render::VBO::POSITIONS | Algo::Render::VBO::NORMALS) ;
topo_render->updateData<PFP>(myMap, position, 0.9f, 0.9f) ; topo_render->updateData<PFP>(myMap, position, 0.9f, 0.9f) ;
t2 = glutGet(GLUT_ELAPSED_TIME);
seconds = (t2 - t1) / 1000.0f; t2 = glutGet(GLUT_ELAPSED_TIME) ;
std::cout << "display update: "<< seconds << "sec" << std::endl; seconds = (t2 - t1) / 1000.0f ;
std::cout << "display update: "<< seconds << "sec" << std::endl ;
glutPostRedisplay() ; glutPostRedisplay() ;
break ; break ;
...@@ -541,15 +591,15 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y) ...@@ -541,15 +591,15 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
positionF = myMap.addAttribute<PFP::VEC3>(FACE_ORBIT, "position") ; positionF = myMap.addAttribute<PFP::VEC3>(FACE_ORBIT, "position") ;
Algo::Geometry::computeCentroidFaces<PFP>(myMap, position, positionF) ; Algo::Geometry::computeCentroidFaces<PFP>(myMap, position, positionF) ;
GLint t1 = glutGet(GLUT_ELAPSED_TIME); GLint t1 = glutGet(GLUT_ELAPSED_TIME) ;
Algo::Modelisation::computeDual<PFP>(myMap) ; Algo::Modelisation::computeDual<PFP>(myMap) ;
GLint t2 = glutGet(GLUT_ELAPSED_TIME); GLint t2 = glutGet(GLUT_ELAPSED_TIME) ;
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())
...@@ -558,19 +608,46 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y) ...@@ -558,19 +608,46 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
if(!laplacian.isValid()) if(!laplacian.isValid())
laplacian = myMap.addAttribute<PFP::VEC3>(VERTEX_ORBIT, "laplacian") ; laplacian = myMap.addAttribute<PFP::VEC3>(VERTEX_ORBIT, "laplacian") ;
t1 = glutGet(GLUT_ELAPSED_TIME); t1 = glutGet(GLUT_ELAPSED_TIME) ;
updateVBOprimitives(Algo::Render::VBO::TRIANGLES | Algo::Render::VBO::LINES | Algo::Render::VBO::POINTS) ; updateVBOprimitives(Algo::Render::VBO::TRIANGLES | Algo::Render::VBO::LINES | Algo::Render::VBO::POINTS) ;
updateVBOdata(Algo::Render::VBO::POSITIONS | Algo::Render::VBO::NORMALS) ; updateVBOdata(Algo::Render::VBO::POSITIONS | Algo::Render::VBO::NORMALS) ;
topo_render->updateData<PFP>(myMap, position, 0.9f, 0.9f) ; topo_render->updateData<PFP>(myMap, position, 0.9f, 0.9f) ;
t2 = glutGet(GLUT_ELAPSED_TIME);
seconds = (t2 - t1) / 1000.0f; t2 = glutGet(GLUT_ELAPSED_TIME) ;
std::cout << "display update: "<< seconds << "sec" << std::endl; seconds = (t2 - t1) / 1000.0f ;
std::cout << "display update: "<< seconds << "sec" << std::endl ;
glutPostRedisplay() ; glutPostRedisplay() ;
break ; break ;
} }
case '3': case 'r':
{
GLint t1 = glutGet(GLUT_ELAPSED_TIME) ;
Algo::Remeshing::pliantRemeshing<PFP>(myMap, position, normal) ;
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 '9':
{ {
CellMarker markVisit(myMap, VERTEX_CELL) ; CellMarker markVisit(myMap, VERTEX_CELL) ;
...@@ -624,6 +701,7 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y) ...@@ -624,6 +701,7 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
updateVBOprimitives(Algo::Render::VBO::TRIANGLES | Algo::Render::VBO::LINES | Algo::Render::VBO::POINTS) ; updateVBOprimitives(Algo::Render::VBO::TRIANGLES | Algo::Render::VBO::LINES | Algo::Render::VBO::POINTS) ;
updateVBOdata(Algo::Render::VBO::POSITIONS | Algo::Render::VBO::NORMALS) ; updateVBOdata(Algo::Render::VBO::POSITIONS | Algo::Render::VBO::NORMALS) ;
topo_render->updateData<PFP>(myMap, position, 0.9f, 0.9f) ; topo_render->updateData<PFP>(myMap, position, 0.9f, 0.9f) ;
glutPostRedisplay() ; glutPostRedisplay() ;
break ; break ;
} }
......
...@@ -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) ;
} }
......
...@@ -119,9 +119,9 @@ EMB vertexNeighborhoodCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& at ...@@ -119,9 +119,9 @@ EMB vertexNeighborhoodCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& at
Dart it = d ; Dart it = d ;
do do
{ {
center += attributs[map.phi2(it)]; center += attributs[map.phi1(it)];
++count ; ++count ;
it = map.phi1(map.phi2(it)) ; it = map.alpha1(it) ;
} while(it != d) ; } while(it != d) ;
center /= count ; center /= count ;
return center ; return center ;
......
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: https://iggservis.u-strasbg.fr/CGoGN/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __ALGO_GEOMETRY_FEATURE_H__
#define __ALGO_GEOMETRY_FEATURE_H__
namespace CGoGN
{
namespace Algo
{
namespace Geometry
{
template <typename PFP>
void featureEdgeDetection(typename PFP::MAP& map, const typename PFP::TVEC3& position, DartMarker& feature) ;
} // namespace Geometry
} // namespace Algo
} // namespace CGoGN
#include "Algo/Geometry/feature.hpp"
#endif
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *