Commit acb7c60b authored by Mohcine Chraibi's avatar Mohcine Chraibi

Refactor ComputeBestPositionVoronoi

parent 261eea18
......@@ -111,7 +111,7 @@ bool AgentsSourcesManager::ProcessAllSources() const
//ComputeBestPositionRandom(src.get(), peds);
//todo: here every pedestrian needs an exitline
if( !ComputeBestPositionVoronoiBoost(src.get(), peds, _building) )
Log->Write("INFO:\t there was no place for some pedestrians");
Log->Write("WARNING:\tThere was no place for some pedestrians");
AgentsQueueIn::Add(peds);
empty = false;
}
......
......@@ -117,7 +117,7 @@ bool ComputeBestPositionVoronoiBoost(AgentsSource* src, std::vector<Pedestrian*>
std::vector<Pedestrian*>::iterator iter_ped;
for (iter_ped = peds.begin(); iter_ped != peds.end(); )
{
Pedestrian* ped = (*iter_ped);
Pedestrian* ped = *iter_ped;
radius = ped->GetEllipse().GetBmax(); //max radius of the current pedestrian
if(existing_peds.size() == 0 )
......@@ -134,48 +134,25 @@ bool ComputeBestPositionVoronoiBoost(AgentsSource* src, std::vector<Pedestrian*>
if( IsEnoughInSubroom(subroom, new_pos, radius ) )
{
ped->SetPos(center_pos + random_pos, true);
Point v;
if (ped->GetExitLine()) {
v = (ped->GetExitLine()->ShortestPoint(ped->GetPos())- ped->GetPos()).Normalized();
} else {
v = Point(0., 0.);
}
//double speed=ped->GetV0Norm();
double speed = ped->GetEllipse().GetV0(); //@todo: some peds do not have a navline. This should not be accepted.
v=v*speed;
ped->SetV(v);
}
else
{
ped->SetPos(center_pos, true);
Point v;
if (ped->GetExitLine()) {
v = (ped->GetExitLine()->ShortestPoint(ped->GetPos())- ped->GetPos()).Normalized();
} else {
v = Point(0., 0.);
}
double speed=ped->GetV0Norm();
v=v*speed;
ped->SetV(v);
}
}
else
{
ped->SetPos(center_pos, true);
Point v;
if (ped->GetExitLine()) {
v = (ped->GetExitLine()->ShortestPoint(ped->GetPos())- ped->GetPos()).Normalized();
} else {
v = Point(0., 0.);
}
double speed=ped->GetV0Norm();
//double speed=ped->GetV0Norm();
double speed = ped->GetEllipse().GetV0(); //@todo: some peds do not have a navline. This should not be accepted.
v=v*speed;
ped->SetV(v);
}
existing_peds.push_back(ped);
}//0
else //more than one pedestrian
......
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