Commit 3e3734b2 authored by Thomas Pitiot 's avatar Thomas Pitiot

merged

parents bb14948f c849c0ae
...@@ -28,7 +28,7 @@ public : ...@@ -28,7 +28,7 @@ public :
return parts_[(Segments_[index])->indexPart1]->getPosition(); return parts_[(Segments_[index])->indexPart1]->getPosition();
} }
const PARTICULE* getParticule(int index) const const Particule* getParticule(int index) const
{ {
return parts_[index]; return parts_[index];
} }
...@@ -55,7 +55,7 @@ public : ...@@ -55,7 +55,7 @@ public :
unsigned int nbVertices; unsigned int nbVertices;
unsigned int nbEdges; unsigned int nbEdges;
std::vector<PARTICULE*> parts_ ; std::vector<Particule*> parts_ ;
std::vector<Segment *> Segments_; std::vector<Segment *> Segments_;
std::vector< std::vector<Dart> > belonging_cells; std::vector< std::vector<Dart> > belonging_cells;
......
...@@ -38,8 +38,8 @@ using namespace CGoGN ; ...@@ -38,8 +38,8 @@ using namespace CGoGN ;
#include "triangle.h" #include "triangle.h"
typedef CGoGN::Algo::Volume::MovingObjects::ParticleCell3D<PFP> PARTICULE; typedef CGoGN::Algo::Volume::MovingObjects::ParticleCell3D<PFP> Particule;
typedef CGoGN::Algo::Volume::MovingObjects::ParticleCell3DMemo<PFP> PARTICULEMEMO; typedef CGoGN::Algo::Volume::MovingObjects::ParticleCell3DMemo<PFP> ParticuleMemo;
class EnvMap class EnvMap
{ {
......
...@@ -25,24 +25,12 @@ class Surface ...@@ -25,24 +25,12 @@ class Surface
{ {
public: public:
Surface(Simulator* sim, VEC3 offset) ; Surface(Simulator* sim, VEC3 offset) ;
~Surface();
const VEC3& getPosition(int index) const
VEC3 getPosition(int index); {
unsigned int nbVertices; return parts_[index]->getPosition();
unsigned int nbTriangles; }
std::vector<PARTICULE*> parts_ ;
std::vector<Triangle *> triangles_;
SURFACE surfaceMap; // map
CGoGN::Algo::MR::Primal::Adaptive::IHM2<PFPSurface> mapOperator;
VertexAttribute<VEC3, SURFACE> positionSurface ; //position
VertexAttribute<int, SURFACE> indexParticule; // index des particules de chaque sommet
FaceAttribute<int, SURFACE> indexTriangle;
FaceAttribute<VEC3,SURFACE> faceColor;
void initPlane(); //initialisation d'une grille void initPlane(); //initialisation d'une grille
...@@ -75,6 +63,19 @@ public: ...@@ -75,6 +63,19 @@ public:
unsigned int nbVertices;
unsigned int nbTriangles;
std::vector<Particule*> parts_ ;
std::vector<Triangle *> triangles_;
SURFACE surfaceMap; // map
CGoGN::Algo::MR::Primal::Adaptive::IHM2<PFPSurface> mapOperator;
VertexAttribute<VEC3, SURFACE> positionSurface ; //position
VertexAttribute<int, SURFACE> indexParticule; // index des particules de chaque sommet
FaceAttribute<int, SURFACE> indexTriangle;
FaceAttribute<VEC3,SURFACE> faceColor;
// visualisation // visualisation
void initGL(); // initialisation GL void initGL(); // initialisation GL
void draw(); // redessiner l'objet void draw(); // redessiner l'objet
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
ArticulatedObject::ArticulatedObject() : ArticulatedObject::ArticulatedObject() :
nbVertices(0u) nbVertices(0u)
,nbEdges(0u) ,nbEdges(0u)
,parts_(std::vector<PARTICULE*>()) ,parts_(std::vector<Particule*>())
,Segments_(std::vector<Segment *>()) ,Segments_(std::vector<Segment *>())
,belonging_cells(std::vector<std::vector<Dart>>()) ,belonging_cells(std::vector<std::vector<Dart>>())
,neighbor_cells(std::vector<std::vector<Dart>>()) ,neighbor_cells(std::vector<std::vector<Dart>>())
......
...@@ -438,7 +438,7 @@ void EnvMap::FirstRegistrationTriangle(Triangle * o)// réenregistre l'Triangle ...@@ -438,7 +438,7 @@ void EnvMap::FirstRegistrationTriangle(Triangle * o)// réenregistre l'Triangle
Dart cell2=mo->surfaceMap.phi1(e); Dart cell2=mo->surfaceMap.phi1(e);
// on récupère les aprticules correspondant a chaque edge du triangle a enregistrer // on récupère les aprticules correspondant a chaque edge du triangle a enregistrer
PARTICULE * p1 = mo->parts_[mo->indexParticule[cell]]; Particule * p1 = mo->parts_[mo->indexParticule[cell]];
Dart d1=p1->d; // darts de la carte 3D contenant les particules Dart d1=p1->d; // darts de la carte 3D contenant les particules
...@@ -595,40 +595,41 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference) ...@@ -595,40 +595,41 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference)
// map.check(); // map.check();
map.setCurrentLevel(map.getMaxLevel()) ; map.setCurrentLevel(map.getMaxLevel()) ;
ARETES oldobst(RegisteredEdges[dglobal]) ; const ARETES& oldobst(RegisteredEdges[dglobal]) ;
for (Segment * o : oldobst) for (Segment * o : oldobst)
{ {
this->popSegment(o) ; this->popSegment(o) ;
} }
ARETES oldNeighborObst(RegisteredNeighborEdges[old]) ; ARETES& oldNeighborObst(RegisteredNeighborEdges[old]) ;
for (Segment * o : oldNeighborObst) for (Segment * o : oldNeighborObst)
{ {
// this->popSegment(o) ; // old version // this->popSegment(o) ; // old version
removeElementFromVector(RegisteredNeighborEdges[old], o) ; // removeElementFromVector(RegisteredNeighborEdges[old], o) ;
removeElementFromVector(o->nid->neighbor_cells[o->index],old); removeElementFromVector(o->nid->neighbor_cells[o->index],old);
o->nid->removeGeneralNeighbor (old); o->nid->removeGeneralNeighbor (old);
} }
oldNeighborObst.clear();
TRIANGLES oldTrian(RegisteredTriangles[dglobal]) ; const TRIANGLES& oldTrian(RegisteredTriangles[dglobal]) ;
for (Triangle * o : oldTrian) for (Triangle * o : oldTrian)
{ {
this->popTriangle(o) ; this->popTriangle(o) ;
} }
TRIANGLES oldTrianNeighbor(RegisteredNeighborTriangles[old]) ; TRIANGLES& oldTrianNeighbor(RegisteredNeighborTriangles[old]) ;
for (Triangle * o : oldTrianNeighbor) for (Triangle * o : oldTrianNeighbor)
{ {
// this->popTriangle(o) ; // old version // this->popTriangle(o) ; // old version
removeElementFromVector(RegisteredNeighborTriangles[old], o) ; // removeElementFromVector(RegisteredNeighborTriangles[old], o) ;
removeElementFromVector(o->surf->neighbor_cells[o->indexTri],old); removeElementFromVector(o->surf->neighbor_cells[o->indexTri],old);
o->surf->removeGeneralNeighbor (old); o->surf->removeGeneralNeighbor (old);
} }
oldTrianNeighbor.clear();
const std::chrono::time_point<std::chrono::system_clock> endPop = std::chrono::system_clock::now(); const std::chrono::time_point<std::chrono::system_clock> endPop = std::chrono::system_clock::now();
duration_pop = endPop - startPop; duration_pop = endPop - startPop;
...@@ -803,9 +804,9 @@ void EnvMap::resetPartSubdiv(Triangle * o) ...@@ -803,9 +804,9 @@ void EnvMap::resetPartSubdiv(Triangle * o)
Dart cell =o->cell; Dart cell =o->cell;
Dart cell2 = mo->surfaceMap.phi1(cell); Dart cell2 = mo->surfaceMap.phi1(cell);
Dart cell3 = mo->surfaceMap.phi1(cell2); Dart cell3 = mo->surfaceMap.phi1(cell2);
PARTICULE * p = mo->parts_[mo->indexParticule[cell]]; Particule * p = mo->parts_[mo->indexParticule[cell]];
PARTICULE * p2 = mo->parts_[mo->indexParticule[cell2]]; Particule * p2 = mo->parts_[mo->indexParticule[cell2]];
PARTICULE * p3 = mo->parts_[mo->indexParticule[cell3]]; Particule * p3 = mo->parts_[mo->indexParticule[cell3]];
if (mo != NULL) if (mo != NULL)
{ {
......
...@@ -35,21 +35,22 @@ Surface::Surface(Simulator* sim,VEC3 offset): ...@@ -35,21 +35,22 @@ Surface::Surface(Simulator* sim,VEC3 offset):
{ {
positionSurface[d]+=offset; positionSurface[d]+=offset;
indexParticule[d]=nbVertices; indexParticule[d]=nbVertices;
parts_.push_back(new CGoGN::Algo::Volume::MovingObjects::ParticleCell3D<PFP>(sim_->envMap_.map, sim_->envMap_.getBelongingCell(positionSurface[d]), positionSurface[d] , sim_->envMap_.position)); parts_.push_back(new Particule(sim_->envMap_.map, sim_->envMap_.getBelongingCell(positionSurface[d]), positionSurface[d] , sim_->envMap_.position));
nbVertices ++; nbVertices ++;
} }
// initialisation tableaux de vecteurs qui vont stocker les belonging cells // initialisation tableaux de vecteurs qui vont stocker les belonging cells
TraversorE<SURFACE> tF2(surfaceMap); TraversorE<SURFACE> tF2(surfaceMap);
for(Dart d = tF2.begin() ; d != tF2.end() ; d = tF2.next()) for(Dart d = tF2.begin(), end = tF2.end() ; d != end ; d = tF2.next())
{ {
nbTriangles ++; nbTriangles ++;
} }
belonging_cells.resize(nbTriangles);
neighbor_cells.resize(nbTriangles);
// initialisation des segments et des attributs d'edge // initialisation des segments et des attributs d'edge
TraversorF<SURFACE> tE(surfaceMap); TraversorF<SURFACE> tE(surfaceMap);
for(Dart d = tE.begin() ; d != tE.end() ; d = tE.next()) for(Dart d = tE.begin() , end = tE.end(); d != end ; d = tE.next())
{ {
faceColor[d]=VEC3(r,g,b); faceColor[d]=VEC3(r,g,b);
#ifdef DEBUG_affichage #ifdef DEBUG_affichage
...@@ -63,7 +64,6 @@ Surface::Surface(Simulator* sim,VEC3 offset): ...@@ -63,7 +64,6 @@ Surface::Surface(Simulator* sim,VEC3 offset):
triangles_.push_back(o); triangles_.push_back(o);
sim_->envMap_.FirstRegistrationTriangle(o); sim_->envMap_.FirstRegistrationTriangle(o);
} }
...@@ -78,7 +78,16 @@ Surface::Surface(Simulator* sim,VEC3 offset): ...@@ -78,7 +78,16 @@ Surface::Surface(Simulator* sim,VEC3 offset):
// for(Dart d = tv.begin() ; d != tv.end() ; d = tv.next()) // for(Dart d = tv.begin() ; d != tv.end() ; d = tv.next())
// { // {
// CGoGNout<<" position dart :"<<d<<" || : "<<positionSurface[d]<<CGoGNendl ; // CGoGNout<<" position dart :"<<d<<" || : "<<positionSurface[d]<<CGoGNendl ;
// } // }
}
Surface::~Surface()
{
for (auto p : parts_)
delete p;
for (auto t : triangles_)
delete t;
} }
void Surface::initGL() void Surface::initGL()
...@@ -367,9 +376,4 @@ bool Surface::removeGeneralNeighbor (Dart d) ...@@ -367,9 +376,4 @@ bool Surface::removeGeneralNeighbor (Dart d)
} }
VEC3 Surface::getPosition(int index)
{
return parts_[index]->getPosition();
}
...@@ -847,27 +847,21 @@ void Volusion::cb_mouseMove(int buttons, int x, int y) ...@@ -847,27 +847,21 @@ void Volusion::cb_mouseMove(int buttons, int x, int y)
int main(int argc, char **argv) void setupQtWidgets(char **argv, int argc,Volusion& sqt)
{ {
sqt.simul.init(argc,argv);
// interface de tuto5.ui
// un peu d'interface
QApplication app(argc, argv);
Volusion sqt;
sqt.simul.init(argc,argv);
// interface de tuto5.ui
sqt.setDock(&(sqt.dock)); sqt.setDock(&(sqt.dock));
// bounding box // bounding box
Geom::BoundingBox<VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(sqt.simul.envMap_.map, sqt.simul.envMap_.position); Geom::BoundingBox<VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(sqt.simul.envMap_.map, sqt.simul.envMap_.position);
sqt.m_WidthObj = std::max<REAL>(std::max<REAL>(bb.size(0), bb.size(1)), bb.size(2)); sqt.m_WidthObj = std::max<REAL>(std::max<REAL>(bb.size(0), bb.size(1)), bb.size(2));
sqt.m_PosObj = (bb.min() + bb.max()) / REAL(2); sqt.m_PosObj = (bb.min() + bb.max()) / REAL(2);
// envoit info BB a l'interface // envoit info BB a l'interface
sqt.setParamObject(sqt.m_WidthObj, sqt.m_PosObj.data()); sqt.setParamObject(sqt.m_WidthObj, sqt.m_PosObj.data());
sqt.setCallBack( sqt.dock.checkBox_volumes, SIGNAL(toggled(bool)), SLOT(volumes_onoff(bool)) ); sqt.setCallBack( sqt.dock.checkBox_volumes, SIGNAL(toggled(bool)), SLOT(volumes_onoff(bool)) );
sqt.setCallBack( sqt.dock.checkBox_edges, SIGNAL(toggled(bool)), SLOT(edges_onoff(bool)) ); sqt.setCallBack( sqt.dock.checkBox_edges, SIGNAL(toggled(bool)), SLOT(edges_onoff(bool)) );
...@@ -878,9 +872,9 @@ int main(int argc, char **argv) ...@@ -878,9 +872,9 @@ int main(int argc, char **argv)
sqt.setCallBack( sqt.dock.checkBox_displayobjects, SIGNAL(toggled(bool)), SLOT(obj_onoff(bool)) ); sqt.setCallBack( sqt.dock.checkBox_displayobjects, SIGNAL(toggled(bool)), SLOT(obj_onoff(bool)) );
sqt.setCallBack( sqt.dock.checkBox_ObjBelong, SIGNAL(toggled(bool)), SLOT(objBelong_onoff(bool)) ); sqt.setCallBack( sqt.dock.checkBox_ObjBelong, SIGNAL(toggled(bool)), SLOT(objBelong_onoff(bool)) );
sqt.setCallBack( sqt.dock.checkBox_ObjNeighbors, SIGNAL(toggled(bool)), SLOT(objNeighbors_onoff(bool)) ); sqt.setCallBack( sqt.dock.checkBox_ObjNeighbors, SIGNAL(toggled(bool)), SLOT(objNeighbors_onoff(bool)) );
// sqt.setCallBack( sqt.dock.checkBox_hide, SIGNAL(toggled(bool)), SLOT(hide_onoff(bool)) ); // sqt.setCallBack( sqt.dock.checkBox_hide, SIGNAL(toggled(bool)), SLOT(hide_onoff(bool)) );
// sqt.setCallBack( sqt.dock.checkBox_plane, SIGNAL(toggled(bool)), SLOT(clipping_onoff(bool)) ); // sqt.setCallBack( sqt.dock.checkBox_plane, SIGNAL(toggled(bool)), SLOT(clipping_onoff(bool)) );
sqt.setCallBack( sqt.dock.comboBoxEdge, SIGNAL( activated(int)), SLOT(comboEdge(int)) ); sqt.setCallBack( sqt.dock.comboBoxEdge, SIGNAL( activated(int)), SLOT(comboEdge(int)) );
sqt.setCallBack( sqt.dock.slider_explode, SIGNAL(sliderPressed()), SLOT(slider_pressed()) ); sqt.setCallBack( sqt.dock.slider_explode, SIGNAL(sliderPressed()), SLOT(slider_pressed()) );
sqt.setCallBack( sqt.dock.slider_explode, SIGNAL(sliderReleased()), SLOT(slider_released()) ); sqt.setCallBack( sqt.dock.slider_explode, SIGNAL(sliderReleased()), SLOT(slider_released()) );
sqt.setCallBack(sqt.dock.spinBox_dart, SIGNAL(valueChanged(int)), SLOT(slot_slide(int))) ; sqt.setCallBack(sqt.dock.spinBox_dart, SIGNAL(valueChanged(int)), SLOT(slot_slide(int))) ;
...@@ -890,12 +884,12 @@ int main(int argc, char **argv) ...@@ -890,12 +884,12 @@ int main(int argc, char **argv)
sqt.setCallBack( sqt.dock.slider_explode_face, SIGNAL(sliderPressed()), SLOT(slider_pressed()) ); sqt.setCallBack( sqt.dock.slider_explode_face, SIGNAL(sliderPressed()), SLOT(slider_pressed()) );
sqt.setCallBack( sqt.dock.slider_explode_face, SIGNAL(sliderReleased()), SLOT(slider_released()) ); sqt.setCallBack( sqt.dock.slider_explode_face, SIGNAL(sliderReleased()), SLOT(slider_released()) );
sqt.show(); sqt.show();
sqt.dock.slider_explode->setValue(100); sqt.dock.slider_explode->setValue(100);
sqt.dock.slider_explode_face->setValue(100); sqt.dock.slider_explode_face->setValue(100);
// sqt.clipping_onoff(false); // sqt.clipping_onoff(false);
sqt.topo_onoff(false); sqt.topo_onoff(false);
sqt.edges_onoff(true); sqt.edges_onoff(true);
sqt.dock.checkBox_MovingObject->setChecked(true); sqt.dock.checkBox_MovingObject->setChecked(true);
sqt.dock.checkBox_displayobjects->setChecked(true); sqt.dock.checkBox_displayobjects->setChecked(true);
sqt.dock.checkBox_ObjBelong->setChecked(false); sqt.dock.checkBox_ObjBelong->setChecked(false);
...@@ -903,8 +897,8 @@ int main(int argc, char **argv) ...@@ -903,8 +897,8 @@ int main(int argc, char **argv)
sqt.dock.checkBox_topo->setChecked(false); sqt.dock.checkBox_topo->setChecked(false);
sqt.dock.checkBox_belonging->setChecked(false); sqt.dock.checkBox_belonging->setChecked(false);
sqt.dock.checkBox_neighbors->setChecked(false); sqt.dock.checkBox_neighbors->setChecked(false);
// sqt.dock.checkBox_plane->setChecked(false); // sqt.dock.checkBox_plane->setChecked(false);
// sqt.dock.checkBox_hide->setChecked(true); // sqt.dock.checkBox_hide->setChecked(true);
sqt.dock.checkBox_volumes->setChecked(false); sqt.dock.checkBox_volumes->setChecked(false);
sqt.dock.spinBox_dart->setRange(0, sqt.simul.envMap_.map.end().index) ; sqt.dock.spinBox_dart->setRange(0, sqt.simul.envMap_.map.end().index) ;
...@@ -916,6 +910,14 @@ int main(int argc, char **argv) ...@@ -916,6 +910,14 @@ int main(int argc, char **argv)
const QString& s=oss.str().c_str(); const QString& s=oss.str().c_str();
sqt.dock.comboBoxEdge->addItem(s,2); sqt.dock.comboBoxEdge->addItem(s,2);
} }
}
int main(int argc, char **argv)
{
// un peu d'interface
QApplication app(argc, argv);
Volusion sqt;
setupQtWidgets(argv, argc, sqt);
// et on attend la fin. // et on attend la fin.
return app.exec(); return app.exec();
......
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