Apollo 10.0
自动驾驶开放平台
|
The class of polygon in 2-D. 更多...
#include <polygon2d.h>
Public 成员函数 | |
Polygon2d ()=default | |
Empty constructor. | |
Polygon2d (const Box2d &box) | |
Constructor which takes a box. | |
Polygon2d (std::vector< Vec2d > points, bool check_area=true) | |
Constructor which takes a vector of points as its vertices. | |
const std::vector< Vec2d > & | points () const |
Get the vertices of the polygon. | |
const std::vector< LineSegment2d > & | line_segments () const |
Get the edges of the polygon. | |
int | num_points () const |
Get the number of vertices of the polygon. | |
bool | is_convex () const |
Check if the polygon is convex. | |
double | area () const |
Get the area of the polygon. | |
double | DistanceToBoundary (const Vec2d &point) const |
Compute the distance from a point to the boundary of the polygon. | |
double | DistanceTo (const Vec2d &point) const |
Compute the distance from a point to the polygon. | |
double | DistanceTo (const Vec2d &point, Vec2d &closest_point) const |
Compute the distance from a point to the polygon. | |
double | DistanceTo (const LineSegment2d &line_segment) const |
Compute the distance from a line segment to the polygon. | |
double | DistanceTo (const LineSegment2d &line_segment, Vec2d &polygon_closest_point, Vec2d &segment_closest_point) const |
Compute the distance from a line segment to the polygon. | |
double | DistanceTo (const Box2d &box) const |
Compute the distance from a box to the polygon. | |
double | DistanceTo (const Polygon2d &polygon) const |
Compute the distance from another polygon to the polygon. | |
double | DistanceTo (const Polygon2d &polygon, Vec2d &self_closest_point, Vec2d &other_closest_point) const |
Compute the distance from another polygon to the polygon. | |
double | DistanceSquareTo (const Vec2d &point) const |
Compute the square of distance from a point to the polygon. | |
bool | IsPointIn (const Vec2d &point) const |
Check if a point is within the polygon. | |
bool | IsPointOnBoundary (const Vec2d &point) const |
Check if a point is on the boundary of the polygon. | |
bool | Contains (const LineSegment2d &line_segment) const |
Check if the polygon contains a line segment. | |
bool | Contains (const Polygon2d &polygon) const |
Check if the polygon contains another polygon. | |
bool | HasOverlap (const LineSegment2d &line_segment) const |
Check if a line segment has overlap with this polygon. | |
bool | GetOverlap (const LineSegment2d &line_segment, Vec2d *const first, Vec2d *const last) const |
Get the overlap of a line segment and this polygon. | |
void | GetAllVertices (std::vector< Vec2d > *const vertices) const |
Get all vertices of the polygon | |
std::vector< Vec2d > | GetAllVertices () const |
Get all vertices of the polygon | |
std::vector< LineSegment2d > | GetAllOverlaps (const LineSegment2d &line_segment) const |
Get all overlapped line segments of a line segment and this polygon. | |
bool | HasOverlap (const Polygon2d &polygon) const |
Check if this polygon has overlap with another polygon. | |
bool | ComputeOverlap (const Polygon2d &other_polygon, Polygon2d *const overlap_polygon) const |
Compute the overlap of this polygon and the other polygon if any. | |
double | ComputeIoU (const Polygon2d &other_polygon) const |
Compute intersection over union ratio of this polygon and the other polygon. | |
AABox2d | AABoundingBox () const |
Get the axis-aligned bound box of the polygon. | |
Box2d | BoundingBoxWithHeading (const double heading) const |
Get the bound box according to a heading. | |
Box2d | MinAreaBoundingBox () const |
Get the bounding box with the minimal area. | |
void | ExtremePoints (const double heading, Vec2d *const first, Vec2d *const last) const |
Get the extreme points along a heading direction. | |
Polygon2d | ExpandByDistance (const double distance) const |
Expand this polygon by a distance. | |
Polygon2d | PolygonExpandByDistance (const double distance) const |
void | CalculateVertices (const Vec2d &shift_vec) |
std::string | DebugString () const |
Get a string containing essential information about the polygon for debugging purpose. | |
double | min_x () const |
double | max_x () const |
double | min_y () const |
double | max_y () const |
LineSegment2d | MinLineSegment () const |
静态 Public 成员函数 | |
static bool | ComputeConvexHull (const std::vector< Vec2d > &points, Polygon2d *const polygon, bool check_area=true) |
Compute the convex hull of a group of points. | |
Protected 成员函数 | |
void | BuildFromPoints (bool check_area=true) |
int | Next (int at) const |
int | Prev (int at) const |
静态 Protected 成员函数 | |
static bool | ClipConvexHull (const LineSegment2d &line_segment, std::vector< Vec2d > *const points) |
Protected 属性 | |
std::vector< Vec2d > | points_ |
int | num_points_ = 0 |
std::vector< LineSegment2d > | line_segments_ |
bool | is_convex_ = false |
double | area_ = 0.0 |
double | min_x_ = 0.0 |
double | max_x_ = 0.0 |
double | min_y_ = 0.0 |
double | max_y_ = 0.0 |
The class of polygon in 2-D.
在文件 polygon2d.h 第 42 行定义.
|
default |
Empty constructor.
|
explicit |
Constructor which takes a box.
box | The box to construct the polygon. |
在文件 polygon2d.cc 第 35 行定义.
|
explicit |
Constructor which takes a vector of points as its vertices.
points | The points to construct the polygon. |
在文件 polygon2d.cc 第 40 行定义.
AABox2d apollo::common::math::Polygon2d::AABoundingBox | ( | ) | const |
Get the axis-aligned bound box of the polygon.
在文件 polygon2d.cc 第 601 行定义.
|
inline |
Box2d apollo::common::math::Polygon2d::BoundingBoxWithHeading | ( | const double | heading | ) | const |
Get the bound box according to a heading.
heading | The specified heading of the bounding box. |
在文件 polygon2d.cc 第 605 行定义.
|
protected |
在文件 polygon2d.cc 第 293 行定义.
void apollo::common::math::Polygon2d::CalculateVertices | ( | const Vec2d & | shift_vec | ) |
在文件 polygon2d.cc 第 751 行定义.
|
staticprotected |
在文件 polygon2d.cc 第 393 行定义.
|
static |
Compute the convex hull of a group of points.
points | The target points. To compute the convex hull of them. |
polygon | The convex hull of the points. |
在文件 polygon2d.cc 第 340 行定义.
double apollo::common::math::Polygon2d::ComputeIoU | ( | const Polygon2d & | other_polygon | ) | const |
Compute intersection over union ratio of this polygon and the other polygon.
Note: this function only works for computing overlap between two convex polygons.
other_polygon | The target polygon. To compute its overlap with this polygon. |
在文件 polygon2d.cc 第 446 行定义.
bool apollo::common::math::Polygon2d::ComputeOverlap | ( | const Polygon2d & | other_polygon, |
Polygon2d *const | overlap_polygon | ||
) | const |
Compute the overlap of this polygon and the other polygon if any.
Note: this function only works for computing overlap between two convex polygons.
other_polygon | The target polygon. To compute its overlap with this polygon. |
overlap_polygon | The overlapped polygon. |
If | there is an overlapped polygon. |
在文件 polygon2d.cc 第 432 行定义.
bool apollo::common::math::Polygon2d::Contains | ( | const LineSegment2d & | line_segment | ) | const |
Check if the polygon contains a line segment.
line_segment | The target line segment. To check if the polygon contains it. |
在文件 polygon2d.cc 第 252 行定义.
bool apollo::common::math::Polygon2d::Contains | ( | const Polygon2d & | polygon | ) | const |
Check if the polygon contains another polygon.
polygon | The target polygon. To check if this polygon contains it. |
在文件 polygon2d.cc 第 274 行定义.
std::string apollo::common::math::Polygon2d::DebugString | ( | ) | const |
Get a string containing essential information about the polygon for debugging purpose.
在文件 polygon2d.cc 第 774 行定义.
double apollo::common::math::Polygon2d::DistanceSquareTo | ( | const Vec2d & | point | ) | const |
Compute the square of distance from a point to the polygon.
If the point is within the polygon, return 0. Otherwise, this square of distance is the minimal square of distance from the point to the edges of the polygon.
point | The point to compute whose square of distance to the polygon. |
在文件 polygon2d.cc 第 74 行定义.
double apollo::common::math::Polygon2d::DistanceTo | ( | const Box2d & | box | ) | const |
Compute the distance from a box to the polygon.
If the box is within the polygon, or it has overlap with the polygon, return 0. Otherwise, this distance is the minimal distance among the distances from the edges of the box to the polygon.
box | The box to compute whose distance to the polygon. |
在文件 polygon2d.cc 第 153 行定义.
double apollo::common::math::Polygon2d::DistanceTo | ( | const LineSegment2d & | line_segment | ) | const |
Compute the distance from a line segment to the polygon.
If the line segment is within the polygon, or it has intersect with the polygon, return 0. Otherwise, this distance is the minimal distance between the distances from the two ends of the line segment to the polygon.
line_segment | The line segment to compute whose distance to the polygon. |
在文件 polygon2d.cc 第 87 行定义.
double apollo::common::math::Polygon2d::DistanceTo | ( | const LineSegment2d & | line_segment, |
Vec2d & | polygon_closest_point, | ||
Vec2d & | segment_closest_point | ||
) | const |
Compute the distance from a line segment to the polygon.
If the line segment is within the polygon, or it has intersect with the polygon, return 0. Otherwise, this distance is the minimal distance between the distances from the two ends of the line segment to the polygon.
line_segment | The line segment to compute whose distance to the polygon. |
polygon_closest_point | Output parameter that returns the closest point on the polygon to the line segment. |
segment_closest_point | Output parameter that returns the closest point on the line segment to the polygon. If the line segment is within the polygon, |
在文件 polygon2d.cc 第 110 行定义.
double apollo::common::math::Polygon2d::DistanceTo | ( | const Polygon2d & | polygon | ) | const |
Compute the distance from another polygon to the polygon.
If the other polygon is within this polygon, or it has overlap with this polygon, return 0. Otherwise, this distance is the minimal distance among the distances from the edges of the other polygon to this polygon.
polygon | The polygon to compute whose distance to this polygon. |
在文件 polygon2d.cc 第 158 行定义.
double apollo::common::math::Polygon2d::DistanceTo | ( | const Polygon2d & | polygon, |
Vec2d & | self_closest_point, | ||
Vec2d & | other_closest_point | ||
) | const |
Compute the distance from another polygon to the polygon.
If the other polygon is within this polygon, or it has overlap with this polygon, return 0. Otherwise, this distance is the minimal distance among the distances from the edges of the other polygon to this polygon.
polygon | The polygon to compute whose distance to this polygon. |
self_closest_point | Output parameter that returns the closest point on this polygon to the other polygon. |
other_closest_point | Output parameter that returns the closest point on the other polygon to this polygon. |
在文件 polygon2d.cc 第 175 行定义.
double apollo::common::math::Polygon2d::DistanceTo | ( | const Vec2d & | point | ) | const |
Compute the distance from a point to the polygon.
If the point is within the polygon, return 0. Otherwise, this distance is the minimal distance from the point to the edges of the polygon.
point | The point to compute whose distance to the polygon. |
在文件 polygon2d.cc 第 45 行定义.
double apollo::common::math::Polygon2d::DistanceTo | ( | const Vec2d & | point, |
Vec2d & | closest_point | ||
) | const |
Compute the distance from a point to the polygon.
If the point is within the polygon, return 0. Otherwise, this distance is the minimal distance from the point to the edges of the polygon.
point | The point to compute whose distance to the polygon. |
closest_point | An output parameter that returns the coordinates of the closest point on the polygon to the input point |
在文件 polygon2d.cc 第 57 行定义.
double apollo::common::math::Polygon2d::DistanceToBoundary | ( | const Vec2d & | point | ) | const |
Compute the distance from a point to the boundary of the polygon.
This distance is equal to the minimal distance from the point to the edges of the polygon.
point | The point to compute whose distance to the polygon. |
在文件 polygon2d.cc 第 194 行定义.
Polygon2d apollo::common::math::Polygon2d::ExpandByDistance | ( | const double | distance | ) | const |
Expand this polygon by a distance.
distance | The specified distance. To expand this polygon by it. |
在文件 polygon2d.cc 第 683 行定义.
void apollo::common::math::Polygon2d::ExtremePoints | ( | const double | heading, |
Vec2d *const | first, | ||
Vec2d *const | last | ||
) | const |
Get the extreme points along a heading direction.
heading | The specified heading. |
first | The point on the boundary of this polygon with the minimal projection onto the heading direction. |
last | The point on the boundary of this polygon with the maximal projection onto the heading direction. |
在文件 polygon2d.cc 第 579 行定义.
std::vector< LineSegment2d > apollo::common::math::Polygon2d::GetAllOverlaps | ( | const LineSegment2d & | line_segment | ) | const |
Get all overlapped line segments of a line segment and this polygon.
There are possibly multiple overlapped line segments if this polygon is not convex.
line_segment | The target line segment. To get its all overlapped line segments with this polygon. |
在文件 polygon2d.cc 第 525 行定义.
std::vector< Vec2d > apollo::common::math::Polygon2d::GetAllVertices | ( | ) | const |
void apollo::common::math::Polygon2d::GetAllVertices | ( | std::vector< Vec2d > *const | vertices | ) | const |
bool apollo::common::math::Polygon2d::GetOverlap | ( | const LineSegment2d & | line_segment, |
Vec2d *const | first, | ||
Vec2d *const | last | ||
) | const |
Get the overlap of a line segment and this polygon.
If they have overlap, output the two ends of the overlapped line segment.
line_segment | The target line segment. To get its overlap with this polygon. |
first | First end of the overlapped line segment. |
second | Second end of the overlapped line segment. |
在文件 polygon2d.cc 第 474 行定义.
bool apollo::common::math::Polygon2d::HasOverlap | ( | const LineSegment2d & | line_segment | ) | const |
Check if a line segment has overlap with this polygon.
line_segment | The target line segment. To check if it has overlap with this polygon. |
在文件 polygon2d.cc 第 456 行定义.
bool apollo::common::math::Polygon2d::HasOverlap | ( | const Polygon2d & | polygon | ) | const |
Check if this polygon has overlap with another polygon.
polygon | The target polygon. To check if it has overlap with this polygon. |
在文件 polygon2d.cc 第 228 行定义.
|
inline |
bool apollo::common::math::Polygon2d::IsPointIn | ( | const Vec2d & | point | ) | const |
Check if a point is within the polygon.
point | The target point. To check if it is within the polygon. |
在文件 polygon2d.cc 第 209 行定义.
bool apollo::common::math::Polygon2d::IsPointOnBoundary | ( | const Vec2d & | point | ) | const |
Check if a point is on the boundary of the polygon.
point | The target point. To check if it is on the boundary of the polygon. |
在文件 polygon2d.cc 第 202 行定义.
|
inline |
|
inline |
在文件 polygon2d.h 第 366 行定义.
|
inline |
在文件 polygon2d.h 第 368 行定义.
|
inline |
在文件 polygon2d.h 第 365 行定义.
|
inline |
在文件 polygon2d.h 第 367 行定义.
Box2d apollo::common::math::Polygon2d::MinAreaBoundingBox | ( | ) | const |
Get the bounding box with the minimal area.
在文件 polygon2d.cc 第 624 行定义.
LineSegment2d apollo::common::math::Polygon2d::MinLineSegment | ( | ) | const |
在文件 polygon2d.cc 第 763 行定义.
|
protected |
在文件 polygon2d.cc 第 289 行定义.
|
inline |
Get the number of vertices of the polygon.
在文件 polygon2d.h 第 79 行定义.
|
inline |
Polygon2d apollo::common::math::Polygon2d::PolygonExpandByDistance | ( | const double | distance | ) | const |
在文件 polygon2d.cc 第 713 行定义.
|
protected |
在文件 polygon2d.cc 第 291 行定义.
|
protected |
在文件 polygon2d.h 第 383 行定义.
|
protected |
在文件 polygon2d.h 第 382 行定义.
|
protected |
在文件 polygon2d.h 第 381 行定义.
|
protected |
在文件 polygon2d.h 第 385 行定义.
|
protected |
在文件 polygon2d.h 第 387 行定义.
|
protected |
在文件 polygon2d.h 第 384 行定义.
|
protected |
在文件 polygon2d.h 第 386 行定义.
|
protected |
在文件 polygon2d.h 第 380 行定义.
|
protected |
在文件 polygon2d.h 第 379 行定义.