Commit 6b207cb9 authored by Arne Graf's avatar Arne Graf

fixed bug in InsideAnalysis: anyDoor was not set in every case

parent 474971fe
Pipeline #8410 failed with stages
in 19 seconds
......@@ -81,6 +81,7 @@ Line::~Line()
************************************************************/
void Line::SetPoint1(const Point& p)
{
//if we call this setter and change line, it should get a new UID (ar.graf) @todo:
_point1 = p;
_centre = (_point1+_point2)*0.5;
_length = (_point1 - _point2).Norm();
......@@ -88,6 +89,7 @@ void Line::SetPoint1(const Point& p)
void Line::SetPoint2(const Point& p)
{
//if we call this setter and change line, it should get a new UID (ar.graf) @todo:
_point2 = p;
_centre = (_point1+_point2)*0.5;
_length = (_point1 - _point2).Norm();
......
......@@ -85,9 +85,11 @@ UnivFFviaFM::UnivFFviaFM(Room* roomArg, Configuration* const confArg, double hx,
if (!isOpen) {
//will be added twice! is it a problem?
lines.emplace_back((Line)*cross);
} else if ((tmpDoors.count(uidNotConst) == 0)) {
tmpDoors.emplace(std::make_pair(uidNotConst, (Line) *cross));
anyDoor = Line{*cross};
} else {
anyDoor = Line{*cross};
if (tmpDoors.count(uidNotConst) == 0) {
tmpDoors.emplace(std::make_pair(uidNotConst, (Line) *cross));
}
}
}
for (auto& trans : tmpTrans) {
......@@ -96,9 +98,11 @@ UnivFFviaFM::UnivFFviaFM(Room* roomArg, Configuration* const confArg, double hx,
if (!isOpen) {
//will be added twice! is it a problem?
lines.emplace_back((Line)*trans);
} else if (tmpDoors.count(uidNotConst) == 0) {
tmpDoors.emplace(std::make_pair(uidNotConst, (Line) *trans));
anyDoor = Line{*trans};
} else {
anyDoor = Line{*trans};
if (tmpDoors.count(uidNotConst) == 0) {
tmpDoors.emplace(std::make_pair(uidNotConst, (Line) *trans));
}
}
}
//find insidePoint and save it, together with UID
......
......@@ -228,7 +228,7 @@ bool FFRouter::Init(Building* building)
double tempDistance = locffptr->getDistanceBetweenDoors(rctIt->second, otherDoor.second);
if (tempDistance < locffptr->getGrid()->Gethx()) {
Log->Write("WARNING:\tDistance of doors %d and %d is too small: %f",rctIt->second, otherDoor.second, tempDistance);
Log->Write("WARNING:\tIgnoring distance of doors %d and %d because it is too small: %f",rctIt->second, otherDoor.second, tempDistance);
//Log->Write("^^^^^^^^\tIf there are scattered subrooms, which are not connected, this is ok.");
continue;
}
......@@ -498,6 +498,7 @@ int FFRouter::FindExit(Pedestrian* p)
void FFRouter::FloydWarshall()
{
bool change = false;
double savedDistance = 0.;
int totalnum = _allDoorUIDs.size();
for(int k = 0; k<totalnum; ++k) {
for(int i = 0; i<totalnum; ++i) {
......@@ -508,6 +509,7 @@ void FFRouter::FloydWarshall()
if ((_distMatrix[key_ik] < DBL_MAX) && (_distMatrix[key_kj] < DBL_MAX) &&
(_distMatrix[key_ik] + _distMatrix[key_kj] < _distMatrix[key_ij]))
{
savedDistance = _distMatrix[key_ij] - _distMatrix[key_ik] - _distMatrix[key_kj];
_distMatrix.erase(key_ij);
_distMatrix.insert(std::make_pair(key_ij, _distMatrix[key_ik] + _distMatrix[key_kj]));
_pathsMatrix.erase(key_ij);
......@@ -518,7 +520,7 @@ void FFRouter::FloydWarshall()
}
}
if (change) {
Log->Write("Floyd nochmal!!!");
Log->Write("Floyd nochmal!!! %f", savedDistance);
FloydWarshall();
} else {
Log->Write("Floyd fertig");
......
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