From 703d45144a3f60832a0f0f0f07b7a464116e1061 Mon Sep 17 00:00:00 2001 From: Arne Graf <ar.graf.cst@gmail.com> Date: Tue, 24 Apr 2018 17:36:00 +0200 Subject: [PATCH] UnivFF: never give costs of wallpoints (bresenham-inaccuracy); ff_router delta_h = .0625 --- routing/DirectionStrategy.cpp | 1 + routing/ff_router/UnivFFviaFM.cpp | 12 ++++++------ routing/ff_router/ffRouter.cpp | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/routing/DirectionStrategy.cpp b/routing/DirectionStrategy.cpp index 2db97090..6e7ae0c6 100644 --- a/routing/DirectionStrategy.cpp +++ b/routing/DirectionStrategy.cpp @@ -499,6 +499,7 @@ void DirectionSubLocalFloorfield::Init(Building* buildingArg, double stepsize, _initDone = true; + //_locffviafm[0]->writeFF() //write floorfields to file, one file per subroom //ar.graf: [SWITCH writevtk ON/OFF] // for(unsigned int i = 0; i < subUIDs.size(); ++i) { // std::vector<int> targets = {}; diff --git a/routing/ff_router/UnivFFviaFM.cpp b/routing/ff_router/UnivFFviaFM.cpp index 21389fef..dd9327aa 100644 --- a/routing/ff_router/UnivFFviaFM.cpp +++ b/routing/ff_router/UnivFFviaFM.cpp @@ -1424,12 +1424,12 @@ double UnivFFviaFM::getCostToDestination(const int destID, const Point& position // } assert(_grid->includesPoint(position)); long int key = _grid->getKeyAtPoint(position); - if (_gridCode[key] == OUTSIDE) { + if ((_gridCode[key] == OUTSIDE) || (_gridCode[key] == WALL)) { //bresenham line (treppenstruktur) at middle and calculated centre of line are on different gridpoints //find a key that belongs domain (must be one left or right and second one below or above) - if (_gridCode[key+1] != OUTSIDE) { + if ((_gridCode[key+1] != OUTSIDE) && (_gridCode[key+1] != WALL)) { key = key+1; - } else if (_gridCode[key-1] != OUTSIDE){ + } else if ((_gridCode[key-1] != OUTSIDE) && (_gridCode[key-1] != WALL)){ key = key-1; } else { Log->Write("ERROR:\t In getCostToDestination(3 args)"); @@ -1458,12 +1458,12 @@ double UnivFFviaFM::getCostToDestination(const int destID, const Point& position double UnivFFviaFM::getCostToDestination(const int destID, const Point& position) { assert(_grid->includesPoint(position)); long int key = _grid->getKeyAtPoint(position); - if (_gridCode[key] == OUTSIDE) { + if ((_gridCode[key] == OUTSIDE) || (_gridCode[key] == WALL)) { //bresenham line (treppenstruktur) getKeyAtPoint yields gridpoint next to edge, although position is on edge //find a key that belongs domain (must be one left or right and second one below or above) - if (_gridCode[key+1] != OUTSIDE) { + if ((_gridCode[key+1] != OUTSIDE) && (_gridCode[key+1] != WALL)) { key = key+1; - } else if (_gridCode[key-1] != OUTSIDE){ + } else if ((_gridCode[key-1] != OUTSIDE) && (_gridCode[key-1] != WALL)){ key = key-1; } else { Log->Write("ERROR:\t In getCostToDestination(2 args)"); diff --git a/routing/ff_router/ffRouter.cpp b/routing/ff_router/ffRouter.cpp index 2fe640d6..57661402 100644 --- a/routing/ff_router/ffRouter.cpp +++ b/routing/ff_router/ffRouter.cpp @@ -175,7 +175,7 @@ bool FFRouter::Init(Building* building) auto pairRoomIt = allRooms.begin(); std::advance(pairRoomIt, i); UnivFFviaFM *locffptr = nullptr; - locffptr = new UnivFFviaFM(pairRoomIt->second.get(), building, 0.125, 0.0, false); + locffptr = new UnivFFviaFM(pairRoomIt->second.get(), building, 0.0625, 0.0, false); locffptr->setUser(DISTANCE_MEASUREMENTS_ONLY); locffptr->setMode(CENTERPOINT); -- GitLab