ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
borderset.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2017-2020 German Aerospace Center (DLR).
3  * Eclipse ADORe, Automated Driving Open Research https://eclipse.org/adore
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License 2.0 which is available at
7  * http://www.eclipse.org/legal/epl-2.0.
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  * Daniel Heß - initial API and implementation
13  * Robert Markowski
14  ********************************************************************************/
15 
16 
17 #pragma once
20 #include <list>
21 #include <unordered_map>
22 #include <unordered_set>
23 #include <vector>
24 #include <deque>
25 #include <boost/geometry.hpp>
26 #include <boost/geometry/geometries/point.hpp>
27 #include <boost/geometry/geometries/box.hpp>
28 #include <boost/geometry/index/rtree.hpp>
29 #include <adore/mad/centerline.h>
31 
32 namespace adore
33 {
34  namespace env
35  {
36  namespace BorderBased
37  {
44  template<typename T1, typename T2>
45  struct itpair
46  {
47  T1 first;
48  T2 second;
50  T1& current(){return first;}
51  T2& end(){return second;}
52  };
53 
60  template<typename value_type,typename Tfirst>
61  struct my_equal
62  {
63  typedef bool result_type;
64  result_type operator() (value_type const& v1, value_type const& v2) const
65  {
66  return boost::geometry::equals<Tfirst,Tfirst>(v1.first, v2.first) && v1.second == v2.second;
67  }
68  };
69 
70  typedef std::pair<Coordinate::boost_point,Border*> idxCoordinate2Border;
71  typedef std::pair<Border::boost_box,Border*> idxRegion2Border;
72 
73  typedef boost::geometry::index::rtree< idxCoordinate2Border,
74  boost::geometry::index::quadratic<16>,
75  boost::geometry::index::indexable<idxCoordinate2Border>,
78  typedef boost::geometry::index::rtree< idxRegion2Border,
79  boost::geometry::index::quadratic<16>,
80  boost::geometry::index::indexable<idxRegion2Border>,
83 
84  typedef std::unordered_map<Coordinate, std::list<Border*>*, CoordinateHasher> Coordinate2Borders;
85  typedef std::unordered_map<BorderID, Border*, BorderIDHasher> BorderID2Border;
86  typedef std::list<Border*>::iterator BorderIterator;
87  typedef std::pair<BorderIterator, BorderIterator> BorderIteratorPair;
88  typedef std::pair<BorderID2Border::iterator,BorderID2Border::iterator> BorderIteratorPair2;
91 
92  typedef std::vector<Border*> BorderSubSet;
93 
98  class BorderSet
99  {
100  std::set<BorderType::TYPE> m_allowedBorderTypes;
101  protected:
102  //constants
103  double m_coord_uncertainty_xy;//position uncertainty for indexing
104  double m_coord_uncertainty_z;//position uncertainty for indexing
105  double m_guard;//min/max value
106  double m_max_lane_width;//maximum width of a lane
107 
108  //the mapping tables
114 
116  bool m_isOwner;
117  public:
118 
124  {
125  m_isOwner = true;
127  m_coord_uncertainty_z = 10.0;
128  m_guard = 1e99;
129  m_max_lane_width = 10.0;
131  }
136  virtual ~BorderSet()
137  {
138  clear();
139  }
140 
141 
150  {
151  return m_allowedBorderTypes.insert(type).second;
152  }
153 
154 
155 
156  void rotate(double psi, double rot_x=0.0, double rot_y=0.0)
157  {
158  BorderSubSet newBorders;
159  for(auto it=this->getAllBorders(); it.first!=it.second; it.first++)
160  {
161  auto b = new Border(*((it.first)->second));
162  b->rotateXY(psi,rot_x,rot_y);
163  newBorders.push_back(b);
164  }
165  this->clear();
166  for(auto it=newBorders.begin(); it!=newBorders.end(); it++)
167  {
168  this->insert_border(*it);
169  }
170  }
171  void translate(double trans_x, double trans_y, double trans_z)
172  {
173  BorderSubSet newBorders;
174  for(auto it=this->getAllBorders(); it.first!=it.second; it.first++)
175  {
176  auto b = new Border(*((it.first)->second));
177  b->translate(trans_x,trans_y,trans_z);
178  newBorders.push_back(b);
179  }
180  this->clear();
181  for(auto it=newBorders.begin(); it!=newBorders.end(); it++)
182  {
183  this->insert_border(*it);
184  }
185  }
186 
193  {
194  m_allowedBorderTypes.erase(type);
195  }
196 
205  {
206  return m_allowedBorderTypes.count(b->m_type)!=0;
207  }
208 
214  void setIsOwner(bool isOwner)
215  {
216  m_isOwner = isOwner;
217  }
218 
225  void insert_border(Border* b, bool force_insert = false)
226  {
227  // handle duplicate insertions
228  auto it = m_byID.find(b->m_id);
229  if(it!=m_byID.end())
230  {
231  // duplicate found
232 
233  // if duplicate references itself for left, discard it
234  if(b->m_left!=nullptr && b->m_id == *(b->m_left))
235  {
236  return;
237  }
238  //if new border is not of allowed type and insert is not forced, discard it
239  if(!force_insert && !borderTypeValid(b))
240  {
241  return;
242  }
243  m_byRegion.remove(std::make_pair(it->second->getBoostBox(0),it->second));
244  m_byFirstCoord.remove(std::make_pair(it->second->m_id.m_first.getBoostPoint(),it->second));
245  m_byLastCoord.remove(std::make_pair(it->second->m_id.m_last.getBoostPoint(),it->second));
246  if(m_isOwner)
247  {
248  delete it->second;
249  }
250  }
251 
252  // actual insertion
253  m_byID[b->m_id] = b;
254  //map from left id
255  if (b->m_left != 0)m_byLeftID[*(b->m_left)] = b;//only insert, if it has a left border
256  //map from own id's first
257  m_byFirstCoord.insert(std::make_pair(b->m_id.m_first.getBoostPoint(),b));
258  //map from own id's last
259  m_byLastCoord.insert(std::make_pair(b->m_id.m_last.getBoostPoint(),b));
260  //map from region
261  m_byRegion.insert(std::make_pair(b->getBoostBox(0),b));
262  }
263 
269  void erase_border(const BorderID& oldID)
270  {
271  Border* oldBorder = m_byID.at(oldID);
272  m_byRegion.remove(std::make_pair(oldBorder->getBoostBox(0),oldBorder));
273  m_byLastCoord.remove(std::make_pair(oldBorder->m_id.m_last.getBoostPoint(),oldBorder));
274  m_byFirstCoord.remove(std::make_pair(oldBorder->m_id.m_first.getBoostPoint(),oldBorder));
275  if (oldBorder->m_left != 0)m_byLeftID.erase(*(oldBorder->m_left));
276  m_byID.erase(oldID);
277  if(m_isOwner)delete oldBorder;
278  }
279 
284  void clear()
285  {
286  //delete all borders
287  if(m_isOwner)for(auto it = getAllBorders();it.first!=it.second;it.first++)
288  {
289  delete it.first->second;
290  }
291  m_byID.clear();
292  m_byLeftID.clear();
293  m_byLastCoord.clear();
294  m_byFirstCoord.clear();
295  m_byRegion.clear();
296  }
297 
308  bool findPathBetweenBorders(BorderID curID, std::deque<BorderID> &solvedList, std::vector<Border*> targets, size_t searchDepth=10)
309  {
310  // add current border to solved list
311  solvedList.push_back(curID);
312 
313  // if current border is a target, return true, solvedList is path
314  for(auto b = targets.begin(); b!=targets.end(); b++)
315  {
316  if(curID == (*b)->m_id)
317  {
318  return true;
319  }
320  }
321 
322  // limit search depth
323  if(solvedList.size()>searchDepth)
324  {
325  solvedList.pop_back();
326  return false;
327  }
328 
329  // current border is not in targets -> call findPath with successors of current border
330  auto curBorder = this->getBorder(curID);
331  auto succs = this->getSuccessors(curBorder);
332  for(;succs.first!=succs.second;succs.first++)
333  {
334  auto border = succs.first->second;
335  // skip if border type is not changeable
336  if(border->typeIsChangeable() && border->isContinuousSuccessorOf(curBorder))
337  {
338  //call findPath with successor
339  if(findPathBetweenBorders(border->m_id,solvedList,targets))
340  {
341  // if target is found, return true, solvedList is path
342  return true;
343  }
344  }
345  }
346  // if no target for current border is found, remove it from solvedList again, return false
347  solvedList.pop_back();
348  return false;
349  }
350 
357  {
358  return BorderIteratorPair2(m_byID.begin(),m_byID.end());
359  }
360 
370  itRegion2Border getBordersInRegion(double x0,double x1,double y0,double y1)
371  {
372  auto it = m_byRegion.qbegin(boost::geometry::index::intersects(Border::boost_box( Coordinate::boost_point(x0,y0,-m_guard),
374  return itRegion2Border(it,m_byRegion.qend());
375  }
376 
385  itRegion2Border getBordersInRegion(double x,double y,double r)
386  {
387  double x0,x1,y0,y1;
388  x0 = x - r;
389  x1 = x + r;
390  y0 = y - r;
391  y1 = y + r;
392  return getBordersInRegion(x0,x1,y0,y1);
393  }
394 
403  BorderSubSet getBordersAtPoint(double x,double y, double max_lane_width)
404  {
405  BorderSubSet hits;
406  for(auto it = getBordersInRegion(x,y,max_lane_width);
407  it.current()!=it.end();it.current()++)
408  {
409  Border* right = it.current()->second;
410  Border* left = this->getLeftNeighbor(right);
411  if(left!=0)
412  {
413  if(right->isPointInsideLane(left,x,y))
414  {
415  hits.push_back(right);
416  }
417  }
418  }
419  return hits;
420  }
421 
430  {
432  }
433 
443  BorderSubSet getBorderSetOutsideRegion(double x0,double x1,double y0,double y1)
444  {
445  BorderSubSet subset;
446  for(auto it = m_byRegion.qbegin(boost::geometry::index::disjoint(Border::boost_box( Coordinate::boost_point(x0,y0,-m_guard),
448  it!=m_byRegion.qend();it++)
449  {
450  subset.push_back(it->second);
451  }
452  return subset;
453  }
454 
464  itRegion2Border getBordersOutsideRegion(double x0,double x1,double y0,double y1)
465  {
466  auto it = m_byRegion.qbegin(boost::geometry::index::disjoint(Border::boost_box( Coordinate::boost_point(x0,y0,-m_guard),
468  return itRegion2Border(it,m_byRegion.qend());
469  }
470 
481  void matchLanesInRegion(double* x,double* y, int count,BorderSubSet& targetSet)
482  {
483  double x0 = x[0];
484  double x1 = x[0];
485  double y0 = y[0];
486  double y1 = y[0];
487  //compute axis oriented bounding box
488  for(int i=1;i<count;i++)
489  {
490  x0 = (std::min)(x0,x[i]); x1 = (std::max)(x1,x[i]);
491  y0 = (std::min)(y0,y[i]); y1 = (std::max)(y1,y[i]);
492  }
493 
494  //find all lanes, which have an overlapping aa bounding box
495  //then select lanes, which match against any of the specified query points
497  it.current()!=it.end();
498  it.current()++)
499  {
500  Border* right = it.current()->second;
501  if(right->m_left!=0)
502  {
503  Border* left = getBorder(*(right->m_left));
504  if(left!=0)
505  {
506  if(right->intersectsRegionCombined(left,x0,x1,y0,y1))
507  {
508  for(int i=0;i<count;i++)
509  {
510  if(right->isPointInsideLane(left,x[i],y[i]))
511  {
512  targetSet.push_back(right);
513  break;
514  }
515  }
516  }
517  }
518  }
519  }
520  }
521 
532  BorderSubSet matchBordersInRegion(double* x,double* y, int count)
533  {
534  double x0 = x[0];
535  double x1 = x[0];
536  double y0 = y[0];
537  double y1 = y[0];
538  //compute axis oriented bounding box
539  for(int i=1;i<count;i++)
540  {
541  x0 = (std::min)(x0,x[i]); x1 = (std::max)(x1,x[i]);
542  y0 = (std::min)(y0,y[i]); y1 = (std::max)(y1,y[i]);
543  }
544 
545  //find all lanes, which have an overlapping aa bounding box
546  //then select lanes, which match against any of the specified query points
547  BorderSubSet subset_specific;
549  it.current()!=it.end();
550  it.current()++)
551  {
552  subset_specific.push_back(it.current()->second);
553  }
554 
555  return subset_specific;
556  }
557 
572  void matchLanesInRegion(double px,double py, double psi, double a, double b, double w,BorderSubSet& targetSet)
573  {
574  double X[5];
575  double Y[5];
576  double cpsi = (std::cos)(psi);
577  double spsi = (std::sin)(psi);
578  double w2 = w*0.5;
580  X[0] = px; Y[0] = py;
581  X[1] = px + cpsi*(-b) - spsi*(-w2); Y[1] = py + spsi*(-b) + cpsi*(-w2);
582  X[2] = px + cpsi*(+a) - spsi*(-w2); Y[2] = py + spsi*(+a) + cpsi*(-w2);
583  X[3] = px + cpsi*(+a) - spsi*(+w2); Y[3] = py + spsi*(+a) + cpsi*(+w2);
584  X[4] = px + cpsi*(-b) - spsi*(+w2); Y[4] = py + spsi*(-b) + cpsi*(+w2);
585  return matchLanesInRegion(X,Y,5,targetSet);
586  }
587 
593  void removeBorders(const BorderSubSet& subset)
594  {
595  for(auto it = subset.begin();it!=subset.end();it++)
596  {
597  erase_border((*it)->m_id);
598  }
599  }
600 
607  {
608  BorderSubSet buffer;
609  //can not delete during iterator operations, therefore buffer to vector first
610  for(;it.current()!=it.end();it.current()++)
611  {
612  buffer.push_back(it.current()->second);
613  }
614  for(auto it2 = buffer.begin();it2!=buffer.end();it2++)
615  {
616  erase_border((*it2)->m_id);
617  }
618  }
619 
620 
621 
628  Border* getBorder(const BorderID& id) const
629  {
630  auto it = m_byID.find(id);
631  if (it == m_byID.end()) return 0;
632  return it->second;
633  }
634 
648  {
650  Border* right = getBorder(id);
651  if( right==0 )
652  {
653  return center;
654  }
655  else
656  {
658  if( left==0 )
659  {
660  adore::mad::computeLaneWidthAndCenter(*(right->m_path),*(right->m_path),center);
661  //return *(right->m_path);
662  return center;
663  }
664  else
665  {
666  //adore::mad::computeCenterline(*(left->m_path),*(right->m_path),center);
667  adore::mad::computeLaneWidthAndCenter(*(left->m_path),*(right->m_path),center);
668  return center;
669  }
670  }
671  }
672 
673 
682  {
684  Border* right = getBorder(id);
685  if( right==0 )
686  {
687  return center;
688  }
689  else
690  {
692  if( left==0 )
693  {
694  return *(right->m_path);
695  }
696  else
697  {
698  adore::mad::computeCenterline(*(left->m_path),*(right->m_path),center);
699  return center;
700  }
701  }
702  }
703 
710  void getOverlappingBorders(Border* base,std::vector<BorderOverlap>& resultset)
711  {
712  Border* left = base->m_left?getBorder(*base->m_left):0;
713  Border* right = getRightNeighbor(base);
714 
715  //@TODO: filter head-on traffic neighbors
716  for( auto it = m_byRegion.qbegin(boost::geometry::index::intersects(base->getBoostBox(getLeftNeighbor(base))));
717  it!=m_byRegion.qend();
718  it++ )
719  {
720  Border* candidate = it->second;
721  Border* cleft = candidate->m_left?getBorder(*candidate->m_left):0;
722  //first, exclude some neighboring lanes, which do not result in conflicts
723  if( candidate!=base && candidate!=left && candidate!=right
724  && cleft!=0
725  && (right==0 || getBorder(*right->m_left)!=cleft)
726  && cleft!=base && cleft!= right
727  && !candidate->isNeighborOf(base)
728 
729  && !(candidate->m_id==base->m_id)
730  && !(cleft->m_id==base->m_id)
731  && !cleft->isSplitNeighborOf(base)
732  && !cleft->isSplitNeighborOf(left)
733  && !cleft->isSplitNeighborOf(right)
734 
735 
736 
737 
738  // && !candidate->isSuccessorOf(base->m_id)
739  // && !candidate->isPredecessorOf(base->m_id)
740 
741  /*
742 
743  && !cleft->isSuccessorOf(base->m_id)
744  && !cleft->isPredecessorOf(base->m_id)
745  && !candidate->isSuccessorOf(base->m_id)
746  && !candidate->isPredecessorOf(base->m_id)
747 
748 */
749 
750 
751  && !candidate->isContinuousSuccessorOf(left)
752  && !candidate->isContinuousSuccessorOf(right)
753  && !candidate->isContinuousSuccessorOf(base)
754  && !candidate->isContinuousPredecessorOf(left)
755  && !candidate->isContinuousPredecessorOf(right)
756  && !candidate->isContinuousPredecessorOf(base)
757  && !candidate->isSplitNeighborOf(base)
758  && !candidate->isSplitNeighborOf(left)
759  && !candidate->isSplitNeighborOf(right)
760  && !cleft->isContinuousSuccessorOf(left)
761  && !cleft->isContinuousSuccessorOf(right)
762  && !cleft->isContinuousSuccessorOf(base)
763  && !cleft->isContinuousPredecessorOf(left)
764  && !cleft->isContinuousPredecessorOf(right)
765  && !cleft->isContinuousPredecessorOf(base)
766  )
767  {
768  /*if (right!=0
769  && !candidate->isSuccessorOf(right->m_id)
770  && !cleft->isSuccessorOf(right->m_id)
771  && !candidate->isPredecessorOf(right->m_id)
772  && !cleft->isPredecessorOf(right->m_id))
773  continue;
774  if (left!=0
775  && !candidate->isPredecessorOf(left->m_id)
776  && !candidate->isSuccessorOf(left->m_id)
777  && !cleft->isPredecessorOf(left->m_id)
778  && !cleft->isSuccessorOf(left->m_id)
779  )
780  continue; */
781  BorderOverlap bo(base,left,candidate,cleft);
782  if(bo.hasAnyOverlap())resultset.push_back(bo);
783  }
784  if (cleft==0)
785  {
786  // check for left side intersections
787  cleft = candidate;
788  candidate = getRightNeighbor(cleft);
789  BorderOverlap bo(base,left,candidate,cleft);
790  if (candidate==0)continue;
791  if(bo.hasAnyOverlap())resultset.push_back(bo);
792  }
793  }
794  }
795 
802  std::vector<BorderOverlap> getOverlappingBorders(Border* base)
803  {
804  std::vector<BorderOverlap> resultset;
805  getOverlappingBorders(base,resultset);
806  return resultset;
807  }
808 
815  void getOverlappingBorders(const std::vector<Border*>& baseset,std::vector<BorderOverlap>& resultset)
816  {
817  for( auto it = baseset.begin(); it!=baseset.end(); it++ )
818  {
819  getOverlappingBorders(*it,resultset);
820  }
821  }
822 
829  std::vector<BorderOverlap> getOverlappingBorders(const std::vector<Border*>& baseset)
830  {
831  std::vector<BorderOverlap> resultset;
832  getOverlappingBorders(baseset,resultset);
833  return resultset;
834  }
835 
845  bool hasAllPredecessorsInSet(Border* border,const std::unordered_set<Border*>& set,int pred_depth)
846  {
847  Border* b = border;
848  for(int i=0;i<pred_depth;i++)
849  {
850  auto it=getPredecessors(b);
851  bool itinset=false;
852  bool split=false;
853  if(it.current()!=it.end())
854  {
855  b = it.current()->second;
856  itinset=(set.find(b)!=set.end());
857  it.current()++;
858  split=(it.current()!=it.end());
859  if(split)
860  {
861  Border* other = it.current()->second;
862  other->getLength();
863  return false;
864  }
865  if(itinset)
866  {
867  return true;
868  }
869  }
870  else
871  {
872  return false;
873  }
874 
875  }
876  return false;
877  }
878 
886  void getOverlappingBorderCandidates(const std::vector<Border*>& search_area,
887  std::vector<Border*>& result,int pred_depth)
888  {
889  std::unordered_set<Border*> visited;
890  std::unordered_set<Border*> exclude;
891  for(auto it=search_area.begin();it!=search_area.end();it++)
892  {
893  Border* right = *it;
895  exclude.emplace(right);
896  if(left!=0)visited.emplace(left);
897  }
898  for(auto it=search_area.begin();it!=search_area.end();it++)
899  {
900  Border* right = *it;
902  Border::boost_box box = right->getBoostBox(left);
903  box.min_corner().set<2>(-m_guard);
904  box.max_corner().set<2>(m_guard);
905 
906  for(auto it2 = m_byRegion.qbegin(boost::geometry::index::intersects(box));
907  it2 != m_byRegion.qend();
908  it2++)
909  {
910  auto candidate = it2->second;
911 
912  if(visited.find(candidate)==visited.end() && exclude.find(candidate)==exclude.end())
913  {
914  visited.emplace(candidate);
915  if(hasAllPredecessorsInSet(candidate,exclude,pred_depth))continue;
916 
917  if(!right->isNeighborOf(candidate))
918  {
919  result.push_back(candidate);
920  }
921 
922  auto candidate_right = getRightNeighbor(candidate);
923  if(candidate_right!=0 && visited.find(candidate_right)==visited.end() )
924  {
925  visited.emplace(candidate_right);
926  if( !right->isNeighborOf(candidate_right)
927  && exclude.find(candidate_right)==exclude.end()
928  && !hasAllPredecessorsInSet(candidate_right,exclude,pred_depth))
929  {
930  result.push_back(candidate_right);
931  }
932  }
933  }
934  }
935 
936 
937  }
938  }
939 
946  {
947  if(m_byID.size()==0)
948  {
949  return 0;
950  }
951  int r = std::floor(((double)(std::rand())/((double)RAND_MAX)) * ((double)m_byID.size()));
952  for(auto it = getAllBorders();it.first!=it.second;it.first++,r--)
953  {
954  if(r==0)return it.first->second;
955  }
956  return getAllBorders().first->second;
957  }
958 
966  bool hasBorder(const BorderID& id) const
967  {
968  auto it = m_byID.find(id);
969  if (it == m_byID.end()) return false;
970  else return true;
971  }
972 
980  bool hasBorder(const Border * b) const
981  {
982  auto it = m_byID.find(b->m_id);
983  if (it == m_byID.end() || it->second->m_type != b->m_type)
984  {
985  return false;
986  }
987  return true;
988  }
989 
997  {
998  static Border::boost_box qBox(Coordinate::boost_point(0.0,0.0,0.0),Coordinate::boost_point(1.0,1.0,1.0));
999  qBox.min_corner().set<0>(b->m_id.m_last.m_X - m_coord_uncertainty_xy);
1000  qBox.min_corner().set<1>(b->m_id.m_last.m_Y - m_coord_uncertainty_xy);
1001  qBox.min_corner().set<2>(b->m_id.m_last.m_Z - m_coord_uncertainty_z);
1002  qBox.max_corner().set<0>(b->m_id.m_last.m_X + m_coord_uncertainty_xy);
1003  qBox.max_corner().set<1>(b->m_id.m_last.m_Y + m_coord_uncertainty_xy);
1004  qBox.max_corner().set<2>(b->m_id.m_last.m_Z + m_coord_uncertainty_z);
1005  return itCoordinate2Border(
1006  m_byFirstCoord.qbegin(boost::geometry::index::intersects(qBox)),
1007  m_byFirstCoord.qend()
1008  );
1009  }
1010 
1018  {
1019  double x0 = b->m_id.m_first.m_X - m_coord_uncertainty_xy;
1020  double y0 = b->m_id.m_first.m_Y - m_coord_uncertainty_xy;
1021  double z0 = b->m_id.m_first.m_Z - m_coord_uncertainty_z;
1022  double x1 = b->m_id.m_first.m_X + m_coord_uncertainty_xy;
1023  double y1 = b->m_id.m_first.m_Y + m_coord_uncertainty_xy;
1024  double z1 = b->m_id.m_first.m_Z + m_coord_uncertainty_z;
1025  return itCoordinate2Border(
1026  m_byLastCoord.qbegin(boost::geometry::index::intersects(Border::boost_box( Coordinate::boost_point(x0,y0,z0),
1028  m_byLastCoord.qend()
1029  );
1030  }
1031 
1041  bool isPredecessor(Border* b, Border* potentialPredecessor, bool checkForLeftNeighbor = false)
1042  {
1043  if (b == 0 || potentialPredecessor == 0){return false;}
1044  double x0 = b->m_id.m_first.m_X - m_coord_uncertainty_xy;
1045  double y0 = b->m_id.m_first.m_Y - m_coord_uncertainty_xy;
1046  double z0 = b->m_id.m_first.m_Z - m_coord_uncertainty_z;
1047  double x1 = b->m_id.m_first.m_X + m_coord_uncertainty_xy;
1048  double y1 = b->m_id.m_first.m_Y + m_coord_uncertainty_xy;
1049  double z1 = b->m_id.m_first.m_Z + m_coord_uncertainty_z;
1050  return
1051  x0 < potentialPredecessor->m_id.m_last.m_X &&
1052  x1 > potentialPredecessor->m_id.m_last.m_X &&
1053  y0 < potentialPredecessor->m_id.m_last.m_Y &&
1054  y1 > potentialPredecessor->m_id.m_last.m_Y &&
1055  z0 < potentialPredecessor->m_id.m_last.m_Z &&
1056  z1 > potentialPredecessor->m_id.m_last.m_Z &&
1057  (checkForLeftNeighbor?isPredecessor(getLeftNeighbor(b),getLeftNeighbor(potentialPredecessor)):true);
1058  }
1059 
1069  bool isSuccessor(Border* b, Border* potentialSuccessor, bool checkForLeftNeighbor = false)
1070  {
1071  if (b == 0 || potentialSuccessor == 0){return false;}
1072  double x0 = b->m_id.m_last.m_X - m_coord_uncertainty_xy;
1073  double y0 = b->m_id.m_last.m_Y - m_coord_uncertainty_xy;
1074  double z0 = b->m_id.m_last.m_Z - m_coord_uncertainty_z;
1075  double x1 = b->m_id.m_last.m_X + m_coord_uncertainty_xy;
1076  double y1 = b->m_id.m_last.m_Y + m_coord_uncertainty_xy;
1077  double z1 = b->m_id.m_last.m_Z + m_coord_uncertainty_z;
1078  return
1079  x0 < potentialSuccessor->m_id.m_first.m_X &&
1080  x1 > potentialSuccessor->m_id.m_first.m_X &&
1081  y0 < potentialSuccessor->m_id.m_first.m_Y &&
1082  y1 > potentialSuccessor->m_id.m_first.m_Y &&
1083  z0 < potentialSuccessor->m_id.m_first.m_Z &&
1084  z1 > potentialSuccessor->m_id.m_first.m_Z &&
1085  (checkForLeftNeighbor?isSuccessor(getLeftNeighbor(b),getLeftNeighbor(potentialSuccessor)):true);
1086  }
1087 
1097  void getAllPredecessorsUpToDistance(Border* b, double distance, std::vector<Border*>& result, bool checkLeftNeighbor = true, bool includeStartBorder = false)
1098  {
1099  if (includeStartBorder) result.push_back(b);
1100  auto itp = getPredecessors(b);
1101  double borderLength;
1102  for (auto it = itp.first; it != itp.second; ++it)
1103  {
1104  if (checkLeftNeighbor && (!hasLeftNeighbor(b) || !hasLeftNeighbor(it->second) || !isPredecessor(getBorder(*b->m_left),getBorder(*it->second->m_left)))){continue;}
1105  if (b==it->second){continue;} // a short border has itself as predecessor
1106  if(std::find(result.begin(),result.end(),it->second)!=result.end()){continue;} //this line shortens the path, not the whole distance is analyzed
1107  //if (checkLeftNeighbor && hasLeftNeighbor(it->second) && hasLeftNeighbor(b) && !isConnected(*it->second->m_left,*b->m_left)) {continue;}
1108  borderLength = it->second->getLength();
1109  if (borderLength < distance)
1110  {
1111  getAllPredecessorsUpToDistance(it->second,distance-borderLength,result);
1112  }
1113  result.push_back(it->second);
1114  }
1115  }
1116 
1126  void getAllSuccessorsUpToDistance(Border* b, double distance, std::vector<Border*>& result, bool checkLeftNeighbor = true, bool includeStartBorder = false)
1127  {
1128  if (includeStartBorder) result.push_back(b);
1129  auto itp = getSuccessors(b);
1130  double borderLength;
1131  for (auto it = itp.first; it != itp.second; ++it)
1132  {
1133  if (checkLeftNeighbor && (!hasLeftNeighbor(b) || !hasLeftNeighbor(it->second) || !isSuccessor(getBorder(*b->m_left),getBorder(*it->second->m_left)))){continue;}
1134  //if (checkLeftNeighbor && hasLeftNeighbor(b) && !isConnected(*it->second->m_left,*b->m_left)) {continue;}
1135  borderLength = it->second->getLength();
1136  if (borderLength < distance)
1137  {
1138  getAllSuccessorsUpToDistance(it->second,distance-borderLength,result);
1139  }
1140  result.push_back(it->second);
1141  }
1142  }
1143 
1154  Border* start, Border* end, std::vector<env::BorderBased::Border*>* allowedBorders,
1155  std::vector<double>& distances)
1156  {
1157  // excludes distances of end and start border
1158  double currentDistance = distances.empty() ? 0.0 : distances.back();
1159  if (isSuccessor(start, end, true))
1160  {
1161  return;
1162  }
1163  std::vector<env::BorderBased::Border*> newStartBorders;
1164  for (auto it = allowedBorders->begin(); it != allowedBorders->end();)
1165  {
1166  if (isSuccessor(start, *it, true))
1167  {
1168  newStartBorders.push_back(*it);
1169  it = allowedBorders->erase(it);
1170  }
1171  else
1172  {
1173  ++it;
1174  }
1175  }
1176  if (newStartBorders.empty())
1177  {
1178  // this path is a dead end, so the distance is deleted
1179  if (!distances.empty())
1180  {
1181  distances.pop_back();
1182  }
1183  return;
1184  }
1185  // to into all new paths until the border end or a dead end is reached
1186  bool first_successor = true;
1187  for (auto it = newStartBorders.begin(); it != newStartBorders.end(); ++it)
1188  {
1189  if (first_successor && !distances.empty())
1190  {
1191  distances.back() += (*it)->getLength();
1192  }
1193  else
1194  {
1195  distances.push_back(currentDistance + (*it)->getLength());
1196  }
1197  first_successor = false;
1198  getDistancesBetweenBordersAlongSuccessors(*it, end, allowedBorders,
1199  distances);
1200  }
1201  }
1202 
1203 
1211  {
1212  double x0 = b->m_id.m_first.m_X - m_coord_uncertainty_xy;
1213  double y0 = b->m_id.m_first.m_Y - m_coord_uncertainty_xy;
1214  double z0 = b->m_id.m_first.m_Z - m_coord_uncertainty_z;
1215  double x1 = b->m_id.m_first.m_X + m_coord_uncertainty_xy;
1216  double y1 = b->m_id.m_first.m_Y + m_coord_uncertainty_xy;
1217  double z1 = b->m_id.m_first.m_Z + m_coord_uncertainty_z;
1218  return itCoordinate2Border(
1219  m_byFirstCoord.qbegin(boost::geometry::index::intersects(Border::boost_box( Coordinate::boost_point(x0,y0,z0),
1221  m_byFirstCoord.qend()
1222  );
1223  }
1224 
1232  {
1233  double x0 = b->m_id.m_last.m_X - m_coord_uncertainty_xy;
1234  double y0 = b->m_id.m_last.m_Y - m_coord_uncertainty_xy;
1235  double z0 = b->m_id.m_last.m_Z - m_coord_uncertainty_z;
1236  double x1 = b->m_id.m_last.m_X + m_coord_uncertainty_xy;
1237  double y1 = b->m_id.m_last.m_Y + m_coord_uncertainty_xy;
1238  double z1 = b->m_id.m_last.m_Z + m_coord_uncertainty_z;
1239  return itCoordinate2Border(
1240  m_byLastCoord.qbegin(boost::geometry::index::intersects(Border::boost_box( Coordinate::boost_point(x0,y0,z0),
1242  m_byLastCoord.qend()
1243  );
1244  }
1245 
1253  {
1254  if (b->m_left == 0)return 0;
1255  auto it = m_byID.find(*(b->m_left));
1256  if (it == m_byID.end())return 0;
1257  return it->second;
1258  }
1259 
1268  {
1269  if (b->m_left == 0)return false;
1270  return m_byID.find(*(b->m_left)) != m_byID.end();
1271  }
1272 
1280  {
1281  auto it = m_byLeftID.find(b->m_id);
1282  if (it == m_byLeftID.end())return 0;
1283  return it->second;
1284  }
1293  {
1294  return m_byLeftID.find(b->m_id) != m_byLeftID.end();
1295  }
1296 
1304  {
1305  BorderSubSet value;
1306  if(!b->typeIsChangeable())
1307  {
1308  return value;
1309  }
1310  // find leftmost border
1311  auto leftmost = b;
1312  auto leftNeighbor=getLeftNeighbor(leftmost);
1313  while(leftNeighbor!=0 && leftNeighbor->typeIsChangeable())
1314  {
1315  leftmost = leftNeighbor;
1316  leftNeighbor=getLeftNeighbor(leftNeighbor);
1317  }
1318  // fill vector from left to right
1319  value.push_back(leftmost);
1320  auto rightNeighbor = getRightNeighbor(leftmost);
1321  while(rightNeighbor!=0 && rightNeighbor->typeIsChangeable())
1322  {
1323  value.push_back(rightNeighbor);
1324  rightNeighbor=getRightNeighbor(rightNeighbor);
1325  }
1326  return value;
1327  }
1328 
1336  std::pair<Border*,Border*> getLaneChangeTarget(Border* current_right,bool direction_left)
1337  {
1338  std::pair<Border*,Border*> target;
1339  target.first=nullptr;
1340  target.second=nullptr;
1341  if(direction_left)
1342  {
1343  target.second = getLeftNeighbor(current_right);
1344  if(target.second==nullptr)
1345  {
1346  return target;
1347  }
1348  target.first = getLeftNeighbor(target.second);
1349  if(target.first==nullptr)
1350  {
1351  target.second = nullptr;
1352  return target;
1353  }
1354  }
1355  else
1356  {
1357  target.second = getRightNeighbor(current_right);
1358  if(target.second==nullptr)return target;
1359  target.first = current_right;
1360  }
1361  //check that lane change target is an actual lane
1362  if(target.first->m_id==target.second->m_id
1363  || target.first->m_id==target.second->m_id.getReverseDirectionID())
1364  {
1365  //invalidate
1366  target.first=nullptr;
1367  target.second=nullptr;
1368  }
1369 
1370  return target;
1371  }
1372 
1381  bool isConnected(const BorderID& a,const BorderID& b)
1382  {
1384  }
1385 
1394  bool isSimilar(const Coordinate& a, const Coordinate& b)
1395  {
1396  return (std::abs)(a.m_X-b.m_X)<m_coord_uncertainty_xy
1397  && (std::abs)(a.m_Y-b.m_Y)<m_coord_uncertainty_xy
1398  && (std::abs)(a.m_Z-b.m_Z)<m_coord_uncertainty_z;
1399  }
1400 
1406  {
1410  bool operator==(const longitudinal_iterator& other) { return this->border == other.border; }
1412  {
1413  auto it = m_set->getSuccessors(border);
1414  if(it.first==it.second)
1415  {
1416  border = 0;//no successor
1417  }
1418  else
1419  {
1420  border = it.first->second;
1421  it.first++;
1422  if(it.first!=it.second)
1423  {
1424  //this is a split - end here
1425  border = 0;
1426  }
1427  }
1428  return *this;
1429  }
1431  {
1432  auto it = m_set->getPredecessors(border);
1433  if(it.first==it.second)
1434  {
1435  border = 0; // no predecessor
1436  }
1437  else
1438  {
1439  border = it.first->second;
1440  it.first ++;
1441  if(it.first!=it.second)
1442  {
1443  //this is a split - end here
1444  border = 0;
1445  }
1446  }
1447  return *this;
1448  }
1450  {
1451  Border* last;
1452  do
1453  {
1454  last = border;
1455  this->operator++();
1456  }
1457  while (border!=0);
1458  border = last;
1459  return *this;
1460  }
1462  {
1463  Border* last;
1464  do
1465  {
1466  last = border;
1467  this->operator--();
1468  }
1469  while (border!=0);
1470  border = last;
1471  return *this;
1472  }
1473  };
1474 
1476  {
1482  };
1483 
1491 
1497  int size()
1498  {
1499  return m_byID.size();
1500  }
1501 
1508  {
1509  // copy non set/map members
1513  copy.m_guard = this->m_guard;
1514  copy.m_max_lane_width = this->m_max_lane_width;
1515 
1516  // clear the copy, copy will be owner of new objects
1517  copy.clear();
1518  copy.setIsOwner(true);
1519 
1520  // add all borders to copy
1521  for(auto it = getAllBorders(); it.first!=it.second; it.first++)
1522  {
1523  Border * b = new Border(*(it.first->second));
1524  copy.insert_border(b);
1525  }
1526  }
1527  };
1528  }
1529  }
1530 }
efficiently store borders in boost R-tree
Definition: borderset.h:99
void removeBorders(const BorderSubSet &subset)
remove all borders in the given set
Definition: borderset.h:593
void removeBorders(itRegion2Border it)
remove all borders in a set described by a region iterator
Definition: borderset.h:606
void clear()
remove all borders from this, delete object if this is owner
Definition: borderset.h:284
bool isPredecessor(Border *b, Border *potentialPredecessor, bool checkForLeftNeighbor=false)
check whether potentialPredecessor is a predecessor of b
Definition: borderset.h:1041
void rotate(double psi, double rot_x=0.0, double rot_y=0.0)
Definition: borderset.h:156
BorderID2Border m_byID
Definition: borderset.h:109
void getOverlappingBorderCandidates(const std::vector< Border * > &search_area, std::vector< Border * > &result, int pred_depth)
efficient pre-search to determine candidates for border overlap
Definition: borderset.h:886
itCoordinate2Border getSplitNeighbors(Border *b)
returns an iterator pair to all borders, which split at the beginning of b (in this list,...
Definition: borderset.h:1210
Region2BordersRT m_byRegion
Definition: borderset.h:113
adore::mad::LLinearPiecewiseFunctionM< double, 4 > getCenterline(const BorderID &id)
get the linear piecewise description of the centerline:
Definition: borderset.h:647
itRegion2Border getBordersInRegion(double x, double y, double r)
get all borders in this within radius around center point
Definition: borderset.h:385
BorderSubSet getBordersAtPoint(double x, double y, double max_lane_width)
get all borders at the given point
Definition: borderset.h:403
bool addAllowedType(BorderType::TYPE type)
add border type to list of allowed border types
Definition: borderset.h:149
bool findPathBetweenBorders(BorderID curID, std::deque< BorderID > &solvedList, std::vector< Border * > targets, size_t searchDepth=10)
find path between a starting border and a list of possible target borders in a recursive manner
Definition: borderset.h:308
void removeAllowedType(BorderType::TYPE type)
remove border type from allowed border types
Definition: borderset.h:192
bool hasAllPredecessorsInSet(Border *border, const std::unordered_set< Border * > &set, int pred_depth)
check whether all predecessors up to a certain number exist within the set
Definition: borderset.h:845
Border * getRightNeighbor(Border *b)
get the right neighbor of a border
Definition: borderset.h:1279
itCoordinate2Border getSuccessors(Border *b)
get an interator pair for all borders which follow after b
Definition: borderset.h:996
bool hasRightNeighbor(Border *b)
checks whether right neighbor exists for a border
Definition: borderset.h:1292
void insert_border(Border *b, bool force_insert=false)
insert new border into this
Definition: borderset.h:225
itRegion2Border getBordersInRegion(double x0, double x1, double y0, double y1)
get all borders in this within region
Definition: borderset.h:370
void matchLanesInRegion(double *x, double *y, int count, BorderSubSet &targetSet)
get a vector of borders, which describe lanes that match the specified region
Definition: borderset.h:481
BorderIteratorPair2 getAllBorders()
get all borders in this
Definition: borderset.h:356
BorderSubSet getBordersAtPoint(double x, double y)
overload for getBordersAtPoint
Definition: borderset.h:429
Border * getBorder(const BorderID &id) const
retrieve a border by ID
Definition: borderset.h:628
double m_guard
Definition: borderset.h:105
void getDistancesBetweenBordersAlongSuccessors(Border *start, Border *end, std::vector< env::BorderBased::Border * > *allowedBorders, std::vector< double > &distances)
Get distances of all paths that are possible with a given subset of allowed borders between two borde...
Definition: borderset.h:1153
void getAllSuccessorsUpToDistance(Border *b, double distance, std::vector< Border * > &result, bool checkLeftNeighbor=true, bool includeStartBorder=false)
adds all successors existant in BorderSet for a given Border to the vector of borders
Definition: borderset.h:1126
adore::mad::LLinearPiecewiseFunctionM< double, 3 > getCenterlineWithOffset(const BorderID &id, double offset)
gets centerline between border and left neighbor
Definition: borderset.h:681
std::pair< Border *, Border * > getLaneChangeTarget(Border *current_right, bool direction_left)
computes a pair of borders (left,right) suitable for lane-changing from given source lane
Definition: borderset.h:1336
itCoordinate2Border getMergeNeighbors(Border *b)
returns an iterator pair to all borders which merge at the end of b (the list contains b itself)
Definition: borderset.h:1231
std::vector< BorderOverlap > getOverlappingBorders(const std::vector< Border * > &baseset)
retrieves all borders that overlap from the set
Definition: borderset.h:829
bool hasBorder(const BorderID &id) const
check whether a border exists in the set
Definition: borderset.h:966
void getAllPredecessorsUpToDistance(Border *b, double distance, std::vector< Border * > &result, bool checkLeftNeighbor=true, bool includeStartBorder=false)
adds all predecessors existant in BorderSet for a given Border to the vector of borders
Definition: borderset.h:1097
std::vector< BorderOverlap > getOverlappingBorders(Border *base)
retrieves borders that overlap with given border
Definition: borderset.h:802
Border * getRandomBorder()
retrieve a random border from the set
Definition: borderset.h:945
Border * getLeftNeighbor(Border *b)
Get left neighbor of a border.
Definition: borderset.h:1252
void erase_border(const BorderID &oldID)
erase border from this
Definition: borderset.h:269
bool isConnected(const BorderID &a, const BorderID &b)
check whether end of border a is beginning of border b
Definition: borderset.h:1381
Coordinate2BordersRT m_byLastCoord
Definition: borderset.h:112
BorderID2Border m_byLeftID
Definition: borderset.h:110
bool m_isOwner
define whether this Borderset is owner of the borders / manages memory
Definition: borderset.h:116
double m_coord_uncertainty_xy
Definition: borderset.h:103
virtual ~BorderSet()
Destroy the Border Set object.
Definition: borderset.h:136
double m_max_lane_width
Definition: borderset.h:106
void matchLanesInRegion(double px, double py, double psi, double a, double b, double w, BorderSubSet &targetSet)
get a vector of borders, which describe lanes that match the specified region
Definition: borderset.h:572
std::set< BorderType::TYPE > m_allowedBorderTypes
Definition: borderset.h:100
void getOverlappingBorders(Border *base, std::vector< BorderOverlap > &resultset)
computes the set of borders, which overlap with base and are thus potential points of conflict
Definition: borderset.h:710
int size()
number of borders in this
Definition: borderset.h:1497
bool hasLeftNeighbor(Border *b)
checks whether left border exists for a border
Definition: borderset.h:1267
bool isSimilar(const Coordinate &a, const Coordinate &b)
checks whether two coordinates are similar based on certainties of this
Definition: borderset.h:1394
void getOverlappingBorders(const std::vector< Border * > &baseset, std::vector< BorderOverlap > &resultset)
retrieves all borders that overlap with the base set
Definition: borderset.h:815
bool isSuccessor(Border *b, Border *potentialSuccessor, bool checkForLeftNeighbor=false)
check whether potentialSuccessor is a successor of b
Definition: borderset.h:1069
void setIsOwner(bool isOwner)
set whether this owns objects in pointers
Definition: borderset.h:214
double m_coord_uncertainty_z
Definition: borderset.h:104
itCoordinate2Border getPredecessors(Border *b)
get an interator pair for all borders which lead to b
Definition: borderset.h:1017
BorderSet()
Construct a new Border Set object.
Definition: borderset.h:123
longitudinal_iterator_creator move_along_border(Border *b)
get borders along given border
Definition: borderset.h:1490
BorderSubSet getBorderSetOutsideRegion(double x0, double x1, double y0, double y1)
get all borders outside of region in BorderSubSet
Definition: borderset.h:443
void deepBorderCopy(BorderSet &copy)
generate a complete copy including copies of objects the pointers point to
Definition: borderset.h:1507
void translate(double trans_x, double trans_y, double trans_z)
Definition: borderset.h:171
bool hasBorder(const Border *b) const
checks whether border with given ID and type exists in the set
Definition: borderset.h:980
BorderSubSet matchBordersInRegion(double *x, double *y, int count)
find all borders that (even without a left neighbor) within the specified area.
Definition: borderset.h:532
Coordinate2BordersRT m_byFirstCoord
Definition: borderset.h:111
BorderSubSet getIndexableNeighbors(Border *b)
returns the given border and all parallel borders with a changeable type, ordered from leftmost to ri...
Definition: borderset.h:1303
bool borderTypeValid(Border *b)
check whether border type is in allowed types of set
Definition: borderset.h:204
itRegion2Border getBordersOutsideRegion(double x0, double x1, double y0, double y1)
get all borders outside of region as iterator pair
Definition: borderset.h:464
TYPE
This enum holds the different types of borders.
Definition: border.h:37
@ DRIVING
Definition: border.h:39
std::list< Border * >::iterator BorderIterator
Definition: borderset.h:86
itpair< Region2BordersRT::const_query_iterator, Region2BordersRT::const_query_iterator > itRegion2Border
Definition: borderset.h:90
std::unordered_map< BorderID, Border *, BorderIDHasher > BorderID2Border
Definition: borderset.h:85
std::vector< Border * > BorderSubSet
Definition: borderset.h:92
std::pair< Coordinate::boost_point, Border * > idxCoordinate2Border
Definition: borderset.h:70
boost::geometry::index::rtree< idxCoordinate2Border, boost::geometry::index::quadratic< 16 >, boost::geometry::index::indexable< idxCoordinate2Border >, my_equal< idxCoordinate2Border, Coordinate::boost_point > > Coordinate2BordersRT
Definition: borderset.h:77
std::pair< BorderIterator, BorderIterator > BorderIteratorPair
Definition: borderset.h:87
std::pair< Border::boost_box, Border * > idxRegion2Border
Definition: borderset.h:71
boost::geometry::index::rtree< idxRegion2Border, boost::geometry::index::quadratic< 16 >, boost::geometry::index::indexable< idxRegion2Border >, my_equal< idxRegion2Border, Border::boost_box > > Region2BordersRT
Definition: borderset.h:82
std::unordered_map< Coordinate, std::list< Border * > *, CoordinateHasher > Coordinate2Borders
Definition: borderset.h:84
std::pair< BorderID2Border::iterator, BorderID2Border::iterator > BorderIteratorPair2
Definition: borderset.h:88
itpair< Coordinate2BordersRT::const_query_iterator, Coordinate2BordersRT::const_query_iterator > itCoordinate2Border
Definition: borderset.h:89
@ right
Definition: indicator_hint.h:36
@ left
Definition: indicator_hint.h:35
interval< T > cos(interval< T > x)
Definition: intervalarithmetic.h:225
int computeLaneWidthAndCenter(const adoreMatrix< double, 0, 0 > &left, const adoreMatrix< double, 0, 0 > &right, adoreMatrix< double, 0, 0 > &center)
Definition: centerandlanewidth.h:33
T min(T a, T b, T c, T d)
Definition: adoremath.h:663
void set(T *data, T value, int size)
Definition: adoremath.h:39
interval< T > sin(interval< T > x)
Definition: intervalarithmetic.h:204
int computeCenterline(const adoreMatrix< double, 0, 0 > &left, const adoreMatrix< double, 0, 0 > &right, adoreMatrix< double, 0, 0 > &center)
Definition: centerline.h:29
adoreMatrix< T, N, M > max(adoreMatrix< T, N, M > a, const adoreMatrix< T, N, M > &b)
Definition: adoremath.h:686
x0
Definition: adore_set_goal.py:25
x
Definition: adore_set_goal.py:30
y0
Definition: adore_set_goal.py:26
z0
Definition: adore_set_goal.py:27
y
Definition: adore_set_goal.py:31
y1
Definition: adore_set_pose.py:29
x1
Definition: adore_set_pose.py:28
z1
Definition: adore_set_pose.py:30
w
Definition: adore_set_pose.py:40
r
Definition: adore_suppress_lanechanges.py:209
Definition: areaofeffectconverter.h:20
This struct identifies a Border by the coordinates of the starting and the end point.
Definition: borderid.h:31
Coordinate m_last
Definition: borderid.h:32
Coordinate m_first
Definition: borderid.h:32
Definition: borderoverlap.h:32
bool hasAnyOverlap()
Check for any overlap.
Definition: borderoverlap.h:85
longitudinal_iterator_creator(BorderSet *obs, Border *border)
Definition: borderset.h:1481
longitudinal_iterator end()
Definition: borderset.h:1480
longitudinal_iterator begin()
Definition: borderset.h:1479
an iterator, which walks along borders, while there is exactly one successor (forward) or predecessor...
Definition: borderset.h:1406
longitudinal_iterator & operator--()
Definition: borderset.h:1430
longitudinal_iterator & operator++()
Definition: borderset.h:1411
BorderSet * m_set
Definition: borderset.h:1407
longitudinal_iterator & earliest()
Definition: borderset.h:1461
longitudinal_iterator & latest()
Definition: borderset.h:1449
longitudinal_iterator(BorderSet *set, Border *b)
Definition: borderset.h:1409
bool operator==(const longitudinal_iterator &other)
Definition: borderset.h:1410
The border struct contains data of the smallest.
Definition: border.h:62
bool isSplitNeighborOf(Border *other)
Check whether the border and its left neighbor start at the same point as the potential split neighbo...
Definition: border.h:401
bool isContinuousPredecessorOf(Border *other)
Check whether the border is a continuous predecessor of another border.
Definition: border.h:363
boost_box getBoostBox(Border *leftNeighbor)
Get a bounding box for the implicit lane object.
Definition: border.h:603
double getLength()
Get the length of the border.
Definition: border.h:703
BorderType::TYPE m_type
Definition: border.h:71
BorderID m_id
Definition: border.h:68
bool typeIsChangeable()
Check whether type is Changeable.
Definition: border.h:278
bool isContinuousSuccessorOf(Border *parent)
Check whether the border is a continuous successor of another border.
Definition: border.h:348
boost::geometry::model::box< Coordinate::boost_point > boost_box
bounding box
Definition: border.h:66
BorderID * m_left
Definition: border.h:69
bool isNeighborOf(Border *other)
Check whether the border is a neighbor of another border.
Definition: border.h:475
a functor, which hashes a Coordinate object -> std::unordered_set<Coordinate,CoordinateHasher> amap(0...
Definition: coordinate.h:281
This struct represents 3-dimensional coordines.
Definition: coordinate.h:34
double m_Y
Definition: coordinate.h:35
double m_Z
Definition: coordinate.h:35
double m_X
Definition: coordinate.h:35
boost::geometry::model::point< double, 3, boost::geometry::cs::cartesian > boost_point
Definition: coordinate.h:36
boost_point getBoostPoint()
Get a boost_point that has the same coordinates as the Coordinate object.
Definition: coordinate.h:202
pair of iterators to iterate from first iterator till second iterator is reached
Definition: borderset.h:46
T1 & current()
Definition: borderset.h:50
T1 first
Definition: borderset.h:47
T2 & end()
Definition: borderset.h:51
itpair(T1 first, T2 second)
Definition: borderset.h:49
T2 second
Definition: borderset.h:48
custom equal test for iterators
Definition: borderset.h:62
result_type operator()(value_type const &v1, value_type const &v2) const
Definition: borderset.h:64
bool result_type
Definition: borderset.h:63