Commit abed34a2 authored by Etienne Schmitt's avatar Etienne Schmitt

added getter method to access to the particules & to the cell

Signed-off-by: Etienne Schmitt's avatarÉtienne Schmitt <etienne.schmitt@inria.fr>
parent c0275889
...@@ -20,18 +20,22 @@ public : ...@@ -20,18 +20,22 @@ public :
inline const VEC3& getPosition(int index) const inline const VEC3& getPosition(int index) const
{ {
return parts_[index]->getPosition(); return getParticule(index)->getPosition();
} }
const VEC3& getPositionSegment(int index) const const VEC3& getPositionSegment(int index) const
{ {
return parts_[(Segments_[index])->indexPart1]->getPosition(); return getParticule((Segments_[index])->indexPart1)->getPosition();
} }
const Particule* getParticule(int index) const const Particule* getParticule(int index) const
{ {
return parts_[index]; return parts_[index];
} }
Particule* getParticule(int index)
{
return parts_[index];
}
const Segment* getSegment(int index) const const Segment* getSegment(int index) const
{ {
......
...@@ -27,9 +27,19 @@ public: ...@@ -27,9 +27,19 @@ public:
Surface(Simulator* sim, VEC3 offset) ; Surface(Simulator* sim, VEC3 offset) ;
~Surface(); ~Surface();
const VEC3& getPosition(int index) const inline const VEC3& getPosition(int index) const
{ {
return parts_[index]->getPosition(); return getParticule(index)->getPosition();
}
inline const Particule* getParticule(int index) const
{
return parts_[index];
}
inline Particule* getParticule(int index)
{
return parts_[index];
} }
......
...@@ -148,19 +148,19 @@ bool ArticulatedObject::removeGeneralNeighbor (Dart d) ...@@ -148,19 +148,19 @@ bool ArticulatedObject::removeGeneralNeighbor (Dart d)
// default : n2 =(n+1)%(mo->nbVertices); break; // default : n2 =(n+1)%(mo->nbVertices); break;
// } // }
// //////// // ////////
// VEC3 pos = mo->parts_[n]->getPosition(); // VEC3 pos = mo->getParticule(n)->getPosition();
// VEC3 pos2 = mo->parts_[n2]->getPosition(); // VEC3 pos2 = mo->getParticule(n2)->getPosition();
// mo->parts_[n]->CGoGN::Algo::MovingObjects::ParticleBase<PFP>::move(Algo::Volume::Geometry::faceCentroid<PFP>(mo->sim_->envMap_.map, mo->parts_[n]->d, mo->sim_->envMap_.position)) ; // mo->getParticule(n]->CGoGN::Algo::MovingObjects::ParticleBase<PFP>::move(Algo::Volume::Geometry::faceCentroid<PFP>(mo->sim_->envMap_.map, mo->parts_[n)->getCell(), mo->sim_->envMap_.position)) ;
// //
// mo->parts_[n]->setState(VOLUME) ; // mo->getParticule(n)->setState(VOLUME) ;
// mo->parts_[n]->move(pos) ; // mo->getParticule(n)->move(pos) ;
// //
// mo->parts_[n2]->CGoGN::Algo::MovingObjects::ParticleBase<PFP>::move(Algo::Volume::Geometry::faceCentroid<PFP>(mo->sim_->envMap_.map, mo->parts_[n2]->d, mo->sim_->envMap_.position)) ; // mo->getParticule(n2]->CGoGN::Algo::MovingObjects::ParticleBase<PFP>::move(Algo::Volume::Geometry::faceCentroid<PFP>(mo->sim_->envMap_.map, mo->parts_[n2)->getCell(), mo->sim_->envMap_.position)) ;
// //
// mo->parts_[n2]->setState(VOLUME) ; // mo->getParticule(n2)->setState(VOLUME) ;
// mo->parts_[n2]->move(pos2) ; // mo->getParticule(n2)->move(pos2) ;
// //
// mo->dDir = mo->parts_[0]->d; // mo->dDir = mo->getParticule(0)->getCell();
// } // }
//} //}
// //
...@@ -180,16 +180,16 @@ bool ArticulatedObject::removeGeneralNeighbor (Dart d) ...@@ -180,16 +180,16 @@ bool ArticulatedObject::removeGeneralNeighbor (Dart d)
// default : n2 =(n+1)%(mo->nbVertices); break; // default : n2 =(n+1)%(mo->nbVertices); break;
// } // }
// //////// // ////////
// VEC3 pos1 = mo->parts_[n]->getPosition(); // VEC3 pos1 = mo->getParticule(n)->getPosition();
// VEC3 pos2 = mo->parts_[n2]->getPosition(); // VEC3 pos2 = mo->getParticule(n2)->getPosition();
//// if (Algo::Volume::Geometry::isPointInConvexFace2D <PFP> (mo->sim_->envMap_.map, d1, mo->sim_->envMap_.position, pos1, true)) //// if (Algo::Volume::Geometry::isPointInConvexFace2D <PFP> (mo->sim_->envMap_.map, d1, mo->sim_->envMap_.position, pos1, true))
// if ( mo->sim_->envMap_.is_insideConvexCell2D(pos1, d1)) // if ( mo->sim_->envMap_.is_insideConvexCell2D(pos1, d1))
// mo->parts_[n]->d = d1; // mo->getParticule(n)->getCell() = d1;
//// if (Algo::Volume::Geometry::isPointInConvexFace2D <PFP> (mo->sim_->envMap_.map, d1, mo->sim_->envMap_.position, pos2, true)) //// if (Algo::Volume::Geometry::isPointInConvexFace2D <PFP> (mo->sim_->envMap_.map, d1, mo->sim_->envMap_.position, pos2, true))
// if ( mo->sim_->envMap_.is_insideConvexCell2D(pos2, d1)) // if ( mo->sim_->envMap_.is_insideConvexCell2D(pos2, d1))
// mo->parts_[n2]->d = d1; // mo->getParticule(n2)->getCell() = d1;
// if(n==0) // if(n==0)
// mo->dDir = mo->parts_[0]->d; // mo->dDir = mo->getParticule(0)->getCell();
// } // }
//} //}
...@@ -203,11 +203,11 @@ bool ArticulatedObject::removeGeneralNeighbor (Dart d) ...@@ -203,11 +203,11 @@ bool ArticulatedObject::removeGeneralNeighbor (Dart d)
// int n2 = o->indexPart2; // int n2 = o->indexPart2;
// if (nid->parts_[n1]->d == nid->sim_->envMap_.map.phi1(d1)) // if (nid->getParticule(n1)->getCell() == nid->sim_->envMap_.map.phi1(d1))
// nid->parts_[n1]->d = d1; // nid->getParticule(n1)->getCell() = d1;
// if (nid->parts_[n2]->d == nid->sim_->envMap_.map.phi1(d1)) // if (nid->getParticule(n2)->getCell() == nid->sim_->envMap_.map.phi1(d1))
// nid->parts_[n2]->d = d1; // nid->getParticule(n2)->getCell() = d1;
// } // }
......
...@@ -277,8 +277,8 @@ void EnvMap::FirstRegistrationSegment(Segment * o)// réenregistre l'Segment en ...@@ -277,8 +277,8 @@ void EnvMap::FirstRegistrationSegment(Segment * o)// réenregistre l'Segment en
VEC3 p1 = o->p1; VEC3 p1 = o->p1;
VEC3 p2 = o->p2; VEC3 p2 = o->p2;
Dart d1=mo->parts_[n1]->d; Dart d1=mo->getParticule(n1)->getCell();
// Dart d2=mo->parts_[n2]->d; // Dart d2=mo->getParticule(n2)->getCell();
std::vector<Dart> memo; std::vector<Dart> memo;
...@@ -304,7 +304,7 @@ Dart EnvMap::popAndPushSegment(Segment* o)// maj de l'enregistrement ...@@ -304,7 +304,7 @@ Dart EnvMap::popAndPushSegment(Segment* o)// maj de l'enregistrement
popSegment(o); popSegment(o);
FirstRegistrationSegment(o); FirstRegistrationSegment(o);
return o->nid->parts_[o->indexPart1]->d; return o->nid->getParticule(o->indexPart1)->getCell();
} }
void EnvMap::pushAOneCellSegment(Segment * o, Dart d) void EnvMap::pushAOneCellSegment(Segment * o, Dart d)
...@@ -439,10 +439,10 @@ void EnvMap::FirstRegistrationTriangle(Triangle * o)// réenregistre l'Triangle ...@@ -439,10 +439,10 @@ 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]]; const Particule * p1 = mo->getParticule(mo->indexParticule[cell]);
Dart d1=p1->d; // darts de la carte 3D contenant les particules Dart d1=p1->getCell(); // darts de la carte 3D contenant les particules
memo = getMemoCross(p1->getPosition(),mo->positionSurface[cell2],d1); memo = getMemoCross(p1->getPosition(),mo->positionSurface[cell2],d1);
for (Dart d : memo) for (Dart d : memo)
...@@ -793,10 +793,10 @@ void EnvMap::resetPartSubdiv(Segment* o) ...@@ -793,10 +793,10 @@ void EnvMap::resetPartSubdiv(Segment* o)
if (mo != NULL) if (mo != NULL)
{ {
VEC3 pos = mo->parts_[o->indexPart1]->getPosition(); VEC3 pos = mo->getParticule(o->indexPart1)->getPosition();
VEC3 pos2 = mo->parts_[o->indexPart2]->getPosition(); VEC3 pos2 = mo->getParticule(o->indexPart2)->getPosition();
Dart d1 =mo->parts_[o->indexPart1]->d; Dart d1 =mo->getParticule(o->indexPart1)->getCell();
Dart d2 =mo->parts_[o->indexPart2]->d; Dart d2 =mo->getParticule(o->indexPart2)->getCell();
#ifdef DEBUG_affichage #ifdef DEBUG_affichage
CGoGNout<<"Reset part subdiv (index articul , segment ,ind1, pos1, d1, ind2, pos2, d2) : "<<mo->index_articulated<<" || "<<o->index<<" || "<<o->indexPart1<<" || "<<pos<<" || "<<d1<<" || "<<o->indexPart2<<" || "<<pos2<<" || "<<d2<<CGoGNendl; CGoGNout<<"Reset part subdiv (index articul , segment ,ind1, pos1, d1, ind2, pos2, d2) : "<<mo->index_articulated<<" || "<<o->index<<" || "<<o->indexPart1<<" || "<<pos<<" || "<<d1<<" || "<<o->indexPart2<<" || "<<pos2<<" || "<<d2<<CGoGNendl;
...@@ -804,28 +804,28 @@ void EnvMap::resetPartSubdiv(Segment* o) ...@@ -804,28 +804,28 @@ void EnvMap::resetPartSubdiv(Segment* o)
#endif #endif
mo->parts_[o->indexPart1]->CGoGN::Algo::MovingObjects::ParticleBase<PFP>::move(Algo::Surface::Geometry::volumeCentroid<PFP,VertexAttribute<VEC3,MAP>>(map,d1,position)) ; mo->getParticule(o->indexPart1)->CGoGN::Algo::MovingObjects::ParticleBase<PFP>::move(Algo::Surface::Geometry::volumeCentroid<PFP,VertexAttribute<VEC3,MAP>>(map,d1,position)) ;
mo->parts_[o->indexPart1]->reset_positionFace(); mo->getParticule(o->indexPart1)->reset_positionFace();
#ifdef DEBUG_affichage #ifdef DEBUG_affichage
CGoGNout<<"part1 moved to centroid ,d : "<< mo->parts_[o->indexPart1]->getPosition()<<" || "<<mo->parts_[o->indexPart1]->d<<CGoGNendl; CGoGNout<<"part1 moved to centroid ,d : "<< mo->getParticule(o->indexPart1]->getPosition()<<" || "<<mo->parts_[o->indexPart1)->getCell()<<CGoGNendl;
#endif #endif
mo->parts_[o->indexPart1]->setState(VOLUME) ; mo->getParticule(o->indexPart1)->setState(VOLUME) ;
mo->parts_[o->indexPart1]->move(pos) ; mo->getParticule(o->indexPart1)->move(pos) ;
#ifdef DEBUG_affichage #ifdef DEBUG_affichage
CGoGNout<<"part1 moved in the end (destination, arrivée,d) : "<<pos<<" || "<< mo->parts_[o->indexPart1]->getPosition()<<" || "<<mo->parts_[o->indexPart1]->d<<CGoGNendl; CGoGNout<<"part1 moved in the end (destination, arrivée,d) : "<<pos<<" || "<< mo->getParticule(o->indexPart1]->getPosition()<<" || "<<mo->parts_[o->indexPart1)->getCell()<<CGoGNendl;
#endif #endif
mo->parts_[o->indexPart2]->CGoGN::Algo::MovingObjects::ParticleBase<PFP>::move(Algo::Surface::Geometry::volumeCentroid<PFP,VertexAttribute<VEC3,MAP>>(map,d2,position)) ; mo->getParticule(o->indexPart2)->CGoGN::Algo::MovingObjects::ParticleBase<PFP>::move(Algo::Surface::Geometry::volumeCentroid<PFP,VertexAttribute<VEC3,MAP>>(map,d2,position)) ;
mo->parts_[o->indexPart2]->reset_positionFace(); mo->getParticule(o->indexPart2)->reset_positionFace();
#ifdef DEBUG_affichage #ifdef DEBUG_affichage
CGoGNout<<"part2 moved to centroid ,d : "<< mo->parts_[o->indexPart2]->getPosition()<<" || "<<mo->parts_[o->indexPart2]->d<<CGoGNendl; CGoGNout<<"part2 moved to centroid ,d : "<< mo->getParticule(o->indexPart2]->getPosition()<<" || "<<mo->parts_[o->indexPart2)->getCell()<<CGoGNendl;
#endif #endif
mo->parts_[o->indexPart2]->setState(VOLUME) ; mo->getParticule(o->indexPart2)->setState(VOLUME) ;
mo->parts_[o->indexPart2]->move(pos2) ; mo->getParticule(o->indexPart2)->move(pos2) ;
#ifdef DEBUG_affichage #ifdef DEBUG_affichage
CGoGNout<<"part2 moved in the end (destination, arrivée,d) : "<<pos2<<" || "<< mo->parts_[o->indexPart2]->getPosition()<<" || "<<mo->parts_[o->indexPart2]->d<<CGoGNendl; CGoGNout<<"part2 moved in the end (destination, arrivée,d) : "<<pos2<<" || "<< mo->getParticule(o->indexPart2]->getPosition()<<" || "<<mo->parts_[o->indexPart2)->getCell()<<CGoGNendl;
#endif #endif
} }
...@@ -840,9 +840,9 @@ void EnvMap::resetPartSubdiv(Triangle * o) ...@@ -840,9 +840,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->getParticule(mo->indexParticule[cell]);
Particule * p2 = mo->parts_[mo->indexParticule[cell2]]; Particule * p2 = mo->getParticule(mo->indexParticule[cell2]);
Particule * p3 = mo->parts_[mo->indexParticule[cell3]]; Particule * p3 = mo->getParticule(mo->indexParticule[cell3]);
if (mo != NULL) if (mo != NULL)
{ {
...@@ -850,9 +850,9 @@ void EnvMap::resetPartSubdiv(Triangle * o) ...@@ -850,9 +850,9 @@ void EnvMap::resetPartSubdiv(Triangle * o)
VEC3 pos = p->getPosition(); VEC3 pos = p->getPosition();
VEC3 pos2 = p2->getPosition(); VEC3 pos2 = p2->getPosition();
VEC3 pos3 = p3->getPosition(); VEC3 pos3 = p3->getPosition();
Dart d1 =p->d; Dart d1 =p->getCell();
Dart d2 =p2->d; Dart d2 =p2->getCell();
Dart d3 = p3->d; Dart d3 = p3->getCell();
#ifdef DEBUG_affichage #ifdef DEBUG_affichage
CGoGNout<<"Reset part subdiv (index articul , segment ,ind1, pos1, d1, ind2, pos2, d2) : "<<mo->index_articulated<<" || "<<o->index<<" || "<<o->indexPart1<<" || "<<pos<<" || "<<d1<<" || "<<o->indexPart2<<" || "<<pos2<<" || "<<d2<<CGoGNendl; CGoGNout<<"Reset part subdiv (index articul , segment ,ind1, pos1, d1, ind2, pos2, d2) : "<<mo->index_articulated<<" || "<<o->index<<" || "<<o->indexPart1<<" || "<<pos<<" || "<<d1<<" || "<<o->indexPart2<<" || "<<pos2<<" || "<<d2<<CGoGNendl;
......
...@@ -29,8 +29,8 @@ Knife::Knife(Simulator* sim,std::vector<std::pair<VEC3, Dart>> startingPoints) ...@@ -29,8 +29,8 @@ Knife::Knife(Simulator* sim,std::vector<std::pair<VEC3, Dart>> startingPoints)
CGoGNout<<" init Segment :"<< i ; CGoGNout<<" init Segment :"<< i ;
CGoGNout<<" || nb_segments :"<< Segments_.size() <<CGoGNendl; CGoGNout<<" || nb_segments :"<< Segments_.size() <<CGoGNendl;
#endif #endif
Segment* o = new Segment(parts_[i]->getPosition(), Segment* o = new Segment(getParticule(i)->getPosition(),
parts_[(i + 1)]->getPosition(), getParticule((i + 1))->getPosition(),
this,i,i+1, i,r,g,b); this,i,i+1, i,r,g,b);
Segments_.push_back(o); Segments_.push_back(o);
...@@ -119,19 +119,19 @@ void Knife::unColor_close(Dart volume) ...@@ -119,19 +119,19 @@ void Knife::unColor_close(Dart volume)
void Knife::move(VEC3 diff) void Knife::move(VEC3 diff)
{ {
// VEC3 pos = getPosition(0)+diff; // VEC3 pos = getPosition(0)+diff;
// parts_[0]->move(pos); // getParticule(0)->move(pos);
for (unsigned int i = 0; i < nbVertices; ++i) for (unsigned int i = 0; i < nbVertices; ++i)
{ {
VEC3 pos = getPosition(i)+diff; VEC3 pos = getPosition(i)+diff;
if(sim_->envMap_.map.isVolumeIncidentToBoundary(parts_[i]->d)) if(sim_->envMap_.map.isVolumeIncidentToBoundary(this->getParticule(i)->getCell()))
{ {
if(sim_->envMap_.checkPointInMap(pos,parts_[i]->d)) if(sim_->envMap_.checkPointInMap(pos,this->getParticule(i)->getCell()))
{ {
parts_[i]->move(pos); getParticule(i)->move(pos);
} }
} }
else else
parts_[i]->move(pos); getParticule(i)->move(pos);
} }
updateRegistration(); updateRegistration();
...@@ -150,11 +150,15 @@ void Knife::updateRegistration() ...@@ -150,11 +150,15 @@ void Knife::updateRegistration()
{ {
// CGoGNout << "avant une etape : Segment "<< i << CGoGNendl; // CGoGNout << "avant une etape : Segment "<< i << CGoGNendl;
Segment* o = Segments_[i]; Segment* o = Segments_[i];
o->p1 = parts_[o->indexPart1]->getPosition(); o->p1 = getParticule(o->indexPart1)->getPosition();
o->p2 = parts_[o->indexPart2]->getPosition(); o->p2 = getParticule(o->indexPart2)->getPosition();
Dart d1 = parts_[o->indexPart1]->d; Dart d1 = this->getParticule(o->indexPart1)->getCell();
Dart d2 = parts_[o->indexPart2]->d; Dart d2 = this->getParticule(o->indexPart2)->getCell();
if(!((sim_->envMap_.map.sameVolume(d1,d2))&& (parts_[o->indexPart1]->crossCell==CGoGN::Algo::Volume::MovingObjects::NO_CROSS && parts_[o->indexPart2]->crossCell==CGoGN::Algo::Volume::MovingObjects::NO_CROSS))) if(!(
(sim_->envMap_.map.sameVolume(d1,d2))
&& (getParticule(o->indexPart1)->crossCell==CGoGN::Algo::Volume::MovingObjects::NO_CROSS
&& getParticule(o->indexPart2)->crossCell==CGoGN::Algo::Volume::MovingObjects::NO_CROSS))
)
{ {
#ifdef DEBUG_affichage #ifdef DEBUG_affichage
...@@ -183,7 +187,7 @@ void Knife::updateRegistration() ...@@ -183,7 +187,7 @@ void Knife::updateRegistration()
void Knife::refine() void Knife::refine()
{ {
// Dart volume = parts_[0]->d; // Dart volume = this->getParticule(0)->getCell();
// PFP::VEC3 edge = Algo::Surface::Geometry::vectorOutOfDart<PFP>(sim_->envMap_.map, volume, sim_->envMap_.position) ; // PFP::VEC3 edge = Algo::Surface::Geometry::vectorOutOfDart<PFP>(sim_->envMap_.map, volume, sim_->envMap_.position) ;
// if( edge.norm2() > 1.0f ) // if( edge.norm2() > 1.0f )
// { // {
......
...@@ -38,8 +38,8 @@ void Needle::color_close() ...@@ -38,8 +38,8 @@ void Needle::color_close()
{ {
if(nbVertices>0) if(nbVertices>0)
{ {
Dart volume = parts_[0]->d; Dart volume = this->getParticule(0)->getCell();
VEC3 pos=parts_[0]->getPosition(); VEC3 pos=getParticule(0)->getPosition();
float distSq=0; float distSq=0;
for (Segment * s : sim_->envMap_.RegisteredEdges[volume]) for (Segment * s : sim_->envMap_.RegisteredEdges[volume])
{ {
...@@ -110,10 +110,10 @@ void Needle::unColor_close(Dart volume) ...@@ -110,10 +110,10 @@ void Needle::unColor_close(Dart volume)
void Needle::createEdge(int index) void Needle::createEdge(int index)
{ {
parts_.push_back(new CGoGN::Algo::Volume::MovingObjects::ParticleCell3D<PFP>(sim_->envMap_.map, parts_[0]->d, parts_[0]->getPosition() , sim_->envMap_.position)); parts_.push_back(new CGoGN::Algo::Volume::MovingObjects::ParticleCell3D<PFP>(sim_->envMap_.map, this->getParticule(0)->getCell(), getParticule(0)->getPosition() , sim_->envMap_.position));
Segment* o = new Segment(parts_[index+1]->getPosition(), Segment* o = new Segment(getParticule(index+1)->getPosition(),
parts_[0]->getPosition(), getParticule(0)->getPosition(),
this,index+1,0,index,r,g,b); this,index+1,0,index,r,g,b);
Segments_.push_back(o); Segments_.push_back(o);
sim_->envMap_.FirstRegistrationSegment(o); sim_->envMap_.FirstRegistrationSegment(o);
...@@ -154,23 +154,23 @@ void Needle::createEdge(int index) ...@@ -154,23 +154,23 @@ void Needle::createEdge(int index)
void Needle::move(VEC3 diff) void Needle::move(VEC3 diff)
{ {
// VEC3 pos = getPosition(0)+diff; // VEC3 pos = getPosition(0)+diff;
// parts_[0]->move(pos); // getParticule(0)->move(pos);
Dart oldCell = parts_[0]->d; Dart oldCell = this->getParticule(0)->getCell();
VEC3 pos = getPosition(0)+diff; VEC3 pos = getPosition(0)+diff;
if(sim_->envMap_.map.isVolumeIncidentToBoundary(parts_[0]->d)) if(sim_->envMap_.map.isVolumeIncidentToBoundary(this->getParticule(0)->getCell()))
{ {
if(!sim_->envMap_.checkPointInMap(pos,parts_[0]->d)) if(!sim_->envMap_.checkPointInMap(pos,this->getParticule(0)->getCell()))
{ {
pos=pos-diff; pos=pos-diff;
} }
} }
parts_[0]->move(pos); this->getParticule(0)->move(pos);
updateRegistration(); updateRegistration();
this->unColor_close(oldCell); this->unColor_close(oldCell);
#ifdef IHMap #ifdef IHMap
if(!parts_[0]->crossCell==CGoGN::Algo::Volume::MovingObjects::NO_CROSS) /// a rajouter si les cellules sont assez petites if(!getParticule(0)->crossCell==CGoGN::Algo::Volume::MovingObjects::NO_CROSS) /// a rajouter si les cellules sont assez petites
{ {
refine(); refine();
} }
...@@ -200,11 +200,13 @@ void Needle::move(VEC3 diff) ...@@ -200,11 +200,13 @@ void Needle::move(VEC3 diff)
void Needle::updateRegistration() void Needle::updateRegistration()
{ {
Segment* o = Segments_[nbEdges-1]; Segment* o = Segments_[nbEdges-1];
o->p1 = parts_[o->indexPart1]->getPosition(); o->p1 = getParticule(o->indexPart1)->getPosition();
o->p2 = parts_[o->indexPart2]->getPosition(); o->p2 = getParticule(o->indexPart2)->getPosition();
Dart d1 = parts_[o->indexPart1]->d; Dart d1 = this->getParticule(o->indexPart1)->getCell();
Dart d2 = parts_[o->indexPart2]->d; Dart d2 = this->getParticule(o->indexPart2)->getCell();
if(!((sim_->envMap_.map.sameVolume(d1,d2))&& (parts_[o->indexPart1]->crossCell==CGoGN::Algo::Volume::MovingObjects::NO_CROSS && parts_[o->indexPart2]->crossCell==CGoGN::Algo::Volume::MovingObjects::NO_CROSS))) if(!(
(sim_->envMap_.map.sameVolume(d1,d2))
&& (getParticule(o->indexPart1)->crossCell==CGoGN::Algo::Volume::MovingObjects::NO_CROSS && getParticule(o->indexPart2)->crossCell==CGoGN::Algo::Volume::MovingObjects::NO_CROSS)))
{ {
#ifdef DEBUG_affichage #ifdef DEBUG_affichage
CGoGNout<<"update registration "<<CGoGNendl<<CGoGNendl; CGoGNout<<"update registration "<<CGoGNendl<<CGoGNendl;
...@@ -233,7 +235,7 @@ void Needle::updateRegistration() ...@@ -233,7 +235,7 @@ void Needle::updateRegistration()
void Needle::refine() void Needle::refine()
{ {
#ifdef IHMap #ifdef IHMap
Dart volume = parts_[0]->d; Dart volume = this->getParticule(0)->getCell();
REAL rayon = sim_->envMap_.volumeMaxdistance(volume) ; REAL rayon = sim_->envMap_.volumeMaxdistance(volume) ;
if(rayon > sim_->envMap_.maxCellRay ) if(rayon > sim_->envMap_.maxCellRay )
......
...@@ -33,8 +33,8 @@ Tree::Tree(Simulator* sim, std::vector<std::pair<VEC3, Dart>> startingPoints, st ...@@ -33,8 +33,8 @@ Tree::Tree(Simulator* sim, std::vector<std::pair<VEC3, Dart>> startingPoints, st
std::pair<unsigned int, unsigned int> pair = segmentParts.at(i); std::pair<unsigned int, unsigned int> pair = segmentParts.at(i);
unsigned int ind1=pair.first; unsigned int ind1=pair.first;
unsigned int ind2=pair.second; unsigned int ind2=pair.second;
Segment* o = new Segment(parts_[ind1]->getPosition(), Segment* o = new Segment(getParticule(ind1)->getPosition(),
parts_[ind2]->getPosition(), getParticule(ind2)->getPosition(),
this,ind1,ind2, i,r,g,b); this,ind1,ind2, i,r,g,b);
Segments_.push_back(o); Segments_.push_back(o);
......
...@@ -292,7 +292,7 @@ void Volusion::cb_initGL() ...@@ -292,7 +292,7 @@ void Volusion::cb_initGL()
for (unsigned int i=0; i< simul.aiguille->nbVertices; ++i) for (unsigned int i=0; i< simul.aiguille->nbVertices; ++i)
{ {
VEC3 p = simul.aiguille->parts_[i]->getPosition(); VEC3 p = simul.aiguille->getParticule(i)->getPosition();
data[i] = p; data[i] = p;
} }
// data[simul.aiguille->nbVertices]=simul.aiguille->closest_point; // data[simul.aiguille->nbVertices]=simul.aiguille->closest_point;
...@@ -332,8 +332,8 @@ void Volusion::displayMO() ...@@ -332,8 +332,8 @@ void Volusion::displayMO()
m_ds->end(); m_ds->end();
m_ds->endList(); m_ds->endList();
// VEC3 pos1 = simul.aiguille->parts_[0]->getPosition(); // VEC3 pos1 = simul.aiguille->getParticule(0)->getPosition();
// VEC3 pos2 = simul.aiguille->parts_[1]->getPosition(); // VEC3 pos2 = simul.aiguille->getParticule(1)->getPosition();
// float f; // float f;
// VEC3 cylinder_axis =cylinder->getAxisScale(2,f); // VEC3 cylinder_axis =cylinder->getAxisScale(2,f);
PFP::VEC3* data = static_cast<PFP::VEC3*>(m_MovingObjectVBO->lockPtr()); PFP::VEC3* data = static_cast<PFP::VEC3*>(m_MovingObjectVBO->lockPtr());
...@@ -388,7 +388,7 @@ void Volusion::displayMO() ...@@ -388,7 +388,7 @@ void Volusion::displayMO()
for(const auto& vect : simul.aiguille->belonging_cells) for(const auto& vect : simul.aiguille->belonging_cells)
{ {
// m_topo_render->overdrawDart(simul.aiguille->parts_[i]->d,10.0f,1.0f,0,0); // m_topo_render->overdrawDart(simul.aiguille->getParticule(i)->getCell(),10.0f,1.0f,0,0);
for(Dart it : vect) for(Dart it : vect)
{ {
for (Edge d : edgesIncidentToVolume3(simul.envMap_.map,it)) for (Edge d : edgesIncidentToVolume3(simul.envMap_.map,it))
...@@ -400,13 +400,13 @@ void Volusion::displayMO() ...@@ -400,13 +400,13 @@ void Volusion::displayMO()
} }
} }
// m_topo_render->overdrawDart(simul.aiguille->parts_[simul.aiguille->nbEdges]->d,10.0f,1.0f,0,0); // m_topo_render->overdrawDart(simul.aiguille->getParticule(simul.aiguille->nbEdges)->getCell(),10.0f,1.0f,0,0);
} }
else else
{ {
// m_topo_render->overdrawDart(simul.aiguille->parts_[val_comboEdge-1]->d,10.0f,1.0f,0,0); // m_topo_render->overdrawDart(simul.aiguille->getParticule(val_comboEdge-1)->getCell(),10.0f,1.0f,0,0);
// m_topo_render->overdrawDart(simul.aiguille->parts_[val_comboEdge]->d,10.0f,1.0f,0,0); // m_topo_render->overdrawDart(simul.aiguille->getParticule(val_comboEdge)->getCell(),10.0f,1.0f,0,0);
int i = val_comboEdge-1; int i = val_comboEdge-1;
for(Dart it : simul.aiguille->belonging_cells[i]) for(Dart it : simul.aiguille->belonging_cells[i])
{ {
...@@ -430,7 +430,7 @@ void Volusion::displayMO() ...@@ -430,7 +430,7 @@ void Volusion::displayMO()
{ {
for(const auto& vect : simul.aiguille->neighbor_cells) for(const auto& vect : simul.aiguille->neighbor_cells)
{ {
// m_topo_render->overdrawDart(simul.aiguille->parts_[i]->d,10.0f,1.0f,0,0); // m_topo_render->overdrawDart(simul.aiguille->getParticule(i)->getCell(),10.0f,1.0f,0,0);
for(Dart it : vect) for(Dart it : vect)
{ {
for (Edge d : edgesIncidentToVolume3(simul.envMap_.map,(it))) for (Edge d : edgesIncidentToVolume3(simul.envMap_.map,(it)))
...@@ -512,8 +512,8 @@ void Volusion::displayObj() ...@@ -512,8 +512,8 @@ void Volusion::displayObj()
m_ds->end(); m_ds->end();
m_ds->endList(); m_ds->endList();
// VEC3 pos1 = art->parts_[0]->getPosition(); // VEC3 pos1 = art->getParticule(0)->getPosition();
// VEC3 pos2 = art->parts_[1]->getPosition(); // VEC3 pos2 = art->getParticule(1)->getPosition();
// float f; // float f;
// VEC3 cylinder_axis =cylinder->getAxisScale(2,f); // VEC3 cylinder_axis =cylinder->getAxisScale(2,f);