20 #include <boost/geometry.hpp>
21 #include <boost/geometry/geometries/box.hpp>
66 typedef boost::geometry::model::box<Coordinate::boost_point>
boost_box;
98 this->m_id = clone.
m_id;
115 this->m_type = clone.
m_type;
199 Border(
double rx0,
double ry0,
double rx1,
double ry1,
double lx0,
double ly0,
double lx1,
double ly1)
209 Border(
double rx0,
double ry0,
double rx1,
double ry1)
295 adoreMatrix<double,3,1> shift;
350 return parent!=0 && parent->
m_left != 0 && this->m_left != 0
365 return other!=0 && other->
m_left != 0 && this->m_left != 0
382 if(other==0 || other->
m_left==0 || this->m_left==0)
return false;
390 return (
std::max)(dxr*dxr+dyr*dyr+dzr*dzr,dxl*dxl+dyl*dyl+dzl*dzl)<=maxDistMeter*maxDistMeter;
403 return other!=0 && other->
m_left!=0 && this->m_left!=0
417 return other!=0 && other->
m_left!=0 && this->m_left!=0
430 if(other==0 || this->m_left==0 || other->
m_left==0)
return false;
444 tp1 = &(this->m_left->
m_last);
445 tp3 = &(this->m_left->
m_first);
449 tp1 = &(this->m_left->
m_first);
450 tp3 = &(this->m_left->
m_last);
488 if(other==
nullptr)
return false;
489 if(this->m_left==
nullptr)
return false;
490 if(other->
m_left==
nullptr)
return false;
491 if(other->
m_id==*(this->m_left))
495 else if(this->m_id==*(other->
m_left))
529 if (dx0*dx0 + dy0 * dy0 < dx1*dx1 + dy1 * dy1)
553 adoreMatrix<double, 3, 1> xyzmin;
554 adoreMatrix<double, 3, 1> xyzmax;
557 (xyzmin(0) >=
x0 && xyzmin(0) <=
x1)
558 || (xyzmax(0) >=
x0 && xyzmax(0) <
x1)
559 || (xyzmin(0) <=
x0 && xyzmax(0) >=
x1)
562 (xyzmin(1) >=
y0 && xyzmin(1) <=
y1)
563 || (xyzmax(1) >=
y0 && xyzmax(1) <
y1 )
564 || (xyzmin(1) <=
y0 && xyzmax(1) >=
y1)
581 if (neighbor == 0)
return false;
583 adoreMatrix<double, 3, 1> xyzmin;
584 adoreMatrix<double, 3, 1> xyzmax;
585 adoreMatrix<double, 3, 1> xyzmin0;
586 adoreMatrix<double, 3, 1> xyzmax0;
587 adoreMatrix<double, 3, 1> xyzmin1;
588 adoreMatrix<double, 3, 1> xyzmax1;
591 xyzmin = (adore::mad::min<double, 3, 1>)(xyzmin0, xyzmin1);
592 xyzmax = (adore::mad::max<double, 3, 1>)(xyzmax0, xyzmax1);
593 return ((
x0 <= xyzmax(0) && xyzmax(0) <=
x1) || (xyzmin(0) <=
x1 &&
x1 <= xyzmax(0)))
594 && ((
y0 <= xyzmax(1) && xyzmax(1) <=
y1) || (xyzmin(1) <=
y1 &&
y1 <= xyzmax(1)));
605 static const double free_road_height = 2.0;
606 adoreMatrix<double, 3, 1> xyzmin {0.0,0.0,0.0};
607 adoreMatrix<double, 3, 1> xyzmax {0.0,0.0,0.0};
635 if (leftNeighbor != 0)
637 adoreMatrix<double, 3, 1> xyzmin1;
638 adoreMatrix<double, 3, 1> xyzmax1;
640 xyzmin = (adore::mad::min<double, 3, 1>)(xyzmin, xyzmin1);
641 xyzmax = (adore::mad::max<double, 3, 1>)(xyzmax, xyzmax1);
661 bb2.min_corner().get<0>(),bb2.max_corner().get<0>())
663 bb2.min_corner().get<1>(),bb2.max_corner().get<1>());
678 if(otherBorderLeft==myLeftNeighbor)
return false;
679 if(otherBorder==myLeftNeighbor)
return false;
680 if(otherBorderLeft==
this)
return false;
682 if(otherBorderLeft->
isSuccessorOf(this->m_id) || this->isSuccessorOf(otherBorderLeft->
m_id))
return false;
684 std::pair<double,double> sLL(1e99,1e99),sLR(1e99,1e99),sRL(1e99,1e99),sRR(1e99,1e99);
692 othersmin = sRL.second;
724 if(
m_path==
nullptr)
return 1.0;
741 if (
left == 0)
return false;
756 return std::sqrt(dx*dx + dy * dy + dz * dz);
766 double dx0,dy0,dx1,dy1;
767 if(this->m_path==
nullptr)
792 double rx = dx0 * dx1 + dy0 * dy1;
793 double ry = -dy0 * dx1 + dx0 * dy1;
805 static const double s_distance = 1.0 / 0.5;
806 static const double s_angle = 1.0 / 20.0;
809 return std::sqrt(distance*distance + angle * angle);
Definition: alfunction.h:74
virtual CT f(DT x) const override
Definition: llinearpiecewisefunction.h:251
bool getFirstIntersection2d(LLinearPiecewiseFunctionM< T, n > *other, int dim1, int dim2, std::pair< T, T > &result)
Definition: llinearpiecewisefunction.h:664
virtual DT limitLo() const override
Definition: llinearpiecewisefunction.h:264
void rotateXY(double angle, double x0=0.0, double y0=0.0)
Definition: llinearpiecewisefunction.h:376
bool isPointEnclosed(LLinearPiecewiseFunctionM< T, n > *other, T px, T py, int d1, int d2, bool invert_this=false, bool invert_other=true)
Definition: llinearpiecewisefunction.h:1075
virtual T dfidx(DT x, int row)
Definition: llinearpiecewisefunction.h:400
void shiftCodomain(CT dy)
Definition: llinearpiecewisefunction.h:357
adoreMatrix< T, n+1, 0 > & getData()
Definition: llinearpiecewisefunction.h:147
virtual DT limitHi() const override
Definition: llinearpiecewisefunction.h:259
TYPE
This enum holds the different types of borders.
Definition: border.h:37
@ OTHER
Definition: border.h:38
@ EMERGENCY
Definition: border.h:41
@ DRIVING
Definition: border.h:39
@ DRIVING_DELETED
Definition: border.h:40
@ EMERGENCY_DELETED
Definition: border.h:42
@ left
Definition: indicator_hint.h:35
interval< T > atan2(interval< T > y, interval< T > x)
Definition: intervalarithmetic.h:234
adore::mad::LLinearPiecewiseFunctionM< double, 3 > function_type_xyz
Definition: linearfunctiontypedefs.h:22
T min(T a, T b, T c, T d)
Definition: adoremath.h:663
bool overlaps(const T &a0, const T &a1, const T &b0, const T &b1)
Definition: adoremath.h:655
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
y
Definition: adore_set_goal.py:31
y1
Definition: adore_set_pose.py:29
x1
Definition: adore_set_pose.py:28
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
BorderID inverse() const
returns the inverse of this
Definition: borderid.h:97
double getLength()
Definition: borderid.h:66
Coordinate m_first
Definition: borderid.h:32
void translate(double dx, double dy, double dz)
Translate a border.
Definition: borderid.h:42
void rotate(double angle, double x0=0.0, double y0=0.0)
Definition: borderid.h:78
The border struct contains data of the smallest.
Definition: border.h:62
bool intersectsRegionCombined(Border *neighbor, double x0, double x1, double y0, double y1)
Check whether the border and a neighbor, e.g. the line-segment representation, is in the given range.
Definition: border.h:579
Border(const BorderID &myid, const BorderID &leftid, Tborderpath *path)
Construct a new Border object.
Definition: border.h:174
double getStraightness()
Get the straightness of the border.
Definition: border.h:722
Border(const BorderID &myid, const BorderID &leftid, Tborderpath *path, const BorderType::TYPE type)
Construct a new Border object.
Definition: border.h:189
Direction
This enum holds the possible directions of a border.
Definition: border.h:506
@ OPPOSITE_DIRECTION
Definition: border.h:507
@ SAME_DIRECTION
Definition: border.h:507
@ UNDEFINED_DIRECTION
Definition: border.h:507
Tborderpath * m_path
Definition: border.h:70
virtual ~Border()
Destroy the Border object.
Definition: border.h:86
bool isPredecessorOf(const BorderID &successorID)
Check whether border is a direct predecessor of another border.
Definition: border.h:333
bool isDeleted()
Check whether the border is of a "deleted" type.
Definition: border.h:267
double getHeadingChangeAtTransition(Border *next)
Get the heading change at transition of two borders.
Definition: border.h:764
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
Direction getNeighborDirection()
Get the direction of the left neighbor.
Definition: border.h:517
bool isLaneChangeNeighborOf(Border *other)
Check whether the border is a lane-change-neighbor of another border.
Definition: border.h:486
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
void translate(double dx, double dy, double dz)
Translate the border.
Definition: border.h:289
bool typeIsChangeable()
Check whether type is Changeable.
Definition: border.h:278
void deleteType()
Change the type of the border to a "deleted"-type.
Definition: border.h:220
bool isContinuousPredecessorOf(Border *other, double maxDistMeter, double maxDistRel)
Check whether the border is a continuous predecessor of another border.
Definition: border.h:380
bool intersectionWithOtherBorder(Border *myLeftNeighbor, Border *otherBorder, Border *otherBorderLeft, double &mysmin, double &othersmin)
Check whether two borders intersect.
Definition: border.h:676
Border()
Construct a new Border object.
Definition: border.h:76
bool hasBBOverlap(Border *myLeftNeighbor, Border *testBorder, Border *testBorderLeft)
Check whether the bounding boxes of two lane objects overlap.
Definition: border.h:656
bool isSuccessorOf(const BorderID &predecessorID)
Check whether border is a direct successors of another border.
Definition: border.h:319
bool isRightOf(Border *other)
Check whether the border is right of another border.
Definition: border.h:428
Border(Tborderpath *path, BorderType::TYPE type)
Construct a new Border object.
Definition: border.h:159
void undeleteType()
Change the type of the border.
Definition: border.h:243
adore::mad::function_type_xyz Tborderpath
L -> X,Y,Z.
Definition: border.h:64
bool intersectsRegion(double x0, double x1, double y0, double y1)
Check whether the border, e.g. the line-segment representation, is in the given range.
Definition: border.h:551
Border(double rx0, double ry0, double rx1, double ry1, double lx0, double ly0, double lx1, double ly1)
Construct a new Border object for unit testing.
Definition: border.h:199
Border(double rx0, double ry0, double rx1, double ry1)
Construct a new Border object for unit testing.
Definition: border.h:209
Border(const Border &clone)
Construct a new Border object.
Definition: border.h:122
bool isMergeNeighborOf(Border *other)
Check whether the border and its left neighbor end at the same point as the potential merge neighbor.
Definition: border.h:415
bool isPointInsideLane(Border *left, double x, double y)
Check whether point is in lane.
Definition: border.h:739
bool isCenterLine()
returns true if border has its own inverse as left neighbor
Definition: border.h:814
bool isContinuousSuccessorOf(Border *parent)
Check whether the border is a continuous successor of another border.
Definition: border.h:348
Border(const BorderID &id, Tborderpath *path)
Construct a new Border object.
Definition: border.h:132
double getDistanceToSuccessor(Border *next)
Get the distance to successor.
Definition: border.h:751
void rotateXY(double angle, double x0=0.0, double y0=0.0)
Definition: border.h:304
void operator=(const Border &clone)
Clone a border.
Definition: border.h:96
boost::geometry::model::box< Coordinate::boost_point > boost_box
bounding box
Definition: border.h:66
double getContinuityRating(Border *next)
Get the continuity rating.
Definition: border.h:803
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
Border(Tborderpath *path)
Construct a new Border object.
Definition: border.h:145
This struct represents 3-dimensional coordines.
Definition: coordinate.h:34
bool isNear(const Coordinate &other) const
Check whether the Coordinate is near to another Coordinate.
Definition: coordinate.h:147
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