Commit a5f73b59 authored by unknown's avatar unknown

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

parents 53965fa8 d7105b9b
This diff is collapsed.
......@@ -194,7 +194,12 @@ void MyQT::createMap(int n)
m_render_topo->setDartWidth(4.0f);
m_render_topo->setInitialDartsColor(0.0f,0.0f,0.0f);
m_render_topo->setInitialBoundaryDartsColor(0.0f,0.0f,0.0f);
m_render_topo->updateData<PFP>(myMap, position, 0.9f, 0.9f,true); // nb
#ifdef PRIMAL_TOPO
m_render_topo->updateData<PFP>(myMap, position, 0.9);
#else
m_render_topo->updateData<PFP>(myMap, position, 0.9f, 0.9f,true);
#endif
for (Dart d=myMap.begin(); d!=myMap.end(); myMap.next(d))
{
......@@ -213,7 +218,12 @@ void MyQT::createMap(int n)
void MyQT::updateMap()
{
m_render_topo->setInitialBoundaryDartsColor(0.0f,0.0f,0.0f);
m_render_topo->updateData<PFP>(myMap, position, 0.9f, 0.9f,true); // nb
#ifdef PRIMAL_TOPO
m_render_topo->updateData<PFP>(myMap, position, 0.9);
#else
m_render_topo->updateData<PFP>(myMap, position, 0.9f, 0.9f,true);
#endif
for (Dart d=myMap.begin(); d!=myMap.end(); myMap.next(d))
{
if (dm.isMarked(d) && (!myMap.isBoundaryMarked2(d)))
......@@ -229,7 +239,11 @@ void MyQT::updateMap()
void MyQT::cb_initGL()
{
glClearColor(1.0f,1.0f,1.0f,1.0f);
m_render_topo = new Algo::Render::GL2::TopoRender(0.01f) ;
#ifdef PRIMAL_TOPO
m_render_topo = new Algo::Render::GL2::TopoPrimalRender() ;
#else
m_render_topo = new Algo::Render::GL2::TopoRender(0.01f) ;
#endif
}
// redraw GL callback (clear and swap already done)
......
......@@ -27,6 +27,7 @@
//#define USE_GMAP
//#define PRIMAL_TOPO 1
#include "Topology/generic/parameters.h"
......@@ -36,8 +37,11 @@
#include "Topology/map/embeddedMap2.h"
#endif
#include "Algo/Render/GL2/topoRender.h"
#ifdef PRIMAL_TOPO
#include "Algo/Render/GL2/topoPrimalRender.h"
#else
#include "Algo/Render/GL2/topoRender.h"
#endif
#include "ui_tuto_oper2.h"
#include "Utils/Qt/qtui.h"
......@@ -88,7 +92,11 @@ protected:
DartAttribute<VEC3> colorDarts;
// render (for the topo)
Algo::Render::GL2::TopoRender* m_render_topo;
#ifdef PRIMAL_TOPO
Algo::Render::GL2::TopoPrimalRender* m_render_topo;
#else
Algo::Render::GL2::TopoRender* m_render_topo;
#endif
Dart m_selected;
Dart m_selected2;
DartMarker dm;
......
This diff is collapsed.
......@@ -27,6 +27,7 @@
//#define USE_GMAP
//#define PRIMAL_TOPO 1
#include "Topology/generic/parameters.h"
......@@ -36,7 +37,12 @@
#include "Topology/map/embeddedMap3.h"
#endif
#include "Algo/Render/GL2/topo3Render.h"
#ifdef PRIMAL_TOPO
#include "Algo/Render/GL2/topo3PrimalRender.h"
#else
#include "Algo/Render/GL2/topo3Render.h"
#endif
#include "Algo/Render/GL2/topoRender.h"
#include "Algo/Geometry/boundingbox.h"
......@@ -71,7 +77,7 @@ class MyQT: public Utils::QT::SimpleQT
{
Q_OBJECT
public:
MyQT():m_render_topo(NULL),m_selected(NIL),m_selected2(NIL),dm(myMap),m_shift(0.01f),m_ex1(0.9f),m_ex2(0.9f),m_ex3(0.9f), clip_volume(true) , hide_clipping(false) {}
MyQT():m_render_topo(NULL),m_selected(NIL),m_selected2(NIL),m_shift(0.01f),m_ex1(0.9f),m_ex2(0.9f),m_ex3(0.9f), clip_volume(true) , hide_clipping(false) {}
void cb_redraw();
void cb_initGL();
......@@ -95,12 +101,15 @@ protected:
Geom::BoundingBox<PFP::VEC3> bb;
// render (for the topo)
#ifdef PRIMAL_TOPO
Algo::Render::GL2::Topo3PrimalRender* m_render_topo;
#else
Algo::Render::GL2::Topo3Render* m_render_topo;
#endif
Algo::Render::GL2::TopoRender* m_render_topo_boundary;
Dart m_selected;
Dart m_selected2;
std::vector<Dart> m_selecteds;
DartMarker dm;
float m_shift;
float m_ex1, m_ex2, m_ex3;
......@@ -136,6 +145,7 @@ protected:
public:
// example of simple map creation
void createMap(int n);
void createMapTets();
void updateMap();
void importMesh(std::string& filename);
......
......@@ -150,6 +150,11 @@
<string>unsewVolumes</string>
</property>
</item>
<item>
<property name="text">
<string>deleteVolume</string>
</property>
</item>
</widget>
</item>
<item row="6" column="0">
......
*** english version below ***
Dépendences Linux:
installer les paquets suivants:
cmake cmake-curses-gui libXi-dev libXmu-dev libglew-dev libxml2-dev libboost-all-dev zlib1g-dev qt4-designer qt4-dev-tools uuid-dev libgsl0-dev libsuitesparse-dev
Pour compiler CGoGN:
- aller dans ThirdParty, cd build, taper "cmake .", puis make ( avec -j x si vous avez x core sur votre machine) suivi de make install
On peut fixer certaines option pour ne pas tout compiler (cf le README.TXT dans ThirdParty)
- on compile tout d'abord les bibliothèques third-party :
- ensuite on compile CGoGN (compile les libs dans CGoGN/lib et des exemples dans CGoGN/bin) :
cd CGoGN/build
cd CGoGN/ThirdParty/build
cmake ..
make (-j x si vous avez x cores)
make (-j x if you have x cores)
make install
Certaines options (booléennes) sont ici aussi disponible:
On peut fixer certaines option pour ne pas tout compiler (cf le README.TXT dans ThirdParty)
On peut aussi compiler en debug en créant un répertoir qui fini par Debug à la place de build
- aller dans build et taper "cmake ..", puis make
Des options (booléennes) sont ici aussi disponible:
BUILD_SHARED_LIBS (F) experimental !
WITH_ASSIMP (T)
WITH_NUMERICAL (T)
WITH_ZINRI (T)
WITH_QT (T)
afin de limiter les dépendances et le temps de compilation
afin de limiter les dépendances et le temps de compilation/
FORCE_MR (2)
permet de compiler dans 3 modes: mono-resolution (0), multi-resolution (1)
permet de compiler dans 3 modes: mixte (0), multi-resolution(1), mono-resolution(2).
ONELIB (F)
permet de forcer la compilation en une seule lib (libcgogn.a) au lieu de quatre.
- on peut ensuite compiler SCHNApps ainsi que les plugins fournis :
cd CGoGN/SCHNApps/build
cmake ..
make (-j x si vous avez x cores)
- la compilation des sous-parties se fait en allant dans les sous-repertoires de build
Les applications (Examples et Tutos) sont dans le répertoire Apps
Les binaires sont générés dans le repertoire bin
Des exemples de données:
- fichiers trianbgz, off, etc
......@@ -72,16 +74,17 @@ To compile CGoGN:
WITH_QT (T)
to minimize dependencies and compilation time
FORCE_MR (2)
allows the compilation in 3 modes: mono-resolution (0), multi-resolution (1)
allow the compilation in 3 mode: mixed(0), multi-resolution(1), mono-resolution(2).
ONELIB (F)
allowss to force the compilation in one lib (libcgogn.a) instead of four.
allow compilation in one lib (libcgogn.a) instead of four.
- we can then compile SCHNApps and the provided plugins :
cd CGoGN/SCHNApps/build
cmake ..
make (-j x if you have x cores)
- the compilation of each sub-parts is done by going in the subdirectories of build
Applications (examples and tutorials) are in the Apps directory
The binaries are generated in the bin directory
Examples of data:
- Trianbgz files, off, etc.
......
......@@ -1123,6 +1123,214 @@ Dart subdivideVolumeClassic2(typename PFP::MAP& map, Dart d, AttributeHandler<ty
}
template <typename PFP>
void subdivideEdgeLoop(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP::VEC3, VERTEX>& position)
{
assert(map.getDartLevel(d) <= map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
assert(!map.edgeIsSubdivided(d) || !"Trying to subdivide an already subdivided edge") ;
assert(!map.isBoundaryMarked3(d) || !"Trying to subdivide a dart marked boundary");
unsigned int eLevel = map.edgeLevel(d) ;
unsigned int cur = map.getCurrentLevel() ;
map.setCurrentLevel(eLevel) ;
Dart dd = map.phi2(d) ;
typename PFP::VEC3 p1 = position[d] ;
typename PFP::VEC3 p2 = position[map.phi1(d)] ;
map.setCurrentLevel(eLevel + 1) ;
map.cutEdge(d) ;
unsigned int eId = map.getEdgeId(d) ;
map.setEdgeId(map.phi1(d), eId, EDGE) ; //mise a jour de l'id d'arrete sur chaque moitie d'arete
map.setEdgeId(map.phi1(dd), eId, EDGE) ;
map.setFaceId(EDGE, d) ; //mise a jour de l'id de face sur chaque brin de chaque moitie d'arete
map.setFaceId(EDGE, dd) ;
position[map.phi1(d)] = (p1 + p2) * typename PFP::REAL(0.5) ;
map.setCurrentLevel(cur) ;
}
template <typename PFP>
void subdivideFaceLoop(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP::VEC3, VERTEX>& position, SubdivideType sType)
{
assert(map.getDartLevel(d) <= map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
assert(!map.faceIsSubdivided(d) || !"Trying to subdivide an already subdivided face") ;
assert(!map.isBoundaryMarked3(d) || !"Trying to subdivide a dart marked boundary");
unsigned int fLevel = map.faceLevel(d) ;
Dart old = map.faceOldestDart(d) ;
unsigned int cur = map.getCurrentLevel() ;
map.setCurrentLevel(fLevel) ; // go to the level of the face to subdivide its edges
unsigned int vLevel = map.volumeLevel(old);
//one level of subdivision in the neighbordhood
// Traversor3VW<typename PFP::MAP> trav3EW(map, old);
// for(Dart dit = trav3EW.begin() ; dit != trav3EW.end() ; dit = trav3EW.next())
// {
// Dart oldit = map.volumeOldestDart(dit);
//
// //std::cout << "vLevel courant = " << map.volumeLevel(oldit) << std::endl;
//
// if(((vLevel+1) - map.volumeLevel(oldit)) > 1)
// IHM::subdivideVolumeClassic<PFP>(map, oldit, position);
// }
unsigned int degree = 0 ;
typename PFP::VEC3 p ;
Traversor2FE<typename PFP::MAP> travE(map, old);
for(Dart it = travE.begin(); it != travE.end() ; it = travE.next())
{
++degree;
p += position[it] ;
if(!map.edgeIsSubdivided(it)) // first cut the edges (if they are not already)
IHM::subdivideEdgeLoop<PFP>(map, it, position) ; // and compute the degree of the face
}
p /= typename PFP::REAL(degree) ;
map.setCurrentLevel(fLevel + 1) ; // go to the next level to perform face subdivision
Dart res;
if(degree == 3 && sType == IHM::S_TRI) //subdiviser une face triangulaire
{
Dart dd = map.phi1(old) ;
Dart e = map.phi1(map.phi1(dd)) ;
map.splitFace(dd, e) ; // insert a new edge
unsigned int id = map.getNewEdgeId() ;
map.setEdgeId(map.phi_1(dd), id, EDGE) ; // set the edge id of the inserted edge to the next available id
unsigned int idface = map.getFaceId(old);
map.setFaceId(dd, idface, FACE) ;
map.setFaceId(e, idface, FACE) ;
dd = e ;
e = map.phi1(map.phi1(dd)) ;
map.splitFace(dd, e) ;
id = map.getNewEdgeId() ;
map.setEdgeId(map.phi_1(dd), id, EDGE) ;
map.setFaceId(dd, idface, FACE) ;
map.setFaceId(e, idface, FACE) ;
dd = e ;
e = map.phi1(map.phi1(dd)) ;
map.splitFace(dd, e) ;
id = map.getNewEdgeId() ;
map.setEdgeId(map.phi_1(dd), id, EDGE) ;
map.setFaceId(dd, idface, FACE) ;
map.setFaceId(e, idface, FACE) ;
Dart stop = map.phi2(map.phi1(old));
Dart dit = stop;
do
{
unsigned int dId = map.getEdgeId(map.phi_1(map.phi2(dit)));
unsigned int eId = map.getEdgeId(map.phi1(map.phi2(dit)));
unsigned int t = dId + eId;
if(t == 0)
{
map.setEdgeId(dit, 1, EDGE) ;
map.setEdgeId(map.phi2(dit), 1, EDGE) ;
}
else if(t == 1)
{
map.setEdgeId(dit, 2, EDGE) ;
map.setEdgeId(map.phi2(dit), 2, EDGE) ;
}
else if(t == 2)
{
if(dId == eId)
{
map.setEdgeId(dit, 0, EDGE) ;
map.setEdgeId(map.phi2(dit), 0, EDGE) ;
}
else
{
map.setEdgeId(dit, 1, EDGE) ;
map.setEdgeId(map.phi2(dit), 1, EDGE) ;
}
}
else if(t == 3)
{
map.setEdgeId(dit, 0, EDGE) ;
map.setEdgeId(map.phi2(dit), 0, EDGE) ;
}
dit = map.phi1(dit);
}while(dit != stop);
}
else
{
Dart dd = map.phi1(old) ;
map.splitFace(dd, map.phi1(map.phi1(dd))) ;
Dart ne = map.phi2(map.phi_1(dd));
Dart ne2 = map.phi2(ne);
map.cutEdge(ne) ;
unsigned int id = map.getNewEdgeId() ;
map.setEdgeId(ne, id, EDGE) ;
id = map.getNewEdgeId() ;
map.setEdgeId(ne2, id, EDGE) ;
position[map.phi1(ne)] = p ;
dd = map.phi1(map.phi1(map.phi1(map.phi1(ne)))) ;
while(dd != ne)
{
Dart next = map.phi1(map.phi1(dd)) ;
map.splitFace(map.phi1(ne), dd) ;
Dart nne = map.phi2(map.phi_1(dd)) ;
id = map.getNewEdgeId() ;
map.setEdgeId(nne, id, EDGE) ;
dd = next ;
}
unsigned int idface = map.getFaceId(old);
//Dart e = dd;
do
{
map.setFaceId(dd, idface, DART) ;
map.setFaceId(map.phi2(dd), idface, DART) ;
dd = map.phi2(map.phi1(dd));
}
while(dd != ne);
position[map.phi1(ne)] = p ;
}
map.setCurrentLevel(cur) ;
}
template <typename PFP>
void subdivideLoop(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP::VEC3, VERTEX>& position)
{
......@@ -1152,7 +1360,7 @@ void subdivideLoop(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP
{
//if needed subdivide face
if(!map.faceIsSubdivided(dit))
IHM::subdivideFace<PFP>(map, dit, position, IHM::S_TRI);
IHM::subdivideFaceLoop<PFP>(map, dit, position, IHM::S_TRI);
//save a dart from the subdivided face
unsigned int cur = map.getCurrentLevel() ;
......@@ -1259,60 +1467,60 @@ void subdivideLoop(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP
}
}
//switch inner faces
if(isNotTet)
{
DartMarker me(map);
//switch inner faces
if(isNotTet)
{
DartMarker me(map);
for(Dart dit = traV.begin(); dit != traV.end(); dit = traV.next())
{
Dart x = map.phi_1(map.phi2(map.phi1(dit)));
Dart f = x;
for(Dart dit = traV.begin(); dit != traV.end(); dit = traV.next())
{
Dart x = map.phi_1(map.phi2(map.phi1(dit)));
Dart f = x;
do
{
Dart f3 = map.phi3(f);
do
{
Dart f3 = map.phi3(f);
if(!me.isMarked(f3))
{
Dart tmp = map.phi_1(map.phi2(map.phi_1(map.phi2(map.phi_1(f3))))); //future voisin par phi2
if(!me.isMarked(f3))
{
Dart tmp = map.phi_1(map.phi2(map.phi_1(map.phi2(map.phi_1(f3))))); //future voisin par phi2
Dart f32 = map.phi2(f3);
map.swapEdges(f3, tmp);
Dart f32 = map.phi2(f3);
map.swapEdges(f3, tmp);
unsigned int idface = map.getNewFaceId();
map.setFaceId(f3,idface, FACE);
idface = map.getNewFaceId();
map.setFaceId(f32,idface, FACE);
unsigned int idface = map.getNewFaceId();
map.setFaceId(f3,idface, FACE);
idface = map.getNewFaceId();
map.setFaceId(f32,idface, FACE);
unsigned int idedge = map.getNewEdgeId();
map.setEdgeId(f3, idedge, EDGE);
unsigned int idedge = map.getNewEdgeId();
map.setEdgeId(f3, idedge, EDGE);
map.setEdgeId(f3,map.getEdgeId(f3), EDGE);
map.setEdgeId(f32,map.getEdgeId(f32), EDGE);
map.setEdgeId(f3,map.getEdgeId(f3), EDGE);
map.setEdgeId(f32,map.getEdgeId(f32), EDGE);
me.markOrbit<EDGE>(f3);
me.markOrbit<EDGE>(f32);
}
me.markOrbit<EDGE>(f3);
me.markOrbit<EDGE>(f32);
}
f = map.phi2(map.phi_1(f));
}while(f != x);
}
f = map.phi2(map.phi_1(f));
}while(f != x);
}
map.template setOrbitEmbedding<VERTEX>(centralDart, map.template getEmbedding<VERTEX>(centralDart));
map.template setOrbitEmbedding<VERTEX>(centralDart, map.template getEmbedding<VERTEX>(centralDart));
//Third step : 3-sew internal faces
for (std::vector<std::pair<Dart,Dart> >::iterator it = subdividedfaces.begin(); it != subdividedfaces.end(); ++it)
{
Dart f1 = (*it).first;
Dart f2 = (*it).second;
//Third step : 3-sew internal faces
for (std::vector<std::pair<Dart,Dart> >::iterator it = subdividedfaces.begin(); it != subdividedfaces.end(); ++it)
{
Dart f1 = (*it).first;
Dart f2 = (*it).second;
unsigned int idedge = map.getEdgeId(f1);
map.setEdgeId(map.phi2(f1), idedge, EDGE);
map.setEdgeId(map.phi2(f2), idedge, EDGE);
}
unsigned int idedge = map.getEdgeId(f1);
map.setEdgeId(map.phi2(f1), idedge, EDGE);
map.setEdgeId(map.phi2(f2), idedge, EDGE);
}
}
}
map.setCurrentLevel(cur) ;
}
......
......@@ -529,9 +529,11 @@ Dart flip1To3(typename PFP::MAP& map, Dart d)
edges.push_back(dit);
map.splitVolume(edges);
map.splitFace(map.phi1(map.phi2(edges[0])),map.phi1(map.phi2(edges[2])));
// Cut the 2nd Tetrahedron
map.splitFace(map.phi1(map.phi2(edges[0])),map.phi1(map.phi2(edges[2])));
// Cut the 3rd Tetrahedron
dit = map.phi1(map.phi2(edges[0]));
edges.clear();
edges.push_back(dit);
......
......@@ -51,6 +51,11 @@ public:
{
}
virtual ~ParticleBase()
{
}
void setState(unsigned int state)
{
m_state = state ;
......
......@@ -57,6 +57,10 @@ public:
{
}
~ParticleCell2D()
{
}
Dart getCell()
{
return d ;
......
......@@ -191,7 +191,7 @@ void ParticleCell2D<PFP>::edgeState(const VEC3& goal, Geom::Orientation2D sideOf
float p2 = (P[0] - Pb[0]) * (Pa[1] - Pb[1]) - (Pa[0] - Pb[0]) * (P[1] - Pb[1]) ;
CGoGNout<<"p2 :"<<p2<<CGoGNendl;
CGoGNout<<"goal :"<<goal<<CGoGNendl;
#endif
assert(goal.isFinite()) ;
......
......@@ -42,7 +42,10 @@ public:
ParticleCell2DMemo(MAP& map, Dart belonging_cell, VEC3 pos, const TAB_POS& tabPos) :
ParticleCell2D<PFP>(map, belonging_cell, pos, tabPos)
{
}
virtual ~ParticleCell2DMemo()
{
}
virtual void vertexState(const VEC3& current, CellMarkerMemo<FACE>& memo_cross) ;
......
......@@ -40,7 +40,12 @@ public:
ParticleCell2DSecured(MAP& map, Dart belonging_cell, VEC3 pos, const TAB_POS& tabPos) :
ParticleCell2DMemo<PFP>(map, belonging_cell, pos, tabPos)
{
std::cout << "Particle Memo : for debugging (unoptimized)" << std::endl;
// std::cout << "Particle Memo : for debugging (unoptimized)" << std::endl;
}