Commit 8f6a48f5 authored by Thomas Pitiot 's avatar Thomas Pitiot

tout reparé ? Oo

parent 005e0485
......@@ -2,8 +2,8 @@
#define ENV_MAP_H
#define DEBUG_affichage
#define DEBUG
//#define DEBUG_affichage
//#define DEBUG
#include <iostream>
#include <algorithm>
......@@ -191,8 +191,11 @@ inline std::vector<Dart> EnvMap::getMemoCross(const VEC3& pos, const VEC3& dest,
inline void EnvMap::FindNeighborCellsOfSegment (const std::vector<Dart>& belonging_cells, std::vector<Dart> *neighbor_cells)
{
#ifdef IHMap
assert(map.getCurrentLevel() == map.getMaxLevel());
#endif
assert(!belonging_cells.empty());
neighbor_cells->clear();
CellMarkerMemo<MAP,VOLUME> memo_mark(map); //marqueur des cellules "présentes"
CellMarkerMemo<MAP,VOLUME> OneRingMark(map); // marquer des cellules voisines
......@@ -227,7 +230,9 @@ inline void EnvMap::FindNeighborCellsOfSegment (const std::vector<Dart>& belongi
inline void EnvMap::pushSegmentInCellAsNeighbor(Segment* o, Dart d)
{
#ifdef IHMap
assert(map.getCurrentLevel() == map.getMaxLevel());
#endif
assert(std::find(RegisteredNeighborEdges[d].begin(), RegisteredNeighborEdges[d].end(), o) == RegisteredNeighborEdges[d].end());
addElementToVector<Segment*>(RegisteredNeighborEdges[d],o);
......@@ -236,7 +241,9 @@ inline void EnvMap::pushSegmentInCellAsNeighbor(Segment* o, Dart d)
inline void EnvMap::popSegmentInCellAsNeighbor(Segment* o, Dart d)
{
#ifdef IHMap
assert(map.getCurrentLevel() == map.getMaxLevel());
#endif
assert(std::find(RegisteredNeighborEdges[d].begin(), RegisteredNeighborEdges[d].end(), o) != RegisteredNeighborEdges[d].end());
removeElementFromVector<Segment*>(RegisteredNeighborEdges[d],o);
......
......@@ -124,7 +124,7 @@ public:
public:
Volusion():
render_volumes(true),
render_volumes(false),
render_edges(true),
render_topo(false),
render_MovingObject(true),
......
This diff is collapsed.
......@@ -41,7 +41,7 @@ Needle::Needle(Simulator* sim,std::pair<VEC3, Dart> startingPoint)
createEdge(0);
#ifdef IHMap
// refine();
refine();
#endif
}
......@@ -213,17 +213,11 @@ void Needle::move(VEC3 diff)
#endif
}
}
void Needle::updateRegistration()
{
Segment* o = Segments_[nbEdges-1];
o->p1 = parts_[o->indexPart1]->getPosition();
o->p2 = parts_[o->indexPart2]->getPosition();
......@@ -257,6 +251,7 @@ void Needle::updateRegistration()
void Needle::refine()
{
#ifdef IHMap
Dart volume = parts_[0]->d;
volume = sim_->envMap_.map.volumeOldestDart(volume);
PFP::VEC3 edge = Algo::Surface::Geometry::vectorOutOfDart<PFP>(sim_->envMap_.map, volume, sim_->envMap_.position) ;
......@@ -264,10 +259,10 @@ void Needle::refine()
{
if(sim_->envMap_.subdivideVolume(volume))
{
// refine();
refine();
}
}
#endif
}
......@@ -25,7 +25,7 @@ void Simulator::init(int argc, char **argv)
Needle_or_knife = atoi(argv[1]) ;
// Needle_or_knife=false;
initFixedObjects();
// initFixedObjects();
initMovingObject();
// initEmptyMovingObject();
......@@ -45,15 +45,15 @@ void Simulator::initFixedObjects()
std::pair<unsigned int,unsigned int> ind;
VEC3 pos;
// pos=VEC3(2.21,3.02,3.53);
// p.first=pos;
// p.second=envMap_.getBelongingCell(pos);
// startingPoints.push_back(p);
pos=VEC3(2.21,3.02,3.53);
p.first=pos;
p.second=envMap_.getBelongingCell(pos);
startingPoints.push_back(p);
// pos=VEC3(-4.68,1.36,2.15);
// p.first=pos;
// p.second=envMap_.getBelongingCell(pos);
// startingPoints.push_back(p);
pos=VEC3(-4.68,1.36,2.15);
p.first=pos;
p.second=envMap_.getBelongingCell(pos);
startingPoints.push_back(p);
pos=VEC3(4,-2,3);
p.first=pos;
......@@ -74,13 +74,13 @@ void Simulator::initFixedObjects()
ind.second=1;
segmentParts.push_back(ind);
// ind.first=2;
// ind.second=3;
// segmentParts.push_back(ind);
ind.first=2;
ind.second=3;
segmentParts.push_back(ind);
// ind.first=0;
// ind.second=2;
// segmentParts.push_back(ind);
ind.first=0;
ind.second=2;
segmentParts.push_back(ind);
// ind.first=0;
// ind.second=4;
// segmentParts.push_back(ind);
......
......@@ -154,11 +154,20 @@ void Volusion::cb_keyPress(int code)
{
case 'r' :
{
#ifndef IHMap
// simul.envMap_.popSegment(simul.objects[0]->Segments_[0]);
// simul.envMap_.resetPartSubdiv(simul.objects[0]->Segments_[0]);
// simul.envMap_.FirstRegistrationSegment(simul.objects[0]->Segments_[0]);
#else
simul.aiguille->refine();
m_MovingObjectVBO->updateData(simul.envMap_.position);
updateGL() ;
#endif
break;
}
......@@ -343,32 +352,57 @@ void Volusion::cb_redraw()
m_ds->lineWidth(10.0f);
m_ds->newList(GL_COMPILE_AND_EXECUTE);
m_ds->begin(GL_LINE_STRIP);
m_ds->lineWidth(10.0f);
if(art->nbEdges>0)
{
VEC3 origin = art->Segments_[0]->p1;
m_ds->vertex(origin);
}
for(Segment * s : art->Segments_)
{
m_ds->newList(GL_COMPILE_AND_EXECUTE);
m_ds->begin(GL_LINE_STRIP);
m_ds->color3f(s->r,s->g,s->b);
m_ds->vertex(s->p1);
m_ds->vertex(s->p2);
m_ds->end();
m_ds->endList();
VEC3 p = s->p2;
m_ds->vertex(p);
}
m_ds->color3f(0,0.5f,1.0f);
m_ds->end();
m_ds->endList();
// VEC3 pos1 = art->parts_[0]->getPosition();
// VEC3 pos2 = art->parts_[1]->getPosition();
// float f;
// VEC3 cylinder_axis =cylinder->getAxisScale(2,f);
PFP::VEC3* data = static_cast<PFP::VEC3*>(m_MovingObjectVBO->lockPtr());
int i=0;
for(auto particule : art->parts_)
{
VEC3 p = particule->getPosition();
// if(i==0)
// {
// m_topo_render->overdrawDart(particule->d,15.0f,1.0f,0.5f,1.0f);
// m_topo_render->updateData(simul.envMap_.map, simul.envMap_.position, 0.8f, 0.8f, 0.8f);
// }
data[i] = p;
i++;
}
// VEC3 pos1 = simul.aiguille->parts_[0]->getPosition();
// VEC3 pos2 = simul.aiguille->parts_[1]->getPosition();
// float f;
// VEC3 cylinder_axis =cylinder->getAxisScale(2,f);
m_MovingObjectVBO->releasePtr();
// m_frame_MovingObject->draw();
// CGoGNout<<Geom::angle(pos2-pos1,cylinder_axis)<<CGoGNendl;
// cylinder->rotate(Geom::angle(pos2-pos1,cylinder_axis),cylinder_axis^(pos2-pos1));
// m_frame_MovingObject->draw();
// CGoGNout<<Geom::angle(pos2-pos1,cylinder_axis)<<CGoGNendl;
// cylinder->rotate(Geom::angle(pos2-pos1,cylinder_axis),cylinder_axis^(pos2-pos1));
// cylinder->translate((((pos1+pos2)/2)-cylinder->getPosition())/2);
// cylinder->draw();
// cylinder->translate((((pos1+pos2)/2)-cylinder->getPosition())/2);
// cylinder->draw();
m_sprite->enableVertexAttribs();
glDrawArrays(GL_POINTS, 0, art->nbVertices);
m_sprite->disableVertexAttribs();
}
......@@ -736,7 +770,7 @@ int main(int argc, char **argv)
sqt.dock.checkBox_neighbors->setChecked(false);
sqt.dock.checkBox_plane->setChecked(false);
sqt.dock.checkBox_hide->setChecked(true);
sqt.dock.checkBox_volumes->setChecked(false);
sqt.dock.spinBox_dart->setRange(0, sqt.simul.envMap_.map.end().index) ;
sqt.dock.comboBoxEdge->addItem("Aiguille entiere",2);
......
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