214 Vec2d *
const last)
const;
299 Vec2d *
const last)
const;
322 int Next(
int at)
const;
323 int Prev(
int at)
const;
326 std::vector<Vec2d> *
const points);
double min_y() const
Definition: polygon2d.h:317
std::vector< Vec2d > points_
Definition: polygon2d.h:328
double area_
Definition: polygon2d.h:332
double max_x() const
Definition: polygon2d.h:316
double DistanceToBoundary(const Vec2d &point) const
Compute the distance from a point to the boundary of the polygon. This distance is equal to the minim...
Define the LineSegment2d class.
Box2d BoundingBoxWithHeading(const double heading) const
Get the bound box according to a heading.
double max_x_
Definition: polygon2d.h:334
double DistanceSquareTo(const Vec2d &point) const
Compute the square of distance from a point to the polygon. If the point is within the polygon...
Polygon2d()=default
Empty constructor.
int num_points_
Definition: polygon2d.h:329
double max_y_
Definition: polygon2d.h:336
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
bool IsPointIn(const Vec2d &point) const
Check if a point is within the polygon.
The class of polygon in 2-D.
Definition: polygon2d.h:43
double min_x_
Definition: polygon2d.h:333
bool is_convex_
Definition: polygon2d.h:331
double area() const
Get the area of the polygon.
Definition: polygon2d.h:92
double ComputeIoU(const Polygon2d &other_polygon) const
Compute intersection over union ratio of this polygon and the other polygon. Note: this function only...
static bool ComputeConvexHull(const std::vector< Vec2d > &points, Polygon2d *const polygon)
Compute the convex hull of a group of points.
double 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.
std::vector< LineSegment2d > line_segments_
Definition: polygon2d.h:330
Box2d MinAreaBoundingBox() const
Get the bounding box with the minimal area.
Polygon2d ExpandByDistance(const double distance) const
Expand this polygon by a distance.
Rectangular (undirected) bounding box in 2-D.
Definition: box2d.h:52
double max_y() const
Definition: polygon2d.h:318
bool IsPointOnBoundary(const Vec2d &point) const
Check if a point is on the boundary of the polygon.
static bool ClipConvexHull(const LineSegment2d &line_segment, std::vector< Vec2d > *const points)
bool is_convex() const
Check if the polygon is convex.
Definition: polygon2d.h:86
Line segment in 2-D.
Definition: line_segment2d.h:40
Implements a class of 2-dimensional vectors.
Definition: vec2d.h:42
const std::vector< LineSegment2d > & line_segments() const
Get the edges of the polygon.
Definition: polygon2d.h:72
void ExtremePoints(const double heading, Vec2d *const first, Vec2d *const last) const
Get the extreme points along a heading direction.
bool 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 ...
bool HasOverlap(const LineSegment2d &line_segment) const
Check if a line segment has overlap with this polygon.
double min_y_
Definition: polygon2d.h:335
double min_x() const
Definition: polygon2d.h:315
bool Contains(const LineSegment2d &line_segment) const
Check if the polygon contains a line segment.
The class of Box2d. Here, the x/y axes are respectively Forward/Left, as opposed to what happens in e...
bool 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 ...
int num_points() const
Get the number of vertices of the polygon.
Definition: polygon2d.h:80
std::vector< LineSegment2d > GetAllOverlaps(const LineSegment2d &line_segment) const
Get all overlapped line segments of a line segment and this polygon. There are possibly multiple over...
AABox2d AABoundingBox() const
Get the axis-aligned bound box of the polygon.
std::vector< Vec2d > GetAllVertices() const
Get all vertices of the polygon.
std::string DebugString() const
Get a string containing essential information about the polygon for debugging purpose.
const std::vector< Vec2d > & points() const
Get the vertices of the polygon.
Definition: polygon2d.h:66
Implements a class of (undirected) axes-aligned bounding boxes in 2-D. This class is referential-agno...
Definition: aabox2d.h:42