From cfbdbf18af42db224f95da02e4b38186bf29c9c4 Mon Sep 17 00:00:00 2001 From: Ulrich Kemloh <kemlohulrich@gmail.com> Date: Wed, 16 Apr 2014 19:27:09 +0200 Subject: [PATCH] visibility including hlines improved better error messages for access points fixed error with decision area dA --- geometry/SubRoom.cpp | 1 + inputfiles/moscawa/ini-mall.xml | 6 +++--- routing/AccessPoint.cpp | 12 +++++++----- routing/GlobalRouter.cpp | 16 +++++++++------- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/geometry/SubRoom.cpp b/geometry/SubRoom.cpp index 7f0e7bd3..52c1aa64 100644 --- a/geometry/SubRoom.cpp +++ b/geometry/SubRoom.cpp @@ -319,6 +319,7 @@ bool SubRoom::IsVisible(const Point& p1, const Point& p2, bool considerHlines) // check intersection with other hlines in room if(considerHlines) for(unsigned int i = 0; i < _hlines.size(); i++) { + if(_hlines[i]->IsInLineSegment(p1)|| _hlines[i]->IsInLineSegment(p2)) continue; if(temp && cl.IntersectionWith(*(Line*)_hlines[i])) temp = false; } diff --git a/inputfiles/moscawa/ini-mall.xml b/inputfiles/moscawa/ini-mall.xml index cc28357b..0f072aef 100644 --- a/inputfiles/moscawa/ini-mall.xml +++ b/inputfiles/moscawa/ini-mall.xml @@ -125,7 +125,7 @@ <agents_distribution> - <group group_id="1" room_id="6" subroom_id="7" number="20" goal_id="" router_id="2" route_id=""/> + <group group_id="1" room_id="6" subroom_id="7" number="1" goal_id="-1" router_id="1" route_id=""/> @@ -246,7 +246,7 @@ <parameters> <solver>euler</solver> <stepsize>0.01</stepsize> - <exitCrossingStrategy>3</exitCrossingStrategy> + <exitCrossingStrategy>4</exitCrossingStrategy> <linkedcells enabled="true" cell_size="2.2" /> <v0 mu="1.24" sigma="0.001" /> <bmax mu="0.25" sigma="0.001" /> @@ -268,7 +268,7 @@ </parameters> </router1> - <router router_id="2" description="global_safest"> + <router router_id="1" description="global_safest"> <parameters> <navigation_lines file="routing-mall.xml" /> </parameters> diff --git a/routing/AccessPoint.cpp b/routing/AccessPoint.cpp index 70898829..87422640 100644 --- a/routing/AccessPoint.cpp +++ b/routing/AccessPoint.cpp @@ -141,7 +141,7 @@ int AccessPoint::GetNearestTransitAPTO(int UID){ return possibleDest[0]->GetID(); }else { AccessPoint* best_ap=possibleDest[0]; - double min_dist=GetDistanceTo(best_ap); // FIXME: add the shortest distance to outside + double min_dist=GetDistanceTo(best_ap);// + best_ap->GetDistanceTo(UID); // FIXME: add the shortest distance to outside for (unsigned int i=0;i<possibleDest.size();i++){ double tmp= GetDistanceTo(possibleDest[i]); @@ -253,7 +253,8 @@ void AccessPoint::Dump(){ cout<<endl<<"--------> Dumping AP <-----------"<<endl<<endl; //cout<<" ID: " <<_id<<" centre = [ "<< _center[0] <<", " <<_center[1] <<" ]"<<endl; - cout<<" ID: " <<_friendlyName<<" centre = [ "<< _center[0] <<", " <<_center[1] <<" ]"<<endl; + cout<<" Friendly ID: " <<_friendlyName<<" centre = [ "<< _center[0] <<", " <<_center[1] <<" ]"<<endl; + cout<<" Real ID: " <<_id<<endl; cout <<" Is final exit to outside :"<<GetFinalExitToOutside()<<endl; cout <<" Distance to final goals"<<endl; @@ -265,14 +266,15 @@ void AccessPoint::Dump(){ cout<<" transit to final goals:"<<endl; for(std::map<int, std::vector<AccessPoint*> >::iterator p = _navigationGraphTo.begin(); p != _navigationGraphTo.end(); ++p) { - cout<<"\t UID ---> [ "<<p->first <<" ]"; + cout<<endl<<"\t to UID ---> [ "<<p->first <<" ]"; if(p->second.size()==0) { cout<<"\t ---> [ Nothing ]"; } else { for(unsigned int i=0;i<p->second.size();i++){ - cout<<"\t distance ---> [ "<<p->second[i]->GetID()<<" @ " << p->second[i]->GetDistanceTo(p->first)<<" ]"; + cout<<"\t distance ---> [ "<<GetDistanceTo(p->second[i])+p->second[i]->GetDistanceTo(p->first) <<" m via "<<p->second[i]->GetID() <<" ]"; + //cout<<"\t distance ---> [ "<<p->second[i]->GetID()<<" @ " << GetDistanceTo(p->first)<<" ]"; } } } @@ -282,7 +284,7 @@ void AccessPoint::Dump(){ cout<<" connected to aps : " ; for(unsigned int p=0;p<_connectingAPs.size();p++){ //cout<<" [ "<<_connectingAPs[p]->GetID()<<" , "<<_connectingAPs[p]->GetDistanceTo(this)<<" m ]"; - cout<<endl<<"\t [ "<<_connectingAPs[p]->GetFriendlyName()<<" , "<<_connectingAPs[p]->GetDistanceTo(this)<<" m ]"; + cout<<endl<<"\t [ "<<_connectingAPs[p]->GetID()<<"_"<<_connectingAPs[p]->GetFriendlyName()<<" , "<<_connectingAPs[p]->GetDistanceTo(this)<<" m ]"; } cout<<endl<<endl; diff --git a/routing/GlobalRouter.cpp b/routing/GlobalRouter.cpp index d4b0fc36..df818b33 100644 --- a/routing/GlobalRouter.cpp +++ b/routing/GlobalRouter.cpp @@ -236,7 +236,7 @@ void GlobalRouter::Init(Building* building) { // The penalty factor should discourage pedestrians to evacuation through rooms. double penalty=1.0; - if(sub->GetType()!="floor") { + if((sub->GetType()!="floor") && (sub->GetType()!="dA") ) { penalty=PENALTY_FACTOR; } @@ -271,7 +271,7 @@ void GlobalRouter::Init(Building* building) { if (nav1->operator ==(*nav2)) continue; - if (sub->IsVisible(nav1, nav2, true)) { + if (sub->IsVisible(nav1->GetCentre(), nav2->GetCentre(), true)) { int to_door = _map_id_to_index[nav2->GetUniqueID()]; _distMatrix[from_door][to_door] = penalty*(nav1->GetCentre() - nav2->GetCentre()).Norm(); @@ -562,10 +562,10 @@ void GlobalRouter::DumpAccessPoints(int p) { int GlobalRouter::FindExit(Pedestrian* ped) { int nextDestination = ped->GetNextDestination(); - if(ped->GetGlobalTime()>400){ - //ped->Dump(143); - //exit(0); - } +// if(ped->GetGlobalTime()>80){ +// ped->Dump(2); +// //exit(0); +// } if (nextDestination == -1) { return GetBestDefaultRandomExit(ped); @@ -715,7 +715,9 @@ void GlobalRouter::GetRelevantRoutesTofinalDestination(Pedestrian *ped, vector<A //cout<<"Against APs:" <<goals[g2]<<endl; //int exitid=goals[g2]; if(ap->GetNearestTransitAPTO(ped->GetFinalDestination())==goals[g2]){ - relevant=false; + //FIXME there are interference with hlines. suitable only for quickest route considering exits, + // crossings only + relevant=true; break; } } -- GitLab