Coupure prévue mardi 3 Août au matin pour maintenance du serveur. Nous faisons au mieux pour que celle-ci soit la plus brève possible.

Commit c02f8c6d authored by untereiner's avatar untereiner
Browse files

Merge cgogn:~kraemer/CGoGN

parents 23f8022e 90151896
...@@ -28,21 +28,23 @@ ...@@ -28,21 +28,23 @@
#include "Algo/Modelisation/primitives3d.h" #include "Algo/Modelisation/primitives3d.h"
#include "Algo/Modelisation/subdivision3.h" #include "Algo/Modelisation/subdivision3.h"
SimpleGMap3::SimpleGMap3() SimpleGMap3::SimpleGMap3()
{ {
position = myMap.addAttribute<PFP::VEC3>(VERTEX, "position"); position = myMap.addAttribute<PFP::VEC3>(VERTEX, "position");
normal = myMap.addAttribute<PFP::VEC3>(VERTEX, "normal"); normal = myMap.addAttribute<PFP::VEC3>(VERTEX, "normal");
volume = myMap.addAttribute<PFP::VEC3>(VOLUME, "volume");
Algo::Modelisation::Primitive3D<PFP> primCat(myMap,position); Algo::Modelisation::Primitive3D<PFP> primCat(myMap,position);
Dart d = primCat.hexaGrid_topo(2,1,1); Dart d = primCat.hexaGrid_topo(3,1,1);
primCat.embedHexaGrid(1,1,1); primCat.embedHexaGrid(2,1,1);
myMap.check(); myMap.check();
DartMarker markOrient(myMap); DartMarker markOrient(myMap);
std::vector<Dart> orient; std::vector<Dart> orient;
FunctorStore fs(orient); FunctorStore fs(orient);
d = 49;
myMap.foreach_dart_of_oriented_volume(d, fs); myMap.foreach_dart_of_oriented_volume(d, fs);
for(std::vector<Dart>::iterator it = orient.begin() ; it != orient.end() ; ++it) for(std::vector<Dart>::iterator it = orient.begin() ; it != orient.end() ; ++it)
......
...@@ -54,6 +54,7 @@ public: ...@@ -54,6 +54,7 @@ public:
PFP::TVEC3 position ; PFP::TVEC3 position ;
PFP::TVEC3 normal ; PFP::TVEC3 normal ;
PFP::TVEC3 volume ;
SimpleGMap3() ; SimpleGMap3() ;
......
...@@ -194,7 +194,7 @@ void Viewer::importMesh(std::string& filename) ...@@ -194,7 +194,7 @@ void Viewer::importMesh(std::string& filename)
m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::POINTS) ; m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::POINTS) ;
m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::LINES) ; m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::LINES) ;
m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::TRIANGLES, false) ; m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::TRIANGLES) ;
bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ; bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ;
normalBaseSize = bb.diagSize() / 100.0f ; normalBaseSize = bb.diagSize() / 100.0f ;
......
...@@ -46,11 +46,19 @@ include_directories( ...@@ -46,11 +46,19 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR} # for qt (ui,moc,etc.) if necessary ${CMAKE_CURRENT_BINARY_DIR} # for qt (ui,moc,etc.) if necessary
) )
add_executable( mon_exec ${CMAKE_SOURCE_DIR}/mon_source.cpp) # Pour une appli QT
QT4_WRAP_UI( source_ui ../source.ui )
QT4_WRAP_CPP( source_moc ../source.h )
add_executable( mon_exec
${CMAKE_SOURCE_DIR}/mon_source.cpp
# Pour une appli QT
${source_moc}
${source_ui}
)
target_link_libraries( mon_exec ${CGoGN_LIBS_R} ${COMMON_LIBS}) target_link_libraries( mon_exec ${CGoGN_LIBS_R} ${COMMON_LIBS})
Pour le compiler le plus propre est de faire un repertoire build, Pour le compiler le plus propre est de faire un repertoire build,
d'aller à l'interieur et de faire ccmake .. (j'ai bien ecrit "..") d'aller à l'interieur et de faire ccmake .. (j'ai bien ecrit "..")
ccmake (ou un equivalent type cmake-gui) permet de mettre à jour les variables, ccmake (ou un equivalent type cmake-gui) permet de mettre à jour les variables,
...@@ -58,6 +66,3 @@ ici WITH_QT, WITH_ASSIMP, WITH_NUMERICAL, WITH_ZINRI. ...@@ -58,6 +66,3 @@ ici WITH_QT, WITH_ASSIMP, WITH_NUMERICAL, WITH_ZINRI.
Ceci ajoutera automatiquement tout ce qu'il faut aux variables COMMON_INCLUDES Ceci ajoutera automatiquement tout ce qu'il faut aux variables COMMON_INCLUDES
et COMMON_LIBS. et COMMON_LIBS.
On peut aussi utiliser cmake avec l'option -D (moins pratique). On peut aussi utiliser cmake avec l'option -D (moins pratique).
...@@ -72,11 +72,8 @@ ENDIF (WITH_QT) ...@@ -72,11 +72,8 @@ ENDIF (WITH_QT)
IF (WITH_NUMERICAL) IF (WITH_NUMERICAL)
add_definitions(-DWITH_NUMERICAL) add_definitions(-DWITH_NUMERICAL)
# SET (NUMERICAL_INCLUDES ${CGoGN_ROOT_DIR}/ThirdParty/Numerical ${CGoGN_ROOT_DIR}/ThirdParty/Numerical/UFconfig)
# SET (NUMERICAL_LIBS f2c blas numerical lapack)
SET (COMMON_INCLUDES ${COMMON_INCLUDES} ${CGoGN_ROOT_DIR}/ThirdParty/Numerical ${CGoGN_ROOT_DIR}/ThirdParty/Numerical/UFconfig) SET (COMMON_INCLUDES ${COMMON_INCLUDES} ${CGoGN_ROOT_DIR}/ThirdParty/Numerical ${CGoGN_ROOT_DIR}/ThirdParty/Numerical/UFconfig)
SET (COMMON_LIBS ${COMMON_LIBS} f2c blas numerical lapack) SET (COMMON_LIBS ${COMMON_LIBS} numerical lapack blas f2c)
ENDIF (WITH_NUMERICAL) ENDIF (WITH_NUMERICAL)
...@@ -102,5 +99,3 @@ SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin) ...@@ -102,5 +99,3 @@ SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)
SET(CGoGN_LIBS_D topologyD algoD containerD utilsD) SET(CGoGN_LIBS_D topologyD algoD containerD utilsD)
SET(CGoGN_LIBS_R topology algo container utils) SET(CGoGN_LIBS_R topology algo container utils)
...@@ -53,7 +53,7 @@ bool Approximator_RGBfunctionsHalf<PFP>::init() ...@@ -53,7 +53,7 @@ bool Approximator_RGBfunctionsHalf<PFP>::init()
m_approxFrame = this->m_map.template getAttribute<MATRIX33>(EDGE, "approx_frame") ; m_approxFrame = this->m_map.template getAttribute<MATRIX33>(EDGE, "approx_frame") ;
m_quadricRGBfunctions = this->m_map.template getAttribute<QuadricRGBfunctions<REAL> >(EDGE, "quadricRGBfunctions") ; m_quadricRGBfunctions = this->m_map.template getAttribute<QuadricRGBfunctions<REAL> >(EDGE, "quadricRGBfunctions") ;
MapBrowserLinkedAuto<typename PFP::MAP> mb(this->m_map) ; MapBrowserLinked<typename PFP::MAP> mb(this->m_map) ;
this->m_map.foreach_orbit(EDGE, mb) ; this->m_map.foreach_orbit(EDGE, mb) ;
// create quadric embedding for computing and set them to 0 // create quadric embedding for computing and set them to 0
...@@ -196,7 +196,7 @@ bool Approximator_RGBfunctions<PFP>::init() ...@@ -196,7 +196,7 @@ bool Approximator_RGBfunctions<PFP>::init()
m_approxFrame = this->m_map.template getAttribute<MATRIX33>(EDGE, "approx_frame") ; m_approxFrame = this->m_map.template getAttribute<MATRIX33>(EDGE, "approx_frame") ;
m_quadricRGBfunctions = this->m_map.template getAttribute<QuadricRGBfunctions<REAL> >(EDGE, "quadricRGBfunctions") ; m_quadricRGBfunctions = this->m_map.template getAttribute<QuadricRGBfunctions<REAL> >(EDGE, "quadricRGBfunctions") ;
MapBrowserLinkedAuto<typename PFP::MAP> mb(this->m_map) ; MapBrowserLinked<typename PFP::MAP> mb(this->m_map) ;
this->m_map.foreach_orbit(EDGE, mb) ; this->m_map.foreach_orbit(EDGE, mb) ;
// create quadric embedding for computing and set them to 0 // create quadric embedding for computing and set them to 0
......
...@@ -90,12 +90,6 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const char* filename, const typ ...@@ -90,12 +90,6 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const char* filename, const typ
template <typename PFP> template <typename PFP>
bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const typename PFP::TVEC3 frame[3], const typename PFP::TVEC3 colorPTM[6], const FunctorSelect& good) ; bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const typename PFP::TVEC3 frame[3], const typename PFP::TVEC3 colorPTM[6], const FunctorSelect& good) ;
/**
* export pout l'InESS
*/
template <typename PFP>
bool exportInESS(typename PFP::MAP& map, const char *filename, const typename PFP::TVEC3& position);
} // namespace Export } // namespace Export
} // namespace Algo } // namespace Algo
......
...@@ -434,20 +434,6 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P ...@@ -434,20 +434,6 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
return true ; return true ;
} }
template <typename PFP>
bool exportInESS(typename PFP::MAP& map, const char *filename, const typename PFP::TVEC3& position)
{
typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3;
std::ofstream out(filename, std::ios::out) ;
if (!out.good())
{
CGoGNerr << "Unable to open file " << CGoGNendl ;
return false ;
}
}
} // namespace Export } // namespace Export
} // namespace Algo } // namespace Algo
......
...@@ -69,6 +69,9 @@ void filterBilateral(typename PFP::MAP& map, const typename PFP::TVEC3& position ...@@ -69,6 +69,9 @@ void filterBilateral(typename PFP::MAP& map, const typename PFP::TVEC3& position
{ {
if(!map.isBoundaryVertex(d)) if(!map.isBoundaryVertex(d))
{ {
// get normal of vertex
const VEC3& normal_d = normal[d] ;
// traversal of incident edges // traversal of incident edges
float sum = 0.0f, normalizer = 0.0f ; float sum = 0.0f, normalizer = 0.0f ;
Traversor2VE<typename PFP::MAP> te(map, d) ; Traversor2VE<typename PFP::MAP> te(map, d) ;
...@@ -82,7 +85,7 @@ void filterBilateral(typename PFP::MAP& map, const typename PFP::TVEC3& position ...@@ -82,7 +85,7 @@ void filterBilateral(typename PFP::MAP& map, const typename PFP::TVEC3& position
normalizer += wcs ; normalizer += wcs ;
} }
position2[d] = position[d] + ((sum / normalizer) * normal[d]) ; position2[d] = position[d] + ((sum / normalizer) * normal_d) ;
} }
else else
position2[d] = position[d] ; position2[d] = position[d] ;
......
...@@ -43,7 +43,7 @@ typename PFP::REAL normalizeLength(typename PFP::MAP & the_map, typename PFP::TV ...@@ -43,7 +43,7 @@ typename PFP::REAL normalizeLength(typename PFP::MAP & the_map, typename PFP::TV
typename PFP::REAL sum = 0 ; typename PFP::REAL sum = 0 ;
int count = 0 ; int count = 0 ;
MapBrowserLinkedAuto<typename PFP::MAP> mb(the_map) ; MapBrowserLinked<typename PFP::MAP> mb(the_map) ;
the_map.foreach_orbit(m_attr.getOrbit(), mb) ; the_map.foreach_orbit(m_attr.getOrbit(), mb) ;
for (Dart d = mb.begin(); d != mb.end(); mb.next(d)) for (Dart d = mb.begin(); d != mb.end(); mb.next(d))
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "Topology/generic/traversorCell.h" #include "Topology/generic/traversorCell.h"
#include "Algo/Geometry/centroid.h" #include "Algo/Geometry/centroid.h"
#include "Algo/Modelisation/tetrahedralization.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -61,7 +62,7 @@ typename PFP::REAL convexPolyhedronVolume(typename PFP::MAP& map, Dart d, const ...@@ -61,7 +62,7 @@ typename PFP::REAL convexPolyhedronVolume(typename PFP::MAP& map, Dart d, const
{ {
typedef typename PFP::VEC3 VEC3; typedef typename PFP::VEC3 VEC3;
if(map.isVolumeTetrahedron(d)) if(Modelisation::Tetrahedralization::isTetrahedron<PFP>(map,d))
return tetrahedronVolume<PFP>(map,d,position) ; return tetrahedronVolume<PFP>(map,d,position) ;
else else
{ {
......
...@@ -38,51 +38,49 @@ namespace Modelisation ...@@ -38,51 +38,49 @@ namespace Modelisation
template <typename PFP> template <typename PFP>
Dart cut3Ear(typename PFP::MAP& map, Dart d) Dart cut3Ear(typename PFP::MAP& map, Dart d)
{ {
Dart e=d; Dart e = d;
int nb=0; int nb = 0;
Dart dNew; Dart dNew;
Dart dRing; Dart dRing;
Dart dRing2; Dart dRing2;
//count the valence of the vertex //count the valence of the vertex
do
{
nb++;
e=map.phi1(map.phi2(e));
} while (e!=d);
if(nb<3)
{
CGoGNout << "Warning : cannot cut 2 volumes without creating a degenerated face " << CGoGNendl;
return d;
}
else
{
//triangulate around the vertex
do do
{ {
Dart dN = map.phi1(map.phi2(e)); nb++;
if(map.template phi<111>(e)!=e) e = map.phi1(map.phi2(e));
map.splitFace(map.phi_1(e), map.phi1(e)); } while (e != d);
dRing = map.phi1(e);
dRing2 = map.phi2(dRing);
map.unsewFaces(dRing); if(nb < 3)
{
CGoGNout << "Warning : cannot cut 2 volumes without creating a degenerated face " << CGoGNendl;
return d;
}
else
{
//triangulate around the vertex
do
{
Dart dN = map.phi1(map.phi2(e));
if(map.template phi<111>(e) != e)
map.splitFace(map.phi_1(e), map.phi1(e));
e= dN; dRing = map.phi1(e);
} while (e!=d); dRing2 = map.phi2(dRing);
map.closeHole(dRing); map.unsewFaces(dRing);
map.closeHole(dRing2);
map.sewVolumes(map.phi2(dRing),map.phi2(dRing2));
}
return map.phi2(dRing); e = dN;
} } while (e != d);
map.closeHole(dRing);
map.closeHole(dRing2);
map.sewVolumes(map.phi2(dRing), map.phi2(dRing2));
}
return map.phi2(dRing);
}
template <typename PFP, typename EMBV, typename EMB> template <typename PFP, typename EMBV, typename EMB>
void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected) void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected)
...@@ -113,7 +111,6 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec ...@@ -113,7 +111,6 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
//memorize each vertices per volumes //memorize each vertices per volumes
if(selected(d) && !mv.isMarked(d)) if(selected(d) && !mv.isMarked(d))
{ {
std::cout << " d " << d << std::endl;
l_vertices.push_back(d); l_vertices.push_back(d);
mv.markOrbitInParent<typename PFP::MAP>(VERTEX,d); mv.markOrbitInParent<typename PFP::MAP>(VERTEX,d);
} }
...@@ -145,12 +142,6 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec ...@@ -145,12 +142,6 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
} }
} }
unsigned int nb_=0;
for(unsigned int nb= attributs.begin() ; nb != attributs.end() ; attributs.next(nb))
nb_++;
std::cout << "first " << nb_ << std::endl;
// second pass: quandrangule faces // second pass: quandrangule faces
std::map<Dart,Dart> toSew; std::map<Dart,Dart> toSew;
for (Dart d = map.begin(); d != map.end(); map.next(d)) for (Dart d = map.begin(); d != map.end(); map.next(d))
...@@ -230,12 +221,6 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec ...@@ -230,12 +221,6 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
} }
} }
nb_=0;
for(unsigned int nb= attributs.begin() ; nb != attributs.end() ; attributs.next(nb))
nb_++;
std::cout << "then " << nb_ << std::endl;
map.check(); map.check();
//sew all faces leading to the central vertex //sew all faces leading to the central vertex
...@@ -249,12 +234,9 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec ...@@ -249,12 +234,9 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
} }
} }
} //namespace Modelisation } //namespace Modelisation
} //namespace Algo } //namespace Algo
} //namespace CGoGN } //namespace CGoGN
...@@ -48,7 +48,6 @@ void hexahedronToTetrahedron(typename PFP::MAP& map, Dart d); ...@@ -48,7 +48,6 @@ void hexahedronToTetrahedron(typename PFP::MAP& map, Dart d);
* Tetrahedron functions * * Tetrahedron functions *
************************************************************************************************/ ************************************************************************************************/
/** /**
* test if the volume is a tetrahedron * test if the volume is a tetrahedron
* @param map * @param map
...@@ -57,7 +56,6 @@ void hexahedronToTetrahedron(typename PFP::MAP& map, Dart d); ...@@ -57,7 +56,6 @@ void hexahedronToTetrahedron(typename PFP::MAP& map, Dart d);
template <typename PFP> template <typename PFP>
bool isTetrahedron(typename PFP::MAP& the_map, Dart d); bool isTetrahedron(typename PFP::MAP& the_map, Dart d);
/************************************************************************************************ /************************************************************************************************
* Swap Functions * * Swap Functions *
************************************************************************************************/ ************************************************************************************************/
...@@ -101,7 +99,6 @@ Dart swap2To3(typename PFP::MAP& map, Dart d); ...@@ -101,7 +99,6 @@ Dart swap2To3(typename PFP::MAP& map, Dart d);
template <typename PFP> template <typename PFP>
void swap5To4(typename PFP::MAP& the_map, Dart d, typename PFP::TVEC3& positions); void swap5To4(typename PFP::MAP& the_map, Dart d, typename PFP::TVEC3& positions);
/************************************************************************************************ /************************************************************************************************
* Flip Functions * * Flip Functions *
************************************************************************************************/ ************************************************************************************************/
...@@ -112,23 +109,20 @@ void swap5To4(typename PFP::MAP& the_map, Dart d, typename PFP::TVEC3& positions ...@@ -112,23 +109,20 @@ void swap5To4(typename PFP::MAP& the_map, Dart d, typename PFP::TVEC3& positions
template <typename PFP> template <typename PFP>
void flip1To4(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position); void flip1To4(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position);
/** /**
* *
*/ */
template <typename PFP> template <typename PFP>
void edgeBisection(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position); void edgeBisection(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position);
} // namespace Tetrahedralization
} // namespace Modelisation
} //end namespace Tetrahedralization } // namespace Algo
} //end namespace Modelisation
} //end namespace Algo } // namespace CGoGN
} //end namespace CGoGN
#include "Algo/Modelisation/tetrahedralization.hpp" #include "Algo/Modelisation/tetrahedralization.hpp"
#endif #endif
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
* * * *
*******************************************************************************/ *******************************************************************************/
#include <list>
namespace CGoGN namespace CGoGN
{ {
...@@ -57,60 +55,47 @@ void hexahedronToTetrahedron(typename PFP::MAP& map, Dart d) ...@@ -57,60 +55,47 @@ void hexahedronToTetrahedron(typename PFP::MAP& map, Dart d)
template <typename PFP> template <typename PFP>
bool isTetrahedron(typename PFP::MAP& the_map, Dart d) bool isTetrahedron(typename PFP::MAP& the_map, Dart d)
{ {
DartMarkerStore mark(*the_map); // Lock a marker DartMarkerStore mark(the_map); // Lock a marker
bool isTetrahedron = true; // Last return value
std::list<Dart> visitedFaces; // Faces that are traversed std::vector<Dart> visitedFaces; // Faces that are traversed
visitedFaces.reserve(64) ;
visitedFaces.push_back(d); visitedFaces.push_back(d);
std::list<Dart>::iterator faces;
int nbFaces = 0; // Count the faces unsigned int nbFaces = 0; // Count the faces
//Test the number of faces end its valency //Test the number of faces end its valency
for(faces = visitedFaces.begin() ; isTetrahedron && faces != visitedFaces.end() ; ++faces) for(unsigned int i = 0; i < visitedFaces.size(); ++i)
{ {
Dart dc = *faces; Dart dc = visitedFaces[i];
//if this dart is not marked //if this dart is not marked
if(!mark.isMarked(dc)) if(!mark.isMarked(dc))
{ {
//increase the number of faces
nbFaces++;
if(nbFaces > 4) //too much faces
return false;
//test the valency of this face //test the valency of this face
if(dc != the_map.phi1(the_map.phi1(the_map.phi1(dc)))) if(dc != the_map.phi1(the_map.phi1(the_map.phi1(dc))))
isTetrahedron = false; return false;
else
//mark the face and push adjacent faces
Dart d1 = dc;
for(unsigned int i = 0; i <3 ; ++i)
{ {
//mark them mark.mark(d1);
mark.markOrbit(DART,dc);
//if phi2 not marked //if phi2 not marked
if(!mark.markOrbit(DART, the_map.phi2(dc))) Dart d2 = the_map.phi2(d1);
visitedFaces.push_back(the_map.phi2(dc)); if(!mark.isMarked(d2))