Commit c58f05d5 authored by Arne Graf's avatar Arne Graf

fixed the ff_router bug: standing on lines

parent 13509c03
Pipeline #9331 failed with stages
in 6 minutes and 14 seconds
......@@ -313,6 +313,7 @@ Point VelocityModel::e0(Pedestrian* ped, Room* room) const
desired_direction = lastE0;
ped->SetLastE0(lastE0);
Log->Write("%f %f", desired_direction._x, desired_direction._y);
//_direction->GetTarget(room, ped);
}
// if (dist > 1*J_EPS_GOAL) {
// desired_direction = target - pos; //ped->GetV0(target);
......
......@@ -583,7 +583,8 @@ void UnivFFviaFM::finalizeTargetLine(const int uid, const Line& line, Point* tar
} else if (_gridCode[jDot*iMax + iDot] == WALL) {
//do nothing
} else {
Log->Write("ERROR:\t in finalizingTargetLine");
target[jDot * iMax + iDot] = value;
//Log->Write("ERROR:\t in finalizingTargetLine");
}
for (i=0; iDot < xe; ++i) {
++iDot;
......@@ -621,7 +622,8 @@ void UnivFFviaFM::finalizeTargetLine(const int uid, const Line& line, Point* tar
} else if (_gridCode[jDot*iMax + iDot] == WALL) {
//do nothing
} else {
Log->Write("ERROR:\t in finalizingTargetLine");
target[jDot * iMax + iDot] = value;
//Log->Write("ERROR:\t in finalizingTargetLine");
}
}
} else {
......@@ -658,7 +660,8 @@ void UnivFFviaFM::finalizeTargetLine(const int uid, const Line& line, Point* tar
} else if (_gridCode[jDot*iMax + iDot] == WALL) {
//do nothing
} else {
Log->Write("ERROR:\t in finalizingTargetLine");
target[jDot * iMax + iDot] = value;
//Log->Write("ERROR:\t in finalizingTargetLine");
}
for(i=0; jDot<ye; ++i) {
++jDot;
......@@ -696,7 +699,8 @@ void UnivFFviaFM::finalizeTargetLine(const int uid, const Line& line, Point* tar
} else if (_gridCode[jDot*iMax + iDot] == WALL) {
//do nothing
} else {
Log->Write("ERROR:\t in finalizingTargetLine");
target[jDot * iMax + iDot] = value;
//Log->Write("ERROR:\t in finalizingTargetLine");
}
}
}
......@@ -1388,14 +1392,22 @@ void UnivFFviaFM::addTarget(const int uid, double* costarrayDBL, Point* gradarra
Point passvector = tempTargetLine.NormalVec();
Point trial = tempTargetLine.GetCentre() - passvector * 0.25;
Point trial2 = tempTargetLine.GetCentre() + passvector * 0.25;
if ((_grid->getKeyAtPoint(trial) >= 0) && (_gridCode[_grid->getKeyAtPoint(trial)] == INSIDE)) {
if ((_grid->includesPoint(trial)) && (_gridCode[_grid->getKeyAtPoint(trial)] == INSIDE)) {
finalizeTargetLine(uid, _doors[uid], newArrayPt, passvector);
} else if ((_grid->getKeyAtPoint(trial2) >= 0) && (_gridCode[_grid->getKeyAtPoint(trial2)] == INSIDE)) {
finalizeTargetLine(uid, tempTargetLine, newArrayPt, passvector);
} else if ((_grid->includesPoint(trial2)) && (_gridCode[_grid->getKeyAtPoint(trial2)] == INSIDE)) {
passvector = passvector * -1.0;
finalizeTargetLine(uid, _doors[uid], newArrayPt, passvector);
finalizeTargetLine(uid, tempTargetLine, newArrayPt, passvector);
} else {
Log->Write("ERROR:\t in addTarget: calling finalizeTargetLine");
}
// for (long int i = 0; i < _grid->GetnPoints(); ++i) {
// if ((_gridCode[i] != OUTSIDE) && (_gridCode[i] != WALL) && (newArrayPt[i] == Point(0.0, 0.0) )) {
// Log->Write("Mist");
// }
// }
}
#pragma omp critical(_uids)
_uids.emplace_back(uid);
......
......@@ -549,8 +549,12 @@ int FFRouter::FindExit(Pedestrian* p)
if ((_distMatrix.at(key) + locDistToDoor) < minDist) {
minDist = _distMatrix.at(key) + locDistToDoor;
bestDoor = key.first; //doorUID
if (locDistToDoor == 0.) {
bestDoor = _pathsMatrix[key]; //@todo: @ar.graf: check this hack
//if (locDistToDoor == 0.) {
if (true) {
auto subroomDoors = _building->GetSubRoomByUID(p->GetSubRoomUID())->GetAllGoalIDs();
if (std::find(subroomDoors.begin(), subroomDoors.end(), _pathsMatrix[key]) != subroomDoors.end()) {
bestDoor = _pathsMatrix[key]; //@todo: @ar.graf: check this hack
}
}
bestFinalDoor = key.second;
}
......
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