Commit 751d182a authored by pitiot's avatar pitiot
Browse files

réparé dart==nil ^^

parent a0f823f1
......@@ -559,11 +559,11 @@ void EnvMap::pushObstacleInCells(Obstacle * o)// réenregistre l'obstacle en que
memo = mo->getMemoCross(p1,p2,d1,d2);
// if(map.sameFace(d1,d2))
// {
// pushObstacleInOneRingCells(o , d1 , n);
// }
// else
if(map.sameFace(d1,d2))
{
pushObstacleInOneRingCells(o , d1 , n);
}
else
{
pushObstacleInCells(o, n, memo);
......@@ -603,11 +603,11 @@ Dart EnvMap::popAndPushObstacleInCells(Obstacle* o, int n)// maj de l'enregistre
{
popObstacleInCells(o, n);
// if(map.sameFace(d1,d2))
// {
// pushObstacleInOneRingCells(o , d1 , n);
// }
// else
if(map.sameFace(d1,d2))
{
pushObstacleInOneRingCells(o , d1 , n);
}
else
{
pushObstacleInCells(o, n, memo);
}
......@@ -982,27 +982,10 @@ void EnvMap::coarse()
PFP::AGENTS agents ;
PFP::OBSTACLEVECT obst ;
PFP::OBSTACLEVECT neighborObst ;
//premier tour pour les présents
//premier tour pour les darts qui vont disparaitre
fit = old ;
do
{
PFP::AGENTS a(agentvect[fit]) ;
PFP::OBSTACLEVECT ob(obstvect[fit]) ;
agents.insert(agents.end(), a.begin(), a.end()) ;
map.setCurrentLevel(map.getMaxLevel()) ;
for(PFP::OBSTACLEVECT::iterator ait = ob.begin(); ait != ob.end(); ++ait)
{
this->popObstacleInCells(*ait, (*ait)->index) ;
obst.push_back(*ait);
}
for (PFP::AGENTS::iterator ait = a.begin(); ait != a.end(); ++ait)
popAgentInCells(*ait, fit) ;
map.setCurrentLevel(fLevel - 1) ;
Dart nf = map.phi2(fit) ;
if (!map.faceIsSubdivided(nf))
{
......@@ -1021,6 +1004,31 @@ void EnvMap::coarse()
}
map.setCurrentLevel(fLevel - 1) ;
}
fit = map.phi1(fit) ;
} while (fit != old) ;
//deuxieme tour pour les présents
fit = old ;
do
{
PFP::AGENTS a(agentvect[fit]) ;
PFP::OBSTACLEVECT ob(obstvect[fit]) ;
agents.insert(agents.end(), a.begin(), a.end()) ;
map.setCurrentLevel(map.getMaxLevel()) ;
for(PFP::OBSTACLEVECT::iterator ait = ob.begin(); ait != ob.end(); ++ait)
{
this->popObstacleInCells(*ait, (*ait)->index) ;
obst.push_back(*ait);
}
for (PFP::AGENTS::iterator ait = a.begin(); ait != a.end(); ++ait)
popAgentInCells(*ait, fit) ;
map.setCurrentLevel(fLevel - 1) ;
fit = map.phi1(fit) ;
} while (fit != old) ;
......@@ -1043,7 +1051,7 @@ void EnvMap::coarse()
map.setCurrentLevel(fLevel - 1) ;
}
//deuxieme tour concernant les voisins
//dernier tour concernant les voisins
fit = old ;
do
{
......
......@@ -715,11 +715,6 @@ void resetPartSubdiv(Obstacle* o)
mo->parts_[n]->setState(FACE) ;
mo->parts_[n]->move(pos) ;
pos =mo->parts_[(n+1)%(mo->nbVertices)]->getPosition();
mo->parts_[(n+1)%(mo->nbVertices)]->CGoGN::Algo::MovingObjects::ParticleBase<PFP>::move(Algo::Surface::Geometry::faceCentroid<PFP>(mo->sim_->envMap_.map, mo->parts_[(n+1)%(mo->nbVertices)]->d, mo->sim_->envMap_.position)) ;
mo->parts_[(n+1)%(mo->nbVertices)]->setState(FACE) ;
mo->parts_[(n+1)%(mo->nbVertices)]->move(pos) ;
mo->dDir = mo->parts_[0]->d;
}
}
......@@ -735,13 +730,9 @@ void resetObstPartInFace(Obstacle* o, Dart d1)
> (mo->sim_->envMap_.map, d1, mo->sim_->envMap_.position, pos1, true)) {
mo->parts_[n]->d = d1;
}
if(n==0 || n== mo->nbVertices-1)
if(n==0)
mo->dDir = mo->parts_[0]->d;
pos1 = mo->parts_[(n+1)%(mo->nbVertices)]->getPosition();
if (Algo::Surface::Geometry::isPointInConvexFace2D < PFP
> (mo->sim_->envMap_.map, d1, mo->sim_->envMap_.position, pos1, true)) {
mo->parts_[(n+1)%(mo->nbVertices)]->d = d1;
}
}
}
......@@ -752,11 +743,13 @@ void resetPart(Obstacle * o, Dart d1)
if(mo!=NULL)
{
int n =o->index;
CGoGN::Algo::Surface::MovingObjects::ParticleCell2D<PFP> * registering_part=mo->parts_[n];
if (registering_part->d == mo->sim_->envMap_.map.phi1(d1))
registering_part->d = d1;
if (mo->parts_[n]->d == mo->sim_->envMap_.map.phi1(d1))
mo->parts_[n]->d = d1;
if(n==0)
mo->dDir = registering_part->d;
mo->dDir = mo->parts_[n]->d;
}
......
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